Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Boolean - different behaviour in QVW and QVD load script?

Hi,

I have a rather strange problem with the folowing script code:

LOAD *, If(WildMatch(...) > 0, True(), False()) AS is_spare_part RESIDENT tmp_Item;

When I use this code in a QVD, the field is_spare_part contains a boolean value (I assume of type dual) which gets displayed as True/False in the GUI and as 0/-1 when using Num(is_spare_part). The same script - when implemented in a QVW - creates a field that does contain the correct values 0 and -1 but the values would not be displayes as True/False in the GUI. Somehow, the field does not get recognized as a boolean.

It looks as if QV (QV11 SR2) treats booleans differently in QVD and QVW scripts. Or am I missing something? I just like to understand what is going on here. Your input / feedback is really appreciated.

Kind regards,

Thomas

1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

Yes, you are right that there are glitches in the formatting of boolean values. Sometimes the formatting as True or False fails. I haven't investigated it more thouroughly so I cannot give you the details.

However, it just concerns the formatting - not the evaluation. In fact, any non-zero number is interpreted as True in logical expressions. And zero is interpreted as False. So you really don't need the "If(WildMatch(...) > 0, True(), False())". You can use "WildMatch(...)" directly as boolean.

HIC

View solution in original post

2 Replies
hic
Former Employee
Former Employee

Yes, you are right that there are glitches in the formatting of boolean values. Sometimes the formatting as True or False fails. I haven't investigated it more thouroughly so I cannot give you the details.

However, it just concerns the formatting - not the evaluation. In fact, any non-zero number is interpreted as True in logical expressions. And zero is interpreted as False. So you really don't need the "If(WildMatch(...) > 0, True(), False())". You can use "WildMatch(...)" directly as boolean.

HIC

Not applicable
Author

Hello Henric,

Thanks very much for your feedback and for your tip to use the WildMatch directly. I was not aware of this option. This simplifies the expression somewhat.

Kind regards,

Thomas