Expand my Community achievements bar.

Valid Scrypt for Grand Total

Avatar

Former Community Member

I have created an expanding table, using the following link:

http://forms.stefcameron.com/2009/02/25/expandable-table-with-totals/

(instructions shown below)

662366_pastedImage_1.png

However, I have been unsuccessful with the Grand Total value. As shown in the picture below, the rest of the totals show but the Grand Total remains blank. I must include the Installation fee (marked by the check box)

662368_pastedImage_3.png

This is the last step needed to complete my form, I would really appreciate all the help i can receive.

Thank you!

8 Replies

Avatar

Former Community Member

I have also used this scrypt, however that also did not work on this form.

$.rawValue = Sum(Item[*].Total);

Avatar

Level 7

I hastily threw together a simple example, because I'm lazy, and I was able to make this work. I'm including a screenshot of my code and how I set up the check box.Untitled.png

Untitled2.png

If that extra example doesn't help, can you include the code you're using for the total field?

Avatar

Former Community Member

Thank you! I did try both, maybe Im missing a step.

This is what I have on the form..

For the item list

662316_pastedImage_0.png

For the Total

662317_pastedImage_1.png

For the Grand Total

662378_pastedImage_2.png

Can you direct me from here. I tried both options you provided but nothing was showing.

Thank you for your help!

Avatar

Level 7

I think I see the problem. The code you got from the tutorial and the code from my example don't match the names you used in your table.

If "Installation" is the name of your check box, your grand total cell should look like

$.rawValue = Sum(Row1[*].Total) + Installation

If it is named something else, then you'll have to adjust the code to match the name or adjust the name to match the code.

Avatar

Former Community Member

I noticed you placed "Row1"

This table allows other rows to be added.. the previous code had "Item[*]" to sum all the instances for item.

Basically, the form consists of 6 different options. So the client will add up to 6 different rows of items. I tried the code you provided, but it still didn't work.

Avatar

Level 7

Row1[x] (where x is an integer) is the name and subscript for your rows. In the example, Stef (if that's his real name) used Item as the name for his rows. In your form, you are using Row1. So, each row is named Row1[0], Row1[1], Row1[2], etc... Inside of each Row1, you have a text field called "Total." Since you're using formCalc, you are summing the total of those rows using Row1[*].Total. So, if you haven't changed anything else, you should (at the very least) be able to sum the rows in the grand total box using


$.rawValue = Sum(Row1[*].Total)


Now, the checkbox is a different story. The checkbox has an "on" value and an "off" value. We can use that in formCalc to more easily add it to the value that we're going to get for the grand total. If you set the "on" value to 300 (I included an illustration of that in my first picture), then you can use the name of the checkbox to get your total. If the checkbox is checked or "on", then the on value (300 in my example) gets added to the total, and if it's unchecked or "off", then the off value (0 in my example) gets added. The checkbox also has to have it's name correct. In my example it's called CheckBox1, in your code you have Installation. So, whatever you named the checkbox needs to go at the end of the formula we're using like so.


$.rawValue = Sum(Row1[*].Total) + Installation


If you named your checkbox something else, then you'll need to change the word "Installation" to whatever the checkbox is named. (The name is in the hierarchy tree.)

Avatar

Level 1

While scripting the total, you can press Ctrl and click inside the cell, whose repetitions contain the values to be added.

This ensures you're using the right path to the cells.

You can also preview in LiveCycle, then get back Design View and and check the Log palette for runtime errors, which the syntax check won't catch.

This may require providing a test XML to effectively fill the table with data (Edit -> Form Properties -> Preview -> Data File). (There is even a "Generate Preview Data" in Livecycle ES2, so you may be able to readily get an XML. I have used an actual XML for test, which external tools interacting with Adobe allowed me to get, but this may not be your case.)