脚本无法在 Qlik Sense 中使用 STARTS WITH 函数

Script not working with STARTS WITH function in Qlik Sense

我正在尝试使用脚本加载一些表,以便根据 IF 条件创建新表。

我的脚本如下:

LOAD Pippo
if(color = 'green', 'ok',
if(color = 'yellow' and text <> 'No control needed', 'check',
if(color = 'red' and text <> 'Control now', 'check', 'ok'))) as Pippo1

color = yellow 的行中,我想捕捉不同的情况,因为有很多文本以 'No control needed'[= 开头26=](例如不需要控制(1 周),不需要控制(2 周)),我想 select 他们全部。

我尝试使用:text<>'No control needed'*,但没有用。

有什么建议吗?

Index()函数可以用在这种情况下。

Index() 将搜索 string-in-a-string,如果未找到,将 return 0 否则将 return 找到搜索到的字符串的位置。

在你的情况下,这可以表示为:

Index(text, 'No control needed') = 0

和完整的表达式:

LOAD 
Pippo,
if(color = 'green', 'ok',
if(color = 'yellow' and Index(text, 'No control needed') = 0, 'check',
if(color = 'red' and text <> 'Control now', 'check', 'ok'))) as Pippo1