Jump to content

Suppress Rows Based on Specific Value


-Lisa-

Recommended Posts

I already have a rule written which suppresses rows if the value of two variables in two columns in the same row are empty. However I need to change this rule so that the rows suppress when when a specific value is defined in these two variable fields. I thought it would be as easy as changing the conditional statements from empty to the value I need to suppress...but when I preview and compose, my desired result is not as expected. Here is my code:

 

//Header Here
var tableA = new FPTable;
tableA.AddColumns(16000, 10000, 10000);

   {
   tableA.AddRows(1);
   tableA.Rows[0].Cells[0].Font = "Georgia";
   tableA.Rows[0].Cells[0].PointSize = "10";
   tableA.Rows[0].Cells[0].Font = "Georgia Bold"; 
   tableA.Rows[0].Cells[0].TextColor = "White";
   tableA.Rows[0].Cells[0].ShadeColor = "Black"; 
   tableA.Rows[0].Cells[0].ShadePct = 100;
   tableA.Rows[0].Cells[0].Margins = new FPTableMargins;
   tableA.Rows[0].Cells[0].Margins.Top = 50;
   tableA.Rows[0].Cells[0].Margins.Right = 500;
   tableA.Rows[0].CopyCells(0, 1, 2);
   tableA.Rows[0].Cells[0].HAlign = "Left";
   tableA.Rows[0].Cells[1].HAlign = "Right";
   tableA.Rows[0].Cells[2].HAlign = "Right";
   tableA.Rows[0].SetContents("Benefits", "Company Paid", "Employee Paid");
   }

//Footer Here
var tableC = new FPTable;
tableC.AddColumns(16000, 10000, 10000);

   {
   tableC.AddRows(2);

   tableC.Rows[0].Cells[0].HStraddle = 3;

   tableC.Rows[1].Cells[0].Font = "Georgia";
   tableC.Rows[1].Cells[0].PointSize = "8";
   tableC.Rows[1].Cells[0].Font = "Georgia Bold"; 
   tableC.Rows[1].Cells[0].TextColor = "Black";
   tableC.Rows[1].Cells[0].ShadeColor = "Black"; 
   tableC.Rows[1].Cells[0].ShadePct = 10;
   tableC.Rows[1].Cells[0].Margins = new FPTableMargins;
   tableC.Rows[1].Cells[0].Margins.Top = 50;
   tableC.Rows[1].Cells[0].Margins.Right = 500;
   tableC.Rows[1].Cells[0].SetBorders("Thin", "Black", "Top", "Bottom");
   tableC.Rows[1].CopyCells(0, 1, 2);
   tableC.Rows[1].Cells[0].HAlign = "Left";
   tableC.Rows[1].Cells[1].HAlign = "Right";
   tableC.Rows[1].Cells[2].HAlign = "Right";
   tableC.Rows[1].SetContents("Total Benefits", Field("TOTALBENEFITS"), Field("TOTALBENEFITSEE"));
   }

//Content Below
var counter = 0;
var RequiredBenefits = false;
var HealthBenefits = false;
var LifeDisability = false;
var RetirementBenefits = false;
var AdditionalBenefits = false;
var Col1 = ["Federal Unemployment","Local Tax","Medicare Tax","Social Security Tax","State Disability Insurance","State Unemployment Tax","Dental Claims","Dental/Vision Insurance","Health Insurance","Critical Illness","Life and AD&D Insurance","Long Term Disability Insurance","Short Term Disability Claims","Short Term Disability Insurance","Voluntary Life and AD&D","401(k)","Profit Sharing Contribution","Roth 401(k)","Bereavement Pay","Birthday Pay","Call In","Christmas Bonus","Down Time Allowance","Driving Bonus","**** Testing Allowance","Footwear","Holiday Pay","Jury Duty Pay","Moving Allowance","On Call Pay","Personal Day Pay","Safety Committee Pay","Safety Training Pay","Uniform Pay","Uniform Pay Allowance","Vacation Pay","Workers' Compensation Insurance"];
var Col2 = [Field("FederalUnemployment"),Field("LocalTax"),Field("MedicareTax"),Field("SocialSecurityTax"),Field("StateDisabilityInsurance"),Field("StateUnemploymentTax"),Field("DentalClaims"),Field("DentalVisionInsurance"),Field("HealthInsurance"),Field("CriticalIllness"),Field("LifeandADDInsurance"),Field("LongTermDisabilityInsurance"),Field("ShortTermDisabilityClaims"),Field("ShortTermDisabilityInsurance"),Field("VoluntaryLifeandADD"),Field("401k"),Field("ProfitSharingContribution"),Field("Roth401k"),Field("BereavementPay"),Field("BirthdayPay"),Field("CallIn"),Field("ChristmasBonus"),Field("DownTimeAllowance"),Field("DrivingBonus"),Field("****TestingAllowance"),Field("Footwear"),Field("HolidayPay"),Field("JuryDutyPay"),Field("MovingAllowance"),Field("OnCallPay"),Field("PersonalDayPay"),Field("SafetyCommitteePay"),Field("SafetyTrainingPay"),Field("UniformPay"),Field("UniformPayAllowance"),Field("VacationPay"),Field("WorkersCompensationInsurance")];
var Col3 = [Field("FederalUnemploymentEE"),Field("LocalTaxEE"),Field("MedicareTaxEE"),Field("SocialSecurityTaxEE"),Field("StateDisabilityInsuranceEE"),Field("StateUnemploymentTaxEE"),Field("DentalClaimsEE"),Field("DentalVisionInsuranceEE"),Field("HealthInsuranceEE"),Field("CriticalIllnessEE"),Field("LifeandADDInsuranceEE"),Field("LongTermDisabilityInsuranceEE"),Field("ShortTermDisabilityClaimsEE"),Field("ShortTermDisabilityInsuranceEE"),Field("VoluntaryLifeandADDEE"),Field("401kEE"),Field("ProfitSharingContributionEE"),Field("Roth401kEE"),Field("BereavementPayEE"),Field("BirthdayPayEE"),Field("CallInEE"),Field("ChristmasBonusEE"),Field("DownTimeAllowanceEE"),Field("DrivingBonusEE"),Field("****TestingAllowanceEE"),Field("FootwearEE"),Field("HolidayPayEE"),Field("JuryDutyPayEE"),Field("MovingAllowanceEE"),Field("OnCallPayEE"),Field("PersonalDayPayEE"),Field("SafetyCommitteePayEE"),Field("SafetyTrainingPayEE"),Field("UniformPayEE"),Field("UniformPayAllowanceEE"),Field("VacationPayEE"),Field("WorkersCompensationInsuranceEE")];

var table = new FPTable;
table.AddColumns(16000,10000,10000);
for(x=0;x<6;x++)
{
   if((Col2[x] != "$0.00") && (Col3[x] != "$0.00"))
       {
           RequiredBenefits = true;
           break;
       }
}
if(RequiredBenefits == true)
{
   SubHeaderContent("Required Benefits");
   for(x=0;x<6;x++)
       RowContents(Col1[x],Col2[x],Col3[x]);
}
for(x=6;x<9;x++)
{
   if((Col2[x] != "$0.00") && (Col3[x] != "$0.00"))
   {
       HealthBenefits = true;
       break;
   }
}
if(HealthBenefits == true)
{
   SubHeaderContent("Health Benefits");
   for(x=6;x<9;x++)
       RowContents(Col1[x],Col2[x],Col3[x]);
}
for(x=9;x<15;x++)
{
   if((Col2[x] != "$0.00") && (Col3[x] != "$0.00"))
   {
       LifeDisability = true;
       break;
   }
}
if(LifeDisability == true)
{
   SubHeaderContent("Life and Disability");
   for(x=9;x<15;x++)
       RowContents(Col1[x],Col2[x],Col3[x]);
}
for(x=15;x<17;x++)
{
   if((Col2[x] != "$0.00") && (Col3[x] != "$0.00"))
   {
       RetirementBenefits = true;
       break;
   }
}
if(RetirementBenefits == true)
{
   SubHeaderContent("Retirement Benefits");
   for(x=15;x<18;x++)
       RowContents(Col1[x],Col2[x],Col3[x]);
}
for(x=18;x<37;x++)
{
   if((Col2[x] != "$0.00") && (Col3[x] != "$0.00"))
   {
       AdditionalBenefits = true;
       break;
   }
}
if(AdditionalBenefits == true)
{
   SubHeaderContent("Additional Benefits");
   for(x=18;x<37;x++)
       RowContents(Col1[x],Col2[x],Col3[x]);
}
// Return the combined tables (header, content, footer)
return tableA.MakeTags() + table.MakeTags() + tableC.MakeTags();


//Functions.  These will dictate the style of the Subheader and Content (and make the Content suppress if column b and c are empty)
function SubHeaderContent(a)
{
   table.AddRows(1);
   table.Rows[counter].Cells[0].Bold = "On";

   table.Rows[counter].Cells[0].Font = "Georgia";
   table.Rows[counter].Cells[0].PointSize = "8";
   table.Rows[counter].Cells[0].HAlign = "Left";
   table.Rows[counter].Cells[0].Margins = new FPTableMargins;
   table.Rows[counter].Cells[0].Margins.Top = 40;
   table.Rows[counter].Cells[0].Margins.Bottom = 40;
   table.Rows[counter].Cells[0].Margins.Right = 500;
   table.Rows[counter].Cells[0].SetBorders("Thin", "Black", "Bottom");
   table.Rows[counter].Cells[0].HAlign = "Left";
   table.Rows[counter].Cells[0].HStraddle = 3;

   table.Rows[counter].SetContents(a);
   counter++;    
}
function RowContents(a,b,c)
{
   if((b != "$0.00") && (c != "$0.00"))
   {
       table.AddRows(1);

       table.Rows[counter].Cells[0].Font = "Georgia";
       table.Rows[counter].Cells[0].PointSize = "8";
       table.Rows[counter].Cells[0].HAlign = "Left";
       table.Rows[counter].Cells[0].Margins = new FPTableMargins;
       table.Rows[counter].Cells[0].Margins.Top = 40;
       table.Rows[counter].Cells[0].Margins.Bottom = 40;
       table.Rows[counter].Cells[0].Margins.Right = 1500;
       table.Rows[counter].Cells[0].SetBorders("Thin", "Black", "Bottom");
       table.Rows[counter].CopyCells(0, 1,2)
       table.Rows[counter].Cells[0].HAlign = "Left";
       table.Rows[counter].Cells[1].HAlign = "Right";
       table.Rows[counter].Cells[2].HAlign = "Right";

       table.Rows[counter].SetContents(a,b,c);
       counter++;
   }
} 

 

Any thoughts as to what I'm doing wrong?

 

Thanks!!

Link to comment
Share on other sites

I failed to mention that the table also has several sub-headers. These sub-headers are currently set to suppress when each of the fields that are assigned to the sub-headers all contain empty variables.

 

So basically, I need to alter this rule so that everything that is currently set to suppress when empty now suppresses when the values equal "$0.00".

 

Thanks.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...