Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

Can I define field as Dual without using LOAD Inline

Hello,

I want to use the Dual function on a field in a LOAD statement that reads from a table. However, all the examples I'm finding about Dual only show it being used with LOAD INLINE statements. Is it possible to do what I want? If so, could someone please give me the syntax?

Let's use the below as a starting example. I read in a QVD containing 3 fields and want to create a 4th field that will have a 1 if an app is considered critical and 0 if it's not. However, when I create a listbox for that field, I want to display 'Yes' for the 1 and 'No' for the 0. Seems like a perfect use case for the Dual. Here's my code:

APPS:

LOAD AppID,

AppName,

Priority,

IF(Priority < 3, 1, 0) as isCritical

FROM [APPS.QVD] (qvd);

I couldn't figure out how to use the Dual function on the 'isCritical' field so I thought I'd create another table using LOAD INLINE like this:

DualVals:

Load dual(isCriticalText,isCriticalNum) as isCritical

Inline

[isCriticalText,isCriticalNum

Yes, 1

No, 0];

As expected, the DualVals table is linked to the APPS table with the isCritical field. However, if I create a listbox for that field it still shows 0 and 1. I thought the isCriticalText would show up in the list of possible fields when creating a new listbox so I could use it, but it doesn't.

I'm stuck. Any help would be appreciated.

1 Solution

Accepted Solutions
Highlighted
Partner
Partner

Re: Can I define field as Dual without using LOAD Inline

You can use the dual function anywhere e.g.

APPS:

LOAD AppID,

AppName,

Priority,

Dual(IF(Priority < 3, 'Yes', 'No'),IF(Priority < 3, 1, 0)) as isCritical

FROM [APPS.QVD] (qvd);

View solution in original post

3 Replies
Highlighted

Re: Can I define field as Dual without using LOAD Inline

You can use Dual whether you are loading from a table, database or inline.

You can also use Dual within expressions, though it is most commonly used in the load script.

Dual is just another Qlik function.

See this post by robert_mika‌      How to use- Dual()

Highlighted
Partner
Partner

Re: Can I define field as Dual without using LOAD Inline

You can use the dual function anywhere e.g.

APPS:

LOAD AppID,

AppName,

Priority,

Dual(IF(Priority < 3, 'Yes', 'No'),IF(Priority < 3, 1, 0)) as isCritical

FROM [APPS.QVD] (qvd);

View solution in original post

Highlighted
Not applicable

Re: Can I define field as Dual without using LOAD Inline

Thanks for the quick replies guys. I'm all set now thanks to you.