Expand my Community achievements bar.

repeating subform calculation

Avatar

Level 2

Afternoon all:

FormCalc preference.

The first line calculates great, but the repeating lines do not. What am I missing?

I have the following code:

If(Table1.Row1.ddl[*] == "1" )then Sum(Table1.Row1.Cell9[*])

else $ = 0

endif

Thanks!

18 Replies

Avatar

Level 10

Sum(Table1.Row1[*].Cell9)

i dont know why your ddl is working but you should put [*] always on the row

Avatar

Level 2

OK, I changed the [*] to go after Row1 in both sections. Now it is

If(Table1.Row1[*].ddl == "1" )then Sum(Table1.Row1[*].Cell9])

else $ = 0

endif

It still only works on the first line of the repeating table.

How do I get it to work on the subsequent rows?

Avatar

Level 10

Sorry I didnt paid attention to you statement... Actually you can't put [*] in a if statement, if we can I am not aware on how to do it

You will have to do something like this

Avatar

Level 2

Thank you for sending this.

I've tried installing it, and I'm getting an error in the script check.

The error reads: Expected: ;, Line:3

Also, I'm assuming this is Java and that the quotations are where I shoudl insert the path, and they are not part of teh script . Correct?

Avatar

Level 2

I'm also getting a syntax error near token Table 1 message.

Any help would be greatly appreciated.

Thank you.

Avatar

Level 10

Oops, right its formcalc the third line should be:

if (xfa.resolveNode(Concat("Reference_Syntax.Table1.Row1[", i, "]ddl")) eq 1) then

Avatar

Level 2

Robert,

Thanks for your assistance with this!

The code below is kicking up an error for ( on line 2. I thought it might be missing one, but that doesn't seem to be the case. Also, what language is this? FormCalc or Java?

Thanks again!

var intTotal = 0

for (i = 0 upto xfa.resolveNode("Reference_Syntax.Table1._Row1").count step 1 do

     if (xfa.resolveNode(Concat("Reference_Syntax.Table1.Row1[", i, "]ddl")) eq 1) then

          intTotal  = intTotal + xfa.resolveNode("Reference_Syntax.Table1.Row1[" + i + "].Cell9").rawValue

     endif

endfor

Avatar

Level 10

This is FormCalc as you ask for preference... Sometimes I just mix a little bit of both together...

Sorry for the mistakes... this should be good

Avatar

Level 2

Robert,

Thank you. I'm new to this and am still having trouble with syntax.

The latest code  kicks up this:

Error: An attempt was made to reference property 'count' of a non-object in SOM expression xfa.resolveNode("Main.Table1._Row1").count.

Avatar

Level 10

Seems like your reference_syntax is incorrect, make sure you have the right names and path to the object

if all names are correct, try writting Table1.Row1").instanceManager.count

Avatar

Level 2

Hello Robert,

I'm not having any luck. I thought perhaps a form with similar dynamics would convey what I'm trying to do better.

I can get the fruit total, but not the apple total or the apple + oranges total.

Is there any chance you could take a look to see what code would fit those two slots?

Thanks,

Jan

Avatar

Level 10

Yea sure, just send the link and I'll look it up later this afternoon

Avatar

Level 10

Sorry for taking such time, i forgot yesterday

So my code above was not working because i forgot something in the for statement so it should look something like this:

Here is the link for the PDF

https://drive.google.com/file/d/0Bz8yb5apn8y4MG9tYUJSdDJhdWs/edit?usp=sharing

Avatar

Level 2

Thank you!

That works wonderfully for the Apples box.

Avatar

Level 10

In the form i provided, i also did the orange and apple total

Avatar

Level 2

Oh, cool! Thank you!!

Re: repeating subform calculation

created by Robert Gagnon Ranger<http://forums.adobe.com/people/Magus069> in LiveCycle Forms - View the full discussion<http://forums.adobe.com/message/6207185#6207185