Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Help! Grand Total Script Errors!

Avatar

Level 1

Hello,

I've taught myself to create 33 PDF forms in Adobe Acrobat 8.2 LiveCycle Designer for my company. I can add simple totals across a table, but I'm having problems with the Grand Total field. In Excel I could complete this function in less than one minute, but for some reason I've been sent on a wild goosechase to calculate a simple Grand Total in Designer. I have almost no knowledge of FormCalc or fJavaScripting - the only scripting I know is from my experience with Excel.

This is what I've done (copy of form table attached):

Binding Names:

Qty                  Unit Price               Total Price               Calculation

--------------------------------------------------------------------------------------------------------

quantityA          unitpriceA               totalpriceA               quantityA+unitpriceA (this works)                   

quantityB          unitpriceB               totalpriceB               quantityB+unitpriceB (this works)

quantityC          unitpriceC               totalpriceC               quantityC+unitpriceC (this works)

quantityD          unitpriceD               totalpriceD               quantityD+unitpriceD (this works)

                               Grand Total Calculation:                  sum(totalpriceA+totalpriceB+totalpriceC+totalpriceD)

Error I receive: 

  

Script failed (language is formcalc; context is xfa[0].form[0].form1[0].#subform[0].Table7[0].Row5[1].grandTotal[0]) script=sum(totalpriceA+totalpriceB+totalpriceC+totalpriceD)

Error: accessor ‘totalpriceA’ is unknown.

I've also tried copy & pasting this into the script editor, but it didn't work either:

<calculate>

     <script contentType="application/x-javascript">this.rawValue = firstfield.rawValue + secondfield.rawValue;</script>

</calculate>

Help, this is all I need to do to complete this job!  Thanks so much for your help!

Gia

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

The issue is that the GrandTotal field that you are calculating is not in the same context as the other fields so you must "path" your way to them. See my attached updated sample. A good way to make sure that this does not happen again is to place the cursor in the script editor where you want the object reference to appear. Now hold down the ctrl key and point to the field that you want to reference. The mouse pointer will change to a V. Now click the mouse and the proper field reference will appear where your cursor was.

Paul

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member

The issue is that the GrandTotal field that you are calculating is not in the same context as the other fields so you must "path" your way to them. See my attached updated sample. A good way to make sure that this does not happen again is to place the cursor in the script editor where you want the object reference to appear. Now hold down the ctrl key and point to the field that you want to reference. The mouse pointer will change to a V. Now click the mouse and the proper field reference will appear where your cursor was.

Paul

Avatar

Level 1

Thanks Paul!

Being self-taught, I somehow missed the part about directing the path.

This worked perfectly on several different tables.

I can't thank you enough!

Gia

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----