Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikView forum consolidation is complete. Labels are now required. LEARN ABOUT LABELS
cancel
Showing results for 
Search instead for 
Did you mean: 
Jwarr1
Contributor
Contributor

Using load statement to populate new column in data set

Forgive me as I am a total newbie to Qlikview and to SQL data sets as a whole. 

Basically I have a dataset that includes tickets from many different sources. I want to categorize them by adding a new column to the data set during the data load and populate it based on criteria I have predefined. Written below is how I would write it in plain English to create a new column labeled "Ticket Type" and write a value into it based on where/if match from an existing column in the dataset, however I do not know how this would translate to qlikview language. 

 

From what I have read this would be accomplished by a load inline command, just not sure how the syntax would translate. 

 

where modified_by_department = 'DeptA' and Source_System = 'SourceA' write "PLANNED WORK" in column "TICKET TYPE"

where ticket_type = 'TickettypeA' write "SYSTEM ALERT" in column "TICKET TYPE"

where workgroup = 'WorkgroupA' write "USER REQUEST" in column "TICKET TYPE"

where workgroup = 'WorkgroupB' write "TROUBLE TICKET" in column "TICKET TYPE"

 

Any help is appreciated, thanks in advance!

Labels (1)
1 Solution

Accepted Solutions
Jwarr1
Contributor
Contributor

Thanks for the assistance, wanted to circle back that I eventually used a CASE statement as I was not able to get the if  statement syntax to work on my SQL query. Essentially looked like this with specifics changed:

 

CASE
WHEN
MODIFIED_BY_DEPT = 'DEPT A' AND WORKGROUP = 'WORKGROUP A'
THEN
'TICKETTYPEA'
WHEN
WORKGROUP = 'WORKGROUP B'
THEN
'TICKETTYPEB'
ELSE
'Null'
END AS TICKETTYPEMASTER,

View solution in original post

2 Replies
m_woolf
Master II
Master II

if(modified_by_department = 'DeptA' and Source_System = 'SourceA'.'PLANNED WORK'.
      if(ticket_type = 'TickettypeA','SYSTEM ALERT', 
          if( workgroup = 'WorkgroupA','USER REQUEST',
               if(workgroup = 'WorkgroupB','TROUBLE TICKET')))) as "TICKET TYPE",

Jwarr1
Contributor
Contributor

Thanks for the assistance, wanted to circle back that I eventually used a CASE statement as I was not able to get the if  statement syntax to work on my SQL query. Essentially looked like this with specifics changed:

 

CASE
WHEN
MODIFIED_BY_DEPT = 'DEPT A' AND WORKGROUP = 'WORKGROUP A'
THEN
'TICKETTYPEA'
WHEN
WORKGROUP = 'WORKGROUP B'
THEN
'TICKETTYPEB'
ELSE
'Null'
END AS TICKETTYPEMASTER,

View solution in original post