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

VERY simple calculation - "Script Failed" Value Unknown

Avatar

Former Community Member

Greetings People. I am not new to LCD (I have been using this product for some time to create graphic documents), how-ever I am new to using LCD to create documents that do mathematical calculations...which is exactly why I am having this issue. Grrrrrrr sorry...

I have a simple document with a few tables/rows. Each row has a simple condition value (if something is checked there is a numeric value), this works great. What I am trying to do is just total the value of all the rows in each table, and that bombs (errors) with "Script Failed (language is formcalc; context is..) and then identifies all the fields names as "Unknown". I am tried testing a few different way and I always get this error, in fact I can't seem to get this form to just add to simple numbers without a similar error.

Note. I am sure this is me - just being less-than-smart, I don't belive there is a error with LCD itself.

Any direction would be most appreciated. Thanks VERY much!

http://www.chnwi.info/test/wellness_scorecard_final.pdf

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Couple of things:

1. The sum command has capital S so it is Sum() not sum()

2. There is no space between Sum and the (

3. When you reference the other fields they are in a different subform than the total, so you must path to the fields. The easiest way to do this is in the Script Editor put the cursor where you want the reference to appear, then hold ctrl down and  move the cursor to the desired field. The cursor will change to a V. Release the mouse when you are on the field and the correct reference will be written into the script editor.

4. You cannot split the command across two lines ...keep it all on one line.

I have included my modified version. I only did the 1st table.

Paul

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member

Couple of things:

1. The sum command has capital S so it is Sum() not sum()

2. There is no space between Sum and the (

3. When you reference the other fields they are in a different subform than the total, so you must path to the fields. The easiest way to do this is in the Script Editor put the cursor where you want the reference to appear, then hold ctrl down and  move the cursor to the desired field. The cursor will change to a V. Release the mouse when you are on the field and the correct reference will be written into the script editor.

4. You cannot split the command across two lines ...keep it all on one line.

I have included my modified version. I only did the 1st table.

Paul

Avatar

Former Community Member

WOW! You nailed it...and gave me a solid quick education. Thanks, everything is perfect.

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] ----