Jump to content
  • 0
Sign in to follow this  
Carlson

Calculated Field & If Statement Error

Question

Hello,

 

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?

 

 

<script>
 
 
 if(parseFloat('[@field:BIRP_Report_Data_Exception_Flag]') == 1 && ((parseFloat('[@calcfield:2]')) != 0.00)) {
document.write('');
}
 
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('');}
 
 
 
</script>
 
 
 
Here is the (@calcfield:2):
 
(IsNull([@field:Sell1],0)+IsNull([@field:Sell2],0)+IsNull([@field:Sell3],0)+IsNull([@field:Sell4],0)+IsNull([@field:Sell5],0)+IsNull([@field:Sell6],0)+IsNull([@field:Sell7],0)+IsNull([@field:Sell8],0)+IsNull([@field:Sell9],0)+IsNull([@field:Sell10],0)+IsNull([@field:Sell11],0)+IsNull([@field:Sell12],0)-IsNull([@field:BIRP_Report_Data_Dallas__Sell],0))-(IsNull([@field:Sell1],0)+IsNull([@field:Sell2],0)+IsNull([@field:Sell3],0)+IsNull([@field:Sell4],0)+IsNull([@field:Sell5],0)+IsNull([@field:Sell6],0)+IsNull([@field:Sell7],0)+IsNull([@field:Sell8],0)+IsNull([@field:Sell9],0)+IsNull([@field:Sell10],0)+IsNull([@field:Sell11],0)+IsNull([@field:Sell12],0)-IsNull([@field:BIRP_Report_Data_Dallas__Sell],0))-(IsNull([@field:Sell1],0)+IsNull([@field:Sell2],0)+IsNull([@field:Sell3],0)+IsNull([@field:Sell4],0)+IsNull([@field:Sell5],0)+IsNull([@field:Sell6],0)+IsNull([@field:Sell7],0)+IsNull([@field:Sell8],0)+IsNull([@field:Sell9],0)+IsNull([@field:Sell10],0)+IsNull([@field:Sell11],0)+IsNull([@field:Sell12],0)-IsNull([@field:BIRP_Report_Data_Dallas__Sell],0))

Share this post


Link to post
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.

Share this post


Link to post
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.

Guest
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.

Loading...
Sign in to follow this  

×
×
  • Create New...