Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I need some help with a QlikView logic which keeps challenging me so far. We have 2 tables loaded onto QlikView server.
TableA and TableB.
TableA has columns 'AValue1' and 'AValue2'.
TableB has 'BValue1', 'BValue2', 'BValue3' and 'BValue4', 'BValue5'.
The logic goes like that (translated from vb script)
For each line in TableA
i) if (BValue1 <= AValue1 <= BValue3) and (BValue2 <= AValue2 <= BValue4) then return 'BValue5' ii) if the first condition is not met, run the following: if AValue1 exists in TableB.BValue1, then check: if BValue2 <=AValue2<=BValue4, then return 'BValue5'iii) if the second condition is not met, run the following: if AValue2 exists in TableB.BValue2, then check: if BValue1 <= AValue1 <= BValue3 then, return 'BValue5'.iv) if nothing from the above is complete, then return blank.
How the above can be built in QlikView?
Thanks in advance.
I am not sure what you are trying to do here, but this is not valid Qlik syntax
if BValue1 <= AValue1 <= BValue3 then...
Perhaps you mean
if BValue1 <= AValue1 And AValue1 <= BValue3 then...
You can use nested if like this,
=If(conditionA ,
if(condition1,
Expression1,
If(condition2,
Expression2,
If(condition3,
Expression3,
))))
Also you can refer this thread, a bit different but might helpful,
Hi!
How does TableA relate with TableB? Condition i) says
if (BValue1 <= AValue1 <= BValue3) and (BValue2 <= AValue2 <= BValue4) then return 'BValue5'
but, given a value of the column AValue1 (i.e., given a row of TableA), which rows of BValue1, BValue2, BValue3 and BValue4 are to be compared with that AValue1?
Jaime.