QlikView具有挑战性的匹配逻辑

时间:2015-11-05 19:31:05

标签: sql join concatenation match qlikview

我需要一些QlikView逻辑方面的帮助,这对我来说至关重要。我们有2个表加载到QlikView服务器上。

TableA和TableB。

TableA有列'AValue1'和'AValue2'。

TableB有'BValue1','BValue2','BValue3'和'BValue4','BValue5'。

逻辑就像那样(从vb脚本翻译)

对于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在其所有不同的列中都有许多空白值*

如何在Qlikview中构建上述内容?

1 个答案:

答案 0 :(得分:0)

尝试多个IF语句和Wildmatch的组合。

IF((BValue1 <= AValue1 and AValue1 <= BValue3) and (BValue2 <= AValue2 and AValue2 <= BValue4), BValue5, 
  IF(Wildmatch(AValue1 , TableB.BValue1), 
    IF((BValue2 <=AValue2 and AValue2 <= BValue4), BValue5, 
      IF(Wildmatch(AValue2 , TableB.BValue2), 
        IF((BValue1 <=AValue1 and AValue1 <= BValue3), BValue5,'blank')))))