Skip navigation
Amidwinter
Currently Being Moderated

Recalculate not working on LiveCycle document after new fields added

Aug 17, 2012 1:24 PM

Tags: #adobe #livecycle #livecycle_designer #formcalc #recalculate

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.

 
Replies
  • Currently Being Moderated
    Aug 17, 2012 3:49 PM   in reply to Amidwinter

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 20, 2012 4:05 PM   in reply to Amidwinter

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 22, 2012 7:44 PM   in reply to Amidwinter

    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

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points