Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Gump123
Contributor
Contributor

Collumn name to ID rows

Need help. I do have script 

Load

("PAX ") as "B Passengers ",
("Pax Breackdown") as " Passengers Tran",
("Transfer Revenue ") as "Transfer Revenue",

Now i want to create one additional collumn name ID  which has following value if 

PAX   assign ID  1 

Pax Breackdown  assign ID 2

Transfer Revenue assign ID 3

Basically Assign ID no 

Labels (2)
4 Replies
G3S
Creator III
Creator III

are you able to provide a mockup of expected result?

Gump123
Contributor
Contributor
Author

ColumnID should have  1 2 or 3 value. Based on the following column 

("PAX ") as "B Passengers ",
("Pax Breackdown") as " Passengers Tran",
("Transfer Revenue ") as "Transfer Revenue",

G3S
Creator III
Creator III

hope I've understood your requirement correctly. add the below to your load:
1 as B Passengers_ID,

2 as "PassengersTran_ID",

3 as "TransferRevenur_ID"

this will add three new fields with fixed values 1, 2 and 3. 

G3S_0-1687233323521.png

to have it in one field, use 'crosstable' function so it looks like this:

G3S_1-1687233606957.png

 

sidhiq91
Specialist II
Specialist II

@Gump123  Please see the Script below:

NoConcatenate
Temp:
Load RowNo() as Row_Number,
PAX as "B Passengers ",
Pax_Breackdown as "Passengers Tran",
Transfer_Revenue as "Transfer Revenue"

Inline [
PAX ,Pax_Breackdown ,Transfer_Revenue
1,2,3
]
;
Temp1:
Crosstable(Column,ID,1)
Load * Resident Temp;

Drop table Temp;
Drop Field Row_Number from Temp1;
Exit Script;

Let me know if this has resolved your issue,if yes please like and accept it as a solution.