Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
if((Tillsvallskod = 4 or Tillsvallskod =6)
and (ArtKod <> 'z' or (ArtKod = 'z' and SenRoresleDatum > today () - 365))
and ArtKod <> 'a',1,0
) as #FL0,
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,
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?
It seems like you are interested in the records where all Flags are set to 1, not any of them.
So you need AND operator here.
Main:
LOAD *,
if(#FL1 and #FL2 and #FL3,1,0) as #FLAll;
LOAD ArtNr,
//if(isNull(Artkod, 'N', ArtKod) as Artkod
SenRoresleDatum,
Tillsvallskod,
LeveransDatum,
if (isnull(ArtKod), 'N',ArtKod) as ArtKod,
if(Tillsvallskod = 4 or Tillsvallskod =6, '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,
Lager
FROM
(ooxml, embedded labels, table is Sheet1);
if((Tillsvallskod = 4 or Tillsvallskod =6)
and (ArtKod <> 'z' or (ArtKod = 'z' and SenRoresleDatum > today () - 365))
and ArtKod <> 'a',1,0
) as #FL0,
Thanks Guys!
i tried to award fairly with points - both solutions work wonderfully.
Best,
Brad