Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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
;
try something like
load id,
'1000' as Alex,
'1001' as Rob
from ...
or look into applymap function
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))
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
;
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;
In table expression
pick(match(1000,1001),'Alex','Rob')
Regards,
Michael
Try this,
IF(ID = 1000, 'ALEX', IF(ID = 1001, 'Rob',ID))
I hope it helps
Thanks for your answer it's working.