system
October 16, 2015, 9:12am
1
Hi Expert,
I have requirement like below example.
source data is coming like
A/B/C/XYZ
I want to load into target table after last black slash values only like XYZ I need to load into target.
Could you please help me on this requirement.
Thanks,
Madhav
madhavbods (BOB member since 2012-01-06)
system
October 20, 2015, 5:45pm
2
Use word_ext() or substr() with -1
Arun.K (BOB member since 2011-10-18)
system
October 21, 2015, 11:21am
3
First find the length of the data you have, and repace the “/” with “##” and find the length. The difference will let you know how may “/” there in the string.
Once you know that you can use word_ext(string, ‘/’, difference) wich will give the last part of the string
amuh10 (BOB member since 2012-04-11)
system
November 2, 2015, 8:53am
4
Hi Experts,
Thanks for your reply,
But I’m unable to get results with above functions because of my source data is not in one format is like below.
A/B/C/XYZ
A/B/XY
A/B/C/D/XX
I need to load last slash values only like below
XYZ
XY
XX
Thanks,
Madhav
madhavbods (BOB member since 2012-01-06)
system
November 9, 2015, 8:35am
5
Hi,
Try create custom function to find last ‘/’. Like (input $TEXT, local $POSITION and $POSITION_NEXT):
$POSITION = 0;
$POSITION_NEXT = 0;
$POSITION = index( $TEXT, ‘/’, $POSITION);
$POSITION_NEXT = $POSITION;
WHILE ( $POSITION_NEXT > 0 )
begin
$POSITION_NEXT = index($TEXT, ‘/’, $POSITION + 1);
$POSITION = ifthenelse( $POSITION_NEXT > 0 , $POSITION_NEXT, $POSITION);
end
Return $POSITION;
Your string is now:
substr( $TEXT , $POSITION + 1 , length( $TEXT ) - $POSITION )
(change $POSITION with your function)
MSL (BOB member since 2015-04-27)
system
November 18, 2015, 10:51am
6
Hi ,
Try using below ;
word_ext(VAL, -1, ‘/’)
It will give only value after last ‘/’
BOBJFan (BOB member since 2011-09-24)