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: 
john_henry
Contributor III
Contributor III

How to create a derived column in load script editor based on multiple columns

I'm trying to create a new column "report_type" by referencing 3 different columns.  I tried using the wildmatch function, but did not work (see script below).

Each of the columns I'm referencing (kpi, aib, cancellation) have values of either 0 or 1 (binary).


Load
Text(kpi) as kpi,
Text(aib) as aib,
Text(cancellation) as cancellation,
if(WildMatch(kpi,'1'), 'KPIs',
if(WildMatch(aib,'1'), 'AIB',
if(WildMatch(cancellation,'1'), 'Cancellations'))) as report_type,

2 Replies
shanemichelon
Partner - Creator II
Partner - Creator II

I don't think you need the wildmatch.  Check the value of the fields as Qlik sees them, but generally binary fields will show as 0, 1  or possibly -1.  Then just do the direct comparison.  Also, I like to indent my nested 'ifs' to make it easier to follow:

if(kpi,='1',
   'KPIs',
   if(aib='1',
      'AIB',

      if(cancellation='1',
         'Cancellations',
         'Other'
         )
      )
   ) as report_type,

 

john_henry
Contributor III
Contributor III
Author

I figured out my logic would not work as there could be more than 1 columns with a value of 1.  Thanks for the help anyway!