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.

Recalculate not working on LiveCycle document after new fields added

Avatar

Level 1

Hello all.

This may be a really simple fix, but I have not been able to figure out the solution although I am sure that it has something to do with the form layout.

I recently updated a LiveCycle employee performance review form that I did to add some averages but after adding them the final score does not tally until you change the score in all 4 sub-areas that make up the total.

I have looked around and sure that it is a simple fix, but even with the form recalculate call am not able to get it to update after any change.

Any help or direction will be appreciated.


Andrew M.

5 Replies

Avatar

Level 10

Hi Andrew, One problem I find with the recalculate event is that any errors in your script don't always show up, they seem to be silently swallowed.  I often put a temporary button on the form and test the script in the click event of that.  Otherwise, it hard to say without seeing the form.  Can you post it on Acrobat.com (or similar) and add the link to this thread?  Bruce

Avatar

Level 1

Hi Bruce.


Thank you for the reply, I never though of using the temporary button totest them.

I have attached a link to the current form on DropBox (.tds format in a zipfile) that I am having trouble with to this message.

http://db.tt/SjRCjt0a

Any help is truly appreciated.

Andrew

Avatar

Level 10

Hi Andrew,

I think is just a logic problem in your form the four sub-areas have been scaled, so if they put in a B for the first sub-area that related to 72 then gets scaled by 0.1 but the total seems to still refer to the 72 value (not the 7.2).

There also seems to be a mismatch between the dropdown values and the code, B is 72 in the code but the code has 72 as a B-

Regards

Bruce

Avatar

Level 1

Hi Bruce.

Yes, the idea for our HR department was that certain areas are weighted more than others depending on the area. They are also looking to change around some of the scoring.

The problem where I run into is that once they put at least one score in each of the four subcategories they will get the final average, but if they change only one subcategory, the final average will not recalculate. They actually have to change at least one score in each of the four subcategories in order for the final average to change.

This is why I thought it may have been a recalculate issue. Before we had the weighting and scoring of each category, the final average would update with no issue.

Not sure if this helps to shed light on the issue.


Thanks,

Andrew

Avatar

Level 10

Hi Andrew,

You seem to have a circular dependency in your calculation scripts.  The one in form1.#subform[0].Body.ScoreLetterGen::calculate is updating the field as form1.#subform[0].Body.ScoreLetter::calculate

If you can add a xfa.host.messageBox(xfa.form.form1.#subform.ScoreAvg.rawValue) to the form1.#subform[0].Body.ScoreLetter::calculate code you can see that it gets called a lot of times.

You might find it easier to reference the current field using this, and you can remove the reference to the hidden field by using a variable. try something like;

var score = SUM((ScoreAvgGen*.1)+(ScoreAvgJK*.09)+(ScoreAvgJD*.36)+(ScoreAvgOSL*.45))

if ( score == null ) then

this = ""

elseif ( score >= 90 ) then

this = "A"

elseif ( score >= 85 ) then

this = "A-"

elseif ( score >= 77 ) then

this = "B+"

elseif ( score >= 75 ) then

this = "B"

elseif ( score >= 72 ) then

this = "B-"

elseif ( score >= 67 ) then

this = "C+"

elseif ( score >= 65 ) then

this = "C"

elseif ( score >= 62 ) then

this = "C-"

elseif ( score >= 57 ) then

this = "D+"

elseif ( score >= 55 ) then

this = "D"

elseif ( score < 55 ) then

this = ""

endif

Good luck

Bruce