Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
QlikSensor
Partner - Creator
Partner - Creator

Create new data column conditionally to other columns

Hi,

I have a column in my table which contains only ones and zeros. I need a new column (or the other column replaced) that a certain string is written.

 

For example, I have following data:

Error

0

1

1

0

 

And I need in QlikSense:

Part state

Part is ok

Part is not ok

Part is not ok

Part is ok

 

Is there something I can do during loading the data?

2 Solutions

Accepted Solutions
mahaveerbiraj
Creator II
Creator II

Hi ,

you can try this in load script.

pick(match(Error,0,1),'Part is ok','Part is not ok')  as  [Part state]

Thanks 

Mahaveer 

View solution in original post

mahaveerbiraj
Creator II
Creator II

hi ,

use something like this  in load script ,

if([Error code]=0 or  [Error code]=1 ,'no','yes')  as  [Error Code Accepted]

View solution in original post

4 Replies
mahaveerbiraj
Creator II
Creator II

Hi ,

you can try this in load script.

pick(match(Error,0,1),'Part is ok','Part is not ok')  as  [Part state]

Thanks 

Mahaveer 

erp_curaden
Contributor II
Contributor II

Try the following (I hope I understood you correctly:

 

Example table:

Tablename: ERROR:

TableColumn: Error:

1

0

1

0

0

 

 

ErrorStateTable:

Load

ERROR.Error as "ErrorID"

From ERROR;

Left Join

Load * Inline [

'ErrorID', 'ErrorDescription'

0, 'Part is ok'

1, 'Part is not ok'

]

QlikSensor
Partner - Creator
Partner - Creator
Author

Wow, works great. Thanks for sharing. Just another question: Can I extend the conditional part of the match statement?

I have a column which can have other values as well. E. g. 

Error code

0

1

2

3

I want to accept all error codes except 0 and 1 (note that this is a simple example, actually I have a string and not a number). This should result in:

Error Code Accepted

no

no

yes

yes

so something like this:

pick(match(Error,0|1),'no','yes')  as  [Error Code Acceted]

mahaveerbiraj
Creator II
Creator II

hi ,

use something like this  in load script ,

if([Error code]=0 or  [Error code]=1 ,'no','yes')  as  [Error Code Accepted]