Normal Topic Need help with logic (Read 643 times)
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Need help with logic
Dec 4th, 2007 at 1:03pm
Print Post Print Post  
I have an element, Discount_Label, which is usually but not always filled with the string "CUSTOMER DISCOUNT".

I have a report in which I need to test the value of this element before printing it.  If it contains any value other than "CUSTOMER DISCOUNT", I want to print it, otherwise I do not.

I have tried:
Code
Select All
IF NOT @IsBlank(Discount_Label) AND NOT Discount_Label = "customer discount"
IF NOT (@IsBlank(Discount_Label) AND Discount_Label = "customer discount")
IF NOT @IsBlank(Discount_Label) AND NOT @Left(Discount_Label, 17) = "customer discount" 


but I haven't succeeded yet.  Any help would be most appreciated.
  

**
Captain Infinity
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Need help with logic
Reply #1 - Dec 4th, 2007 at 1:37pm
Print Post Print Post  
Wrapping all of your expressions in parenthesis consistently in the order in which you would like them to operate, would help a lot.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Need help with logic
Reply #2 - Dec 4th, 2007 at 1:50pm
Print Post Print Post  
Code
Select All
If ((@IsBlank(Discount_Label) = FALSE) And (Discount_Label <> "customer discount")) 



-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Need help with logic
Reply #3 - Dec 4th, 2007 at 2:17pm
Print Post Print Post  
Thanks guys, it works great!  You're right, Mark, my biggest problem is knowing where to put the parentheses.  (NOTs always mess me up.)
  

**
Captain Infinity
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Need help with logic
Reply #4 - Dec 4th, 2007 at 6:26pm
Print Post Print Post  
Infinity wrote on Dec 4th, 2007 at 2:17pm:
NOTs always mess me up.


If you don't like 'em, don't use 'em. They are almost never necessary. Notice how Ray's example checks for not equal rather than getting the result and "notting" (reversing) it.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Need help with logic
Reply #5 - Dec 4th, 2007 at 6:37pm
Print Post Print Post  
Yes, I've made a note of it and have changed some of my code already.  I like the True/False check for @IsBlank.   I never thought to use "<>" when dealing with a string; it's stuck in my head as a mathematical operation.  See, I knew I should have paid less attention in High School algebra class, nothing good has come of it.  That's what comic books were made for.

Thanks again for your help.
  

**
Captain Infinity
Back to top
IP Logged