Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

JavaScript Sum Help

Avatar

Level 3

Hi Folks,

I have a LiveCycle purchase request form that calculates a grand total. If that grand total is equal to or greater than $1,000.00 the subform "comparativeBids" should be made visible. The calculation works fine in FormCalc but not in JavaScript. Can someone help me figure how to make the JavaScript calculation work? I am not familiar with FormCalc enough to write conditional statements using that language but I am open to using it is someone can provide the script.

Anyway, here is my JavaScript for grandTotal (calculate event):

PRForm.generalInfo.totalGroup.totalTable.grandTotalRow.grandTotal::calculate - (JavaScript, client)

this.rawValue = subtotalRow.subtotal + taxRow.tax + shippingRow.shipping;

   

comparativeBids.presence = "hidden";

var order= xfa.resolveNode("PRForm.generalInfo.totalGroup.totalTable.grandTotalRow.grandTotal").rawValue;

if (order >= 1000) {

    comparativeBids.presence = "visible";

}

Note: I have also tried the calculation as this.rawValue = subtotalRow.subtotal.rawValue + taxRow.tax.rawValue + shippingRow.shipping.rawValue; --- again no success with the JavaScript version.

Thanks in advance for the help!

1 Accepted Solution

Avatar

Correct answer by
Level 7

Well in formcalc the if statement would be:

if ($ >= 1000) then

     comparativeBids.presence = "visible"

else
     comparativeBids.presence = "hidden"

endif


View solution in original post

2 Replies

Avatar

Correct answer by
Level 7

Well in formcalc the if statement would be:

if ($ >= 1000) then

     comparativeBids.presence = "visible"

else
     comparativeBids.presence = "hidden"

endif


Avatar

Level 3

Thanks. The conclusion of my form was that the sum line + the show/hide condition don't work when assigned to the same field. So I assigned the condition whyisthisme to an invisible text field and now all works fine. Thanks for the help.