Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Calculation problems

Avatar

Level 2

Hi,

I've made a document with several tables and like to make some calculations. I already looked in the help and also in the forum. But everything that i try, won't succied. Is there anybody who can help me with this? I've made a picture to explain what my question is and also the pdf.

I hope it's clear for you what the problem is.

Greetings, Josh

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

You did not have a proper sequence of rows .....I renamed them so they were sequential from Row 6 to Row37. Then updated the scripts for loop to a max value of 37.

Paul

View solution in original post

8 Replies

Avatar

Former Community Member

I was able to do all of the additions but I did not understand what you were trying to do with #4

Paul

Avatar

Level 2

Hi Paul,

Thanks a lot, this is half of my problem. The other problem was that i need to count al the times that "ic" was picked from the dropdown menu and al the times that "post -ic"was picked en all the times that "HC" was picked and this has to be counted in the table "huidige bedbezetting". Is this possible from a dropdown menu?

Avatar

Former Community Member

OK ...here is a modified version. I added code to the exit event of the dropdowns (I only did the 1st 10 or so)

and what it does is cycle through each dropdown and will count the number of instances of the selcted items, then update the table. Note that

I had to rename the first couple of Rows so I could keep them in sequence (row 6-40 is what is

being added).

You only need to copy and paste the code one ach dropdowns exit event.....make sure that the language is set to Javascript (you can make it th edefault in the Form Properties).

Paul

Avatar

Level 2

Hi Paul,

This is exactly what i meant. Looks very good. But i tried to do what you said and copy all the script and watch if javascript was on, but my things will only give zero. What did i do wrong? The first 8 were yours, i've done the rest, but sadly not good enough. What did i miss?

What is the code for deducting, i now know what to do for making a sum?

Greetings Josh

Avatar

Correct answer by
Former Community Member

You did not have a proper sequence of rows .....I renamed them so they were sequential from Row 6 to Row37. Then updated the scripts for loop to a max value of 37.

Paul

Avatar

Level 2

Hi Paul,

Thank you very much, sorry but i didn't understand the sequens stuff, but it looks great.

One final question; in table 4 is the sum of the totaal of table 2 and the totaal of table 3, but this has to be table 2 minus table 3. What do i have to fill in instead of sum.

Avatar

Former Community Member

So the command woudl be:

$ = Table2.Row6.TextField7 - Table3.Row6.NumericField1

Paul

Avatar

Level 2

Thanks, thats just great.


Thanks for al the help!!!!!
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] ----