4 Replies Latest reply on Jul 31, 2013 6:12 PM by user10729693

# Hiding a column if the column total is 0(zero)

Hi,

I am trying to hide the entire column if the column total is 0.

Template sample:

 Num IF Amt1 end if Amt2 IF Amt3 end if F NUM IF \$0.00 end if \$0.00 IF \$0.00 end if E Totals IF \$0.00 end if \$0.00 IF \$0.00 end if

Sample Data:

 Num Amt1 Amt2 Amt3 001 108.25 28.00 0.00 002 0 445.00 0.00 003 100.12 472.00 0.00 004 145.00 872.00 0.00 005 16.30 25.32 0.00

I am using the below expressions which is not working.

<?if@column:sum(amt1)!=0?> <?amt1?> <?end if?>

<?if@column:sum(amt3)!=0?> <?amt3?> <?end if?>

I would like to hide the entire Amt3 cloumn and leave the '0' at amt1 as it is. Any help would be much appreciated.

• ###### 1. Re: Hiding a column if the column total is 0(zero)

you can try like

before the table do the sum(amt3) column using variable and store that value in a variable then use that variable which u stored the sum(amt3) column value .

F variable cal to get the sum of amt3 column E

 Num IF Amt1 end if Amt2 IF Amt3 end if F NUM IF \$0.00 end if \$0.00 IF \$0.00 end if E Totals IF \$0.00 end if \$0.00 IF \$0.00 end if

then use <?if@column:variable!=0?> <?amt3?> <?end if?>

if it is not working for you send me template and xml to my email i can try it from my side and send u updated template.

my email : datlaavinash@gmail.com

• ###### 2. Re: Hiding a column if the column total is 0(zero)

It is not working for the Amt1. It is hiding the entire row even though the sum value is not equal to 0.

• ###### 3. Re: Hiding a column if the column total is 0(zero)

when you are calling a variable you should call like below you shouldn't directly use it like T6

<?xdoxslt:get_variable(\$_XDOCTX, 'T6')?>

so your if condition will be like below.

<?if@column:xdoxslt:get_variable(\$_XDOCTX, 'T6')!=0?>

• ###### 4. Re: Hiding a column if the column total is 0(zero)

Thank You Avinash for you help. It worked after i changed the  number format for the amount fields.