Jump to content
  • 0

Calculated Field & If Statement Error





I have the following script on a datapage but I am receiving inaccurate results. I have a calculated field (@calcfield:2) which sums up multiple numerical fields, and when that sum is not equal 0.00 it i supposed to display the document.write html "Create Exception" link below.  The results work for the most part however very few entries will still display the document.write html "Create Exception" link  below even when the (@calcfield:2) is 0. Any suggestions on how I can correct this? I have also included the (@calcfield:2) calculation below, as I am not sure if I need to modify the script below or the calculated field?



 if(parseFloat('[@field:BIRP_Report_Data_Exception_Flag]') == 1 && ((parseFloat('[@calcfield:2]')) != 0.00)) {
else if((parseFloat('[@calcfield:2]')) != 0 && parseFloat('[@field:BIRP_Report_Data_Exception_Flag]') != 1 ) {
document.write('<a href="https://b5.caspio.com/dp.asp?AppKey=360a300050b1c7a656c0401aaa03&RecordNumber=[@field:BIRP_Report_Data_RecordNumber]&Recon_Amount=[@calcfield:1]&Unmatched_Balance=[@calcfield:2]">Create Exception</a>');
} else {document.write('');}
Here is the (@calcfield:2):
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hello ccarls3,


Have you check your Formula with only one condition, without "parseFloat('[@field:BIRP_Report_Data_Exception_Flag]') == 1"?


Is it the "BIRP_Report_Data_Exception_Flag" checkbox Form element?


And it seems there are some problems with brackets in conditions.

Maybe, the following conditions will be a bit more correct:


if((parseFloat('[@field:BIRP_Report_Data_Exception_Flag]') == 1) && (parseFloat('[@calcfield:2]') != 0.00))


else if((parseFloat('[@calcfield:2]') != 0) && (parseFloat('[@field:BIRP_Report_Data_Exception_Flag]') != 1))


I hope, it helps.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...