These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Trying to get Dropdown list value to "SUM" within a table

StalnakerJ
Registered: Jun 28 2009
Posts: 8

Hello,
 
I am still pretty new to the all that Adobe can do. So I will try to explain and be a clear as possible.
 
I am using Adobe LiveCylcle Designer and attempting the following:
 
1. I have a drop-down with 5+ List Items. In the Binding Tab, I have specified Item Values for each List item. I also have a check box, that if checked value $2.00.
 
2. The "item values" are being populated in a table based, of course, on what you select. Example: Dropdown=Apples (value $1.00), table displays $1.00.
 
All that seems to work fine, UNTIL, I go to the table, add a new row, and try to add (SUM) the Dropdown value with another row (pulled from a check box value).
 
I can get the value of the check box to sum, but not the value from the dropdown list. I am sure that this is possible and probably pretty simple.
 
Thank you for any assistance with this issue.
  

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
So you want to sum the items in a particular column of a table? And then add in a value from some other item?

This is actually pretty easy to do with FormCalc. The trick, as with all LiveCycle scripting, is to know how to form the SOM path.

For example, here's a FormCalc calculation script:

Sum(MyTable.Row1[*].price) + MyOtherTable.Row0.OtherValue

In this case the SOM path "MyTable.Row1[*].price" references the price field in all instances of "Row1" in "MyTable". The SOM path "MyOtherTable.Row0.OtherValue" references a field named "OtherValue" which is in "Row0" of "MyOtherTable".

Watch this video:
Scripting LiveCycle Forms

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
You may need to update the objects that have been modified by using the 'xfa.resolveNodes()' before using the Sum function.

George Kaiser

StalnakerJ
Registered: Jun 28 2009
Posts: 8
Thomp,

Thank you for your help. Ok, before I look like a complete idiot. Situation: In your video(great video by the way, very helpful`), where your field1 is a "numeric" field, mine is a "text" field. Mine is text because I want to populate the values from a dropdown field from another field in the "field1". Well, I get the values to populate, but I can't get them to SUM in my sumfield, which is your mysum. In your example, your field2 is also a numeric, as is mine, but I am getting the data that goes in that field from a checkbox value from another field. This works fine.

So I guess the question is this: I am assuming that my SUM does not work since my "field1" is a "text" field?

The note from gkaiseril looks VERY familer, (this is somewhat what I saw when I went to SUM), but I have NO idea how to update the objects.

I know this is elementary, but I learn via trying...over and over and over. And by reading a lot of forums.




thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Try this, change the text fields to numeric fields and see if the calculation works. If it doesn't work then you know there is another problem the code. If it does work then all you have to do is modify the code to operate with text fields.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

StalnakerJ
Registered: Jun 28 2009
Posts: 8
Thomp, I should have told you in the previous reply that I did change the field to a numerics (just the field1, the others were already numerics after watching your video) and when I did this the drop down value no longer populated in field1. It returns "0", but the SUM works, it just shld not be "0". That is why I thought that I could not SUM a field that was text.

I have no idea how to modify the code with text fields. But I am still hunting.

This is what I did: (yes, I know the names are horrible, I am taking your advice from your video)
1. dropdown field value populates to field1(which is a text field) and in the field1(my name=Row5[0].Cell1) event I have Table2.Row1.Cell1
2. check box value populated to field2 (my name=Row5[1].True1), no issue with this one
3. sumfield(numeric)event I have Sum(Row5[0].Cell1,Row5[1].True1)

As you guessed it, only the sum of field2 (my name=Row5[1].True1) is in sumfield

I am still working on another way instead of using the drop down, I guess I could use if statements. I only have about 8 values. I just didn't want to leave room for the user to make errors.

Thanks for your help. I am aware that you are busy.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
In the video I show the JavaScript code that is equivalent to the FormCalc SUM function. In addition to the you'll need to explicitly convert text fields into Number Fields. I think I also show that in the video.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

StalnakerJ
Registered: Jun 28 2009
Posts: 8
Thomp,

I was only able to watch the first part, I will watch the second part tomorrow morning. Thank you very much. Hopefully after watching it, I will be able to fix this form!!