Jump to content

And Comparison Rule


JeremyT

Recommended Posts

I am working on a merge where a chart picture is inserted that shows claims from 2012 and 2013.

 

If there are no claims I don't want the empty chart to show up.

 

Originally I wrote my rule so that if the 2012 and 2013 claims totals did not equal '$0.00 ' it would insert a picture. Unfortunately, it did not add charts that only had claims in 2012. So, if 2013 claims were $0.00 it did not add a picture.

 

Here is the rule that does not work:

 

if (Field("2012 Claims Total") != '$0.00 ' && Field("2013 Claims Total") != '$0.00 ')
return CreateResource("/Users/Desktop/Projects/Fee Mailing/Merge Links/Chart Samples/" + (Field("@ClaimsChart")));

I rewrote the rule so that if 2012 and 2013 claims totals equaled $0.00 it would return a null resource, else it would return the claim chart.

 

This rule works:

 

if  (Field("2012 Claims Total") == '$0.00 ' && Field("2013 Claims Total") == '$0.00 ') 
return NullResource()  

else return CreateResource("/Users//Desktop/Projects/Fee Mailing/Merge Links/Chart Samples/" + (Field("@ClaimsChart")))

What am I missing to get the first code to work correctly?

 

 

Thanks,

Jeremy

Link to comment
Share on other sites

I need it to not show the graph if both 2012 and 2013 claims are $0.00, so using OR || wouldn't work.

Right, but conversely, you need to show the graph if either 2012 OR 2013 claims are NOT zero. Think about it: If the either order is not zero, then both can't be zero. The use of the != (not equal) operator changes things.

 

More generally, with Boolean logic, the converse of "if A and B" is "if not A OR not B", not "if not A and not B".

 

So Thomas is correct. Try it and see.

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.

Guest
Reply to this topic...

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