Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
kunkumnaveen
Specialist
Specialist

How to create a Column at scripting

Hello All,

I am Trying something like below ,it is Possible to create a column with values CV,PV,ALL.

if(segment='COMMERCIAL','CV',
if(segment='PERSONAL','PV',
if(segment='COMMERCIAL' and segment='PERSONAL','ALL')

)) as SEGMENT

 

I know if we select both CV and PV which is nothing but ALL, ..but User specifically  need  CV,PV,ALL 

 

 

Thanks

1 Solution

Accepted Solutions
agigliotti
Partner - Champion
Partner - Champion

You could do this:

...
if( segment='COMMERCIAL', 'CV',
if( segment='PERSONAL', 'PV'
)) as SEGMENT;
...

New_Table:
LOAD * INLINE [
NEW_FIELD, SEGMENT
PV, PV
CV, CV
ALL, PV
ALL, CV
];

and use NEW_FIELD as your filter in UI.

View solution in original post

5 Replies
agigliotti
Partner - Champion
Partner - Champion

i think your expression below doesn't makes sense.

if(segment='COMMERCIAL' and segment='PERSONAL','ALL')

what does it means?

what are you trying to achieve?

kunkumnaveen
Specialist
Specialist
Author

In a sample way, I have a Column Segment which has values COMMERCIAL,PERSONAL   

Now what i am trying to create a derived column with name SEGMENT which should suppose to have  CV,PV,ALL values

Which means

COMMERCIAL => 'CV',

PERSONAL  => 'PV'.

COMMERCIAL+PERSONAL=>ALL

How to achieve this requirement  

kunkumnaveen
Specialist
Specialist
Author

Hi All,

Is my above requirement is feasible or Not 

agigliotti
Partner - Champion
Partner - Champion

You could do this:

...
if( segment='COMMERCIAL', 'CV',
if( segment='PERSONAL', 'PV'
)) as SEGMENT;
...

New_Table:
LOAD * INLINE [
NEW_FIELD, SEGMENT
PV, PV
CV, CV
ALL, PV
ALL, CV
];

and use NEW_FIELD as your filter in UI.

kunkumnaveen
Specialist
Specialist
Author

Hi,

Its worked , thanks for your suggestion.....