Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Lianamelissa
Contributor II
Contributor II

QlikView challenging match logic

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.
  • Table2 has many blank values in all its different columns *

How the above can be built in QlikView?

 

Thanks in advance.

Labels (1)
3 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

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...
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Shubham_Deshmukh
Specialist
Specialist

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,

https://community.qlik.com/t5/QlikView-App-Development/How-to-write-different-formulae-for-each-cell...

jaibau1993
Partner - Creator III
Partner - Creator III

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.