Newbie Question - Multiple Instances of OR

bnkjamesbnkjames Member Posts: 6
Creating a Processing Report.
Need to have an IF statement accept Multiple Instances of OR using the <> syntax.


IF Field <> FORMAT ('Variable 1') & FORMAT ('Variable 2') and so on
THEN BEGIN

Not sure which syntax (If any) will work.

Comments

  • DenSterDenSter Member Posts: 8,305
    IF (Field <> Variable1) OR
       (Field <> Variable2) OR 
       (Field <> Variable3) THEN
    BEGIN
    
    You can also do:
    IF NOT (Field IN [Variable1,Variable2,Variable3]) THEN BEGIN
    
    You only need FORMAT if you need to convert to text.
  • krikikriki Member, Moderator Posts: 9,110
    IF (Field <> Variable1) OR
       (Field <> Variable2) OR
       (Field <> Variable3) THEN
    BEGIN
    
    This IF will ALWAYS be true EXCEPT WHEN variable1=variable2=variable3.

    Probably it should be
    IF (Field <> Variable1) AND
       (Field <> Variable2) AND
       (Field <> Variable3) THEN
    BEGIN
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • DenSterDenSter Member Posts: 8,305
    He was asking about syntax though, I doubt that those are the actual variables that he's using. But you're right, using AND instead of OR is more likely what he needs.
  • bnkjamesbnkjames Member Posts: 6
    Thanks to everyone for the information, I'll be trying these out today!
Sign In or Register to comment.