Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

Problem with formcalc code not properly executing in a dynamic table

critski
Level 1
Level 1

I've got a table which has a sub total field in it with the following code:

if(Table2.Row1[*].level eq 1) then

Table2.FooterRow[0].Cell6 = Sum(Table2.Row1[*].shortdays)* 168.30*(Table2.Row1[*].staffrequired);

elseif (Table2.Row1[*].level eq 2)then

Table2.FooterRow[0].Cell6 = Sum(Table2.Row1[*].shortdays)* 176.33*(Table2.Row1[*].staffrequired);

elseif (Table2.Row1[*].level eq 3)then

Table2.FooterRow[0].Cell6 = Sum(Table2.Row1[*].shortdays)* 188.30*(Table2.Row1[*].staffrequired);

elseif (Table2.Row1[*].level eq 4)then

Table2.FooterRow[0].Cell6 = Sum(Table2.Row1[*].shortdays)* 269.35*(Table2.Row1[*].staffrequired);

endif

The problem i am having is that when i add a new line the formula above only takes the staffrequired field value from the first row not any subsequent row.  I can't work out exactly what I am doing wrong as apart from this issue it seems to be working fine.

2 Replies
whyisthisme
Level 7
Level 7

you need to put "Sum()" around Table2.Row1[*].staffrequired as you have for shortdays

critski
Level 1
Level 1

I tried that just now and it seems to work.  The only issue is that now if i go back and change staff required to 0 in a previous line it still adds the number of days up  from both lines.  I think I probably need to change to javascript so that it calculates each row independently then totals at the bottom but not too sure how to do that