Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

usage of bitor for logic OR ?

I would like to compute data for a variable according to the following instruction :

let GradientNormalisé = if (if(bitor(s_GradientBrut>30,Pdev>0.01)),1,0),30,d_Gradient;

It doesn't work at all : syntax error.

Maybe I should use another instruction ... could you please help ?

What I would like to have is :

     GradientNormalisé variable set to 30 if GradientBrut >30 and Pdev>0.01

     GradientNormalisé variable set to 30 if GradientBrut <=30 and Pdev<=0.01

   GradientNormalisé variable set to d_Gradient if GradientBrut <=30 and Pdev>0.01

   GradientNormalisé variable set to d_Gradient if GradientBrut >30 and Pdev<=0.01

3 Replies
JonnyPoole
Employee
Employee

If(  (GradientBrut >30 and Pdev>0.01) or (GradientBrut <=30 and Pdev<=0.01) , 30,

     if(

(GradientBrut <=30 and Pdev>0.01) or ( GradientBrut >30 and Pdev<=0.01)  , d_Gradient

)

)

MarcoWedel

Hi Cedric,

maybe you're looking for the boolean xor-operator:

If(GradientBrut>30 xor Pdev>0.01,  d_Gradient, 30)

QlikCommunity_Thread_128825_Pic1.png

QlikCommunity_Thread_128825_Pic2.png

LOAD

  *,

  If(GradientBrut>30 xor Pdev>0.01, d_Gradient, 30) as [GradientNormalisé];

LOAD

  Round(Rand()/10, 0.0001) as Pdev,

  RecNo() as GradientBrut,

  Ceil(Rand()*100) as d_Gradient

AutoGenerate 100;

hope this helps

regards

Marco

MarcoWedel

Please close this thread if there are no further questions.

thanks

regards

Marco