【问题标题】:QlikView challenging match logicQlikView 具有挑战性的匹配逻辑
【发布时间】:2016-02-06 19:08:43
【问题描述】:

我需要一些关于 QlikView 逻辑的帮助,该逻辑迄今为止一直在挑战我。我们在 QlikView 服务器上加载了 2 个表格。

表 A 和表 B。

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 中构建以上内容?

【问题讨论】:

  • 您可以在 QlikView 中编写 SQL。在 SQL 中使用 JOINCASE 语句。在执行 SQL 语句的LOAD 时,您也可以使用IF。如果您向我们展示 TableA 和 TableB 中包含一些数据的结构以及预期的结果,那么有人可能会帮助您。此外,QlikView 社区可能是询问 QlikView 特定答案的好地方。

标签: sql join concatenation match qlikview


【解决方案1】:

尝试多个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')))))

【讨论】:

    最近更新 更多