Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
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

On first glance, seems like you tested these values already before, so there is no execution path that leads to these Flag values.

Not applicable
Author

yep. is there any thing do I need to add to load all values?

sunny_talwar

That is because your first and second if statements are covering all the things for anything after that. You cannot assign two flags to one value at the same time in one column.

For example YY cannot be START as well as PROCESS at the same time in one column for one row.

Does that make sense?

sunny_talwar

May be you can do something like this:

Table

LOAD *,

          Dual('START',1) as Flag

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 Flag

Resident ....

Where MixMatch(NAME,'GONE');

Concatenate (Table)

LOAD *,

          Dual('APP',3) as Flag

Resident ....

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

Concatenate (Table)

LOAD *,

          Dual('PROCESS',4) as Flag

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 Flag

Resident ....

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

Not applicable
Author

yes make sense. is there any way we can get two flags?  I need all 5 columns as below

START

GONE

APP

PROCESS

CON

Not applicable
Author

Thanks. I used and when I am reloading it is showing field names must be unique within the table

do I need to change anything?

sunny_talwar

Make sure the older table from where you are picking the data doesn't have a field called Flag. If it does you can rename the new Flag to may be FlagNew


Table

LOAD *,

          Dual('START',1) as FlagNew

Resident ....

WhereMixMatch(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);

I hope this will resolve your issue.

Best,

Sunny

swuehl
MVP
MVP

If your original table is called OriginalTable, load a NewTable like

NewTable:

LOAD *,

          Dual('START',1) as Flag

Resident OriginalTable

WhereMixMatch(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 (NewTable)

LOAD *,

          Dual('GONE',2) as Flag

Resident OriginalTable

Where MixMatch(NAME,'GONE');


...

//Continue loading the different flag values


DROP TABLE OriginalTable;

Not applicable
Author

yes. I did the same. but showing error.