Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

'Dual' not working?please help

Hi,

I have below script in qvw. when I reload I can able to see in Flag column only START and GONE. Remaining are not loading into Flag column. Please can anyone suggest me is there any wrong in below script?

If (MixMatch(NAME,'XX',

'YY',

'ZZ',

'AA',

'BB',

'CC',

'DD',

'EE',

'FF',

'GG',

'HH',

'II',

'JJ',

'KK',

'LL',

'MM',

'NN',

'OO',

'PP',

'QQ,

'RR',

'SS',

'TT',

'UU',

'VV',

'WW'),Dual('START',1),

     If(MixMatch(NAME,'GONE'),Dual('GONE',2),

If(MixMatch(NAME,'QQ,

'RR',

'SS',

'TT',

'UU'),Dual('APP',3)

     If(MixMatch(NAME,'XX',

'YY',

'ZZ',

'AA',

'BB',

'CC',

'DD',

'EE',

'FF',

'GG',

'HH',

'II',

'JJ',

'KK',

'LL',

'MM',

'NN',

'OO',

'PP',

'VV',

'WW'),Dual('PROCESS',4),

     If(MixMatch(NAME,

'YY',

'ZZ',

'AA',

'BB',

'CC',

'DD',

'EE',

'FF',

'GG',

'HH',

'II',

'JJ',

'KK',

'LL',

'MM',

'NN',

'OO',

'PP',

'QQ),Dual('CON',5))))))                         as Flag

Thanks.

43 Replies
swuehl
MVP
MVP

As Sunindia said, OriginalTable should be the one without the Flag field you want to create, also without your original attempt to create the field.

sunny_talwar

Or call the new field to be NewFlag instead of Flag

Not applicable
Author

Thanks. I have used this. when I am reloading it is showing still reloading more than 20 minutes. is that because of

concatenate?

sunny_talwar

Did you drop your Original table or not? If you have not then its creating a synthetic key which could take hours depending on the amount of data. I suggest to stop the script and add Drop Table OriginalTable and re run.

HTH

Best,

Sunny

Not applicable
Author

. Thanks. I did that. now it reload fine. sorry I need one more column as SUCCESS which shows START+GONE

how can I do this? is there any way to do this with Dual? or do I need to use any thing more? Please let me know.

sunny_talwar

Not sure I understand your requirement. What do you mean when you say START + GONE = SUCCESS? you mean that any of those which fall into these two are also SUCCESS?

If the above statement is true try this:

Table

LOAD *,

          Dual('START',1) as FlagNew

Resident ....

Where MixMatch(NAME,'XX','YY','ZZ','AA','BB','CC','DD','EE','FF','GG','HH','II','JJ','KK','LL','MM','NN','OO','PP','QQ,'RR','SS','TT','UU','VV','WW');

Concatenate (Table)

LOAD *,

          Dual('GONE',2) as FlagNew

Resident ....

Where MixMatch(NAME,'GONE');

Concatenate (Table)

LOAD *,

          Dual('APP',3) as FlagNew

Resident ....

Where MixMatch(NAME,'QQ,'RR','SS','TT','UU');

Concatenate (Table)

LOAD *,

          Dual('PROCESS',4) as FlagNew

Resident ....

Where MixMatch(NAME,'XX','YY','ZZ','AA','BB','CC','DD','EE','FF','GG','HH','II','JJ','KK','LL','MM','NN','OO','PP','VV','WW');

Concatenate (Table)

LOAD *,

          Dual('CON',5) as FlagNew

Resident ....

Where MixMatch(NAME,'YY','ZZ','AA','BB','CC','DD','EE','FF','GG','HH','II','JJ','KK','LL','MM','NN','OO','PP','QQ);


Concatenate (Table)

LOAD *,

          Dual('SUCCESS',6) as FlagNew

Resident ....

Where MixMatch(NAME,'XX','YY','ZZ','AA','BB','CC','DD','EE','FF','GG','HH','II','JJ','KK','LL','MM','NN','OO','PP','QQ,'RR','SS','TT','UU','VV','WW', 'GONE');

Not applicable
Author

That's perfect. Thanks. will this work for division?

if I want to show another column as percentage how to do this?

START/GONE

please let me know. sorry for asking more.

EDIT: also please suggest me how to do this. I want to calculate the flag value CON as below

CON+0.5*'XX'

how to do this?

sunny_talwar

That you should be able to do in the front end, right?

=Count({<NewFlag = {'START'}>} NewFlag)/Count{<NewFlag = {'GONE'}>} NewFlag)

Not applicable
Author

when I am using in front end as expression it is showing 0%

sunny_talwar

Did you name your Flag as Flag or NewFlag? Whatever name you choose, you will need to use that name in this expression: =Count({<NewFlag = {'START'}>} NewFlag)/Count{<NewFlag = {'GONE'}>} NewFlag)