Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Calculation not recalculating on a change

goslinc
Level 2
Level 2

The calculation below works for determining a late fee IF the user answers No to BOTH questions in fields "QSFiling" and "LateFeePd".  How do I have the late fee show 0 if the questions are any answer other No? OR when they might change from NO to a YES

 

if

(dataroot.Parent.SReport.QSFiling.rawValue ="No" && dataroot.Parent.SReport.LateFeePd.rawValue ="No"){dataroot.Voucher.LateFee.rawValue=

100;}

16 Replies
Mandy_Wiesener
Level 5
Level 5

Hi,

you are wrong with the syntax.

= assigning a value

== is an equal operator

You have to write:

if (dataroot.Parent.SReport.QSFiling.rawValue  == "No" &&  dataroot.Parent.SReport.LateFeePd.rawValue == "No")

{

     dataroot.Voucher.LateFee.rawValue = 100;

}

This means:

IF the value from the field QSFiling No AND the value from the field LateFeePD No THEN should be the value of LateFee is 100.

Helpful?

Mandy

Vjay_Reddy
Level 5
Level 5

Hi,

Keep below script on calculate event of the LateFee field.

if( dataroot.Parent.SReport.QSFiling.rawValue == "No" && dataroot.Parent.SReport.LateFeePd.rawValue == "No")

{

               dataroot.Voucher.LateFee.rawValue=100;

}

else

{

               dataroot.Voucher.LateFee.rawValue=0;

}

Thanks

Vjay

goslinc
Level 2
Level 2

I made that change however when I change the answer No to Yes or Yes to No it still does not recalculate, its sits with whatever I first answered in those fields.

goslinc
Level 2
Level 2

Not working. Does it matter that the “LateFee” field is in the Voucher subform and the two questions are in my SReport form?

Vjay_Reddy
Level 5
Level 5

If you provide complete path of the fileds it doesnt matter.

Are you able to get LateFee = 100 ; if both the fields are "No"?

if you are getting then there might some issue with the script or the form settings.

Can you mail me the form muchukotavijay@gmail.com or you can share it here.

Thanks

Vjay

goslinc
Level 2
Level 2

Hi….thank you for your assistance!

goslinc
Level 2
Level 2

Good afternoon-

I hope you might still be available for assistance. When I run the script below in my LateFee field, it works if the two questions (QSFiling and LateFeePd) are answered NO.

However, if the user changes their initial answer from NO to YES the LateFee remains set at 100

dataroot.Fee.LateFee::calculate - (JavaScript, client)

if(dataroot.Parent.SReport.QSFiling.rawValue ="No" && dataroot.Parent.SReport.LateFeePd.rawValue ="No")

{

dataroot.Fee.LateFee.rawValue=100;

}

else

{

dataroot.Fee.LateFee.rawValue=0;

Vjay_Reddy
Level 5
Level 5

As

nele_sonntagsaid you are still using  Assignment Operators instead of using Comparison Operators.

Change your scrip to

if(dataroot.Parent.SReport.QSFiling.rawValue == "No" && dataroot.Parent.SReport.LateFeePd.rawValue == "No")

{

    dataroot.Fee.LateFee.rawValue=100;

}

else

{

    dataroot.Fee.LateFee.rawValue=0;

}

Thanks

Vjay

goslinc
Level 2
Level 2

But everytime I do it as operators instead of comparisons it doesn’t even computer if the user answers No. Whereas, if I am using the comparison operators it at least computes if answers are no.

Form attached.

Does it matter that my two question fields are droplist

Vjay_Reddy
Level 5
Level 5

Goslinc,

please refer the below sample document.

https://workspaces.acrobat.com/?d=Xp7gmmvgWFsX6oL0G6c0mg

And what is the input are you giving."NO" or"No" or "no"?

Based on that u need to change the script.

goslinc
Level 2
Level 2

Sorry I thought I did attach it, wondering if its not getting through to you.

goslinc
Level 2
Level 2

Just wondering if you received my email with the form attached?

Thank you

Vjay_Reddy
Level 5
Level 5

Goslinc,

I didnt know that you are using DropDowns for the "QSFiling" and "LateFeePd".

Can you go to binding tab of "QSFiling" and "LateFeePd" fields and uncheck "Specify Item Values:" check box and try.

QSFiling > Object > Binding .... "Specify Item Values" . Do this for both dropdowns it will work.

If it doesnt work let me know vl share the file.

Thanks

Vjay