5 Replies Latest reply: Jul 8, 2013 7:29 PM by Bradley Coyne RSS

    Three If statements to form a flag

    Bradley Coyne

      Hi.

       

      i am hoping to acheive the following.

       

      i have three IF statements in my script,  instead of three seperate flags i would like to have only one flag.

       

      if(Tillsvallskod = 4, '1','0') as #FL2,

      if (ArtKod <> 'z' or ArtKod = 'z' and SenRoresleDatum > today () - 365, 1,0) as #FL1,

      if(ArtKod <> 'a' ,'1', '0') as #FL3,

       

      i have tried using OR after each IF however it seems to throw a syntax on the brackets.

       

      if(Tillsvallskod = 4 or Tillsvallskod =6 OR

      if (ArtKod <> 'z' or ArtKod = 'z' and SenRoresleDatum > today () - 365 OR

      if(ArtKod <> 'a' ,1,0))) as #Flag

       

      Any help on the following.

       

      i have also attached the qvw .

       

      Best,

      Bradley

        • Re: Three If statements to form a flag
          Gysbert Wassenaar

          Is this what you're looking for?

           

          if(Tillsvallskod = 4

            or Tillsvallskod =6

            or ArtKod <> 'z'

            or (ArtKod = 'z' and SenRoresleDatum > today () - 365)

            or ArtKod <> 'a',1,0

            ) as #FL0,

            • Re: Three If statements to form a flag
              Bradley Coyne

              Hi Gysbert!

               

              thanks but that solution is not exactly what i am looking for.

               

              i should of stated more clearly perhaps  here is the logic

               

              if statement 1.  Create a Flag where Tillsvallkod = 4, or 6 , (the rest should be discluded i.e 3)

              if statement 2. Artkod z should appear in the list however if Artkod z has not moved in the last year then it should be discluded.

              if statement 3. Artkod = 'a' should be discluded totaltly.

               

              these flags in essence should be 111 as i had in my example , however i dont want to confuse the user by flags laying out in the front end tablebox,.

               

              ultimately bringing everything down to one flag will be better  i assume?