Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Emma
Contributor II
Contributor II

Adding a column in Script

Hi all,

My query is pretty straight forward, I have the following table as input and would like to add a colum in the script while loading data in Qlikview.

(Picture of data below) Please note that the input data cannot be changed at the source.

INPUT DATA:

Capture.JPG

My goal is to add a column in the script that will rewrite the same description IF the Count =0 for every unique ID.

The data should look like this:

Capture3.JPG

The nulls in New_Column can be replaced by something else like a number as long as it's different from the Description value.

Thank you.

3 Replies
arpitkharkia
Creator III
Creator III

Add the following column

if(count=0,Description)  as  New_column

 

Emma
Contributor II
Contributor II
Author

Hi Arpitkharkia

Thanks for the reply. Apologies I forgot to mention a critical detail. Some of the data looks like the following:

Capture1.JPG

Your approach will make it look like this:

Capture.JPG

Instead of the desired result, which is this:

Capture3.JPG

If there is a method to replace all the "Count" that have 0 with the first "Description" that has a count=0, that would solve the issue.

Many thanks

arpitkharkia
Creator III
Creator III

im not sure how all of the data looks like and how new data will look in the future, but what i can think of now is to create a mapping file with three columns, description, count and new column.

You manually add the details of the new column accordingly and left join it to the main table.

I hope this makes sense Emma, else please let us know.

Regards,

Arpit