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

How to replace ID as Name in Straight table

Hi,

I have a column ID with values 1000,1001. I need to replace this values 1000 as Alex and 1001 as Rob.

Could anyone let me know how to write the expression in Straight table or script in Load.

Thanks.

1 Solution

Accepted Solutions
Carlos_Reyes
Partner - Specialist
Partner - Specialist

As Christopher said Applymap is a good idea since its likely that you'll need to replace more ID values with Names, but if you don't you can use an IF.

LOAD

          ID,

          IF (ID= 1000, 'Alex', IF(ID= 1001, 'Rob', ID)) AS Replaced_ID

FROM TABLE

;

View solution in original post

8 Replies
Not applicable
Author

try something like

load id,

'1000' as Alex,

'1001' as Rob

from ...

or look into applymap function

manas_bn
Creator
Creator

load

if(ID=1000,'Alex',if(ID=1001,'Rob',ID)) as ID

Resident Table;

OR

Add a calculated dimension

if(ID=1000,'Alex',if(ID=1001,'Rob',ID))

Carlos_Reyes
Partner - Specialist
Partner - Specialist

As Christopher said Applymap is a good idea since its likely that you'll need to replace more ID values with Names, but if you don't you can use an IF.

LOAD

          ID,

          IF (ID= 1000, 'Alex', IF(ID= 1001, 'Rob', ID)) AS Replaced_ID

FROM TABLE

;

v_iyyappan
Specialist
Specialist

Hi,

Use Apply map concept you can get the name.

Please check the following link

ApplyMap

Regards,

MayilVahanan

HI

Try with mapping and applymap concept.

MappingName:

mapping load * inline

[

Id, Name

1000,Alex

1001, Rob

];

Load ApplyMap('MappingName',Id) as Id from tablename;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Anonymous
Not applicable
Author

In table expression
pick(match(1000,1001),'Alex','Rob')

Regards,
Michael

rustyfishbones
Master II
Master II

Try this,

IF(ID = 1000, 'ALEX', IF(ID = 1001, 'Rob',ID))

I hope it helps

Not applicable
Author

Thanks for your answer it's working.