2 Replies Latest reply: Jul 15, 2012 3:28 PM by Gerrit Zanen RSS

    Newbie if question

      Hi,

       

      As part of a script I have the following lines:

       

          "Location Code",

          IF ("Location Code" = 'RED' or "Location Code" ='BLUE', 'COLORED', "Location Code" ) As Location,

       

      The above statements are OK and work fine.

      But what if I had a number of colors, do I all need to write them out with the 'or' statement or is there a more simple way to achieve this?

       

      Gerrit

        • Re: Newbie if question
          Deepak Kurup

          HI Gerrit,

           

           

          you can also use mixmatch. below is the code

           

          if(MixMatch([Location Code],'RED','BLUE')>0,COLORED,[LOCATION CODE]) as Location,

           

           

           

           

          Deepak

            • Re: Newbie if question

              Deepak,

               

              Thanks for your helpful reply. After your reply and with the help of the reference manual I figured out that in my script 'wildmatch' probably is the shortest way.

               

              See 1. original script, 2. script as you suggested and 3. final solution.

               

              1. IF ("Location Code" = 'COR-RETOUR' or "Location Code" ='COR AANTAL', 'HEDEL', "Location Code" ) As Vestiging,

               

              2. if(MixMatch([Location Code],'COR-RETOUR','COR AANTAL')>0,'HEDEL',[Location Code]) as Vestiging, 

               

              3. if(wildmatch([Location Code],'COR*')>0,'HEDEL',[Location Code]) as Vestiging, 

               

              Again thanks for your help.

               

              Regards,

               

              Gerrit