Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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

Tags (3)
1 Reply
sivarajs
Valued Contributor II

Re: Adding a Field and grouping data on load

May you can try this

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

SQL Select *

FROM USAGE;

Community Browser