Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Adding a Field and grouping data on load

Hi All,

A Qlikview newbie here who is a novice with SQL.  I am loading data from an ODBC connection (Access database) and I want to create an extra field which flags the data as one of two values.  Here is the script I have used;

SQL SELECT `campaign_name`,

    EMAIL2,

    emailID,

    `event_name`,

    `project_name`,

    `time_stamp`,

    `workspace_name`

FROM USAGE;

LOAD

if(workspace_name = 'abc','VALUEA',

if(workspace_name = 'def','VALUEA',VALUEB) as email_type_final;

SQL Select *

FROM USAGE;

The new field has been created but all records have been flagged with both VALUEA and VALUEB when only 100 of the records with the value 'abc' or 'def' shoudl be flagged VALUEA.  Where have I gone wrong here?

Many Thanks

1 Reply
sivarajs
Specialist II
Specialist II

May you can try this

Load if(wildmatch(workspace_name,'abc','def'),'VALUEA','VALUEB') as email_type_final;

SQL Select *

FROM USAGE;