Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Code looks like below ....
001-0525-04-555-121
001-0525-02-555-121
001-0525-01-555-121
001-0525-04-555-122
001-0525-02-555-122
001-0525-01-555-122
I have code as above in the file..If anything has 04 then ABC,IF 02 THE DEF ,IF 01 then HIJ
How can I do thia ?
Thank you.
Try this may be:
LOAD *,
Pick(Match(Subfield(Value, '-', 3), 04,02,01), 'ABC','DEF','HIJ') AS NewField INLINE [
Value
001-0525-04-555-121
001-0525-02-555-121
001-0525-01-555-121
001-0525-04-555-122
001-0525-02-555-122
001-0525-01-555-122
];
Try this may be:
LOAD *,
Pick(Match(Subfield(Value, '-', 3), 04,02,01), 'ABC','DEF','HIJ') AS NewField INLINE [
Value
001-0525-04-555-121
001-0525-02-555-121
001-0525-01-555-121
001-0525-04-555-122
001-0525-02-555-122
001-0525-01-555-122
];
Awesome.Thank you.
I need to add one more to this ...
if 04-555 and 01-555 then XYZ .
Can I add this in the same line of script ?
Pick(Match(Subfield(Value, '-', 3), 04,02,01), 'ABC','DEF','HIJ') AS NewField
Thank you much.
LOAD *,
Pick(Match(Subfield(Value, '-', 3), 04,02,01), 'ABC','DEF','HIJ') AS NewField
INLINE [
Value
001-0525-04-555-121
001-0525-02-555-121
001-0525-01-555-121
001-0525-04-555-122
001-0525-02-555-122
001-0525-01-555-122
];
In the Same Field you mean ?
Ya..
May be as below:
LOAD *,
If(mid(Value,10,6)='04-555' or mid(Value,10,6)='01-555','XYZ', Pick(Match(Subfield(Value, '-', 3), 04,02,01), 'ABC','DEF','HIJ')) AS NewField
INLINE [
Value
001-0525-04-555-121
001-0525-02-555-121
001-0525-01-555-121
001-0525-04-555-122
001-0525-02-555-122
001-0525-01-555-122
];
Note: I modified Nagaraju code and added a If condition.
Awesome. Thank you very much.