Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Experts
I have data like below format, here my requirement is i want replace the '_' (last underscore) with '-' (hi-fen).
stalwar1omarbensalemyoussefbelloum
My data like
Input
LUNG_GI_ATEZO
LUNG_GI_GI
LUNG_GI_LUNGA
LYT_STD
LYTHSM_STD
OCREView
O/P:-
LUNG_GI-ATEZO
LUNG_GI-GI
LUNG_GI-LUNGA
LYT-STD
LYTHSM-STD
OCREView
Regards
Mahesh
Yes, you are right... this should work
Table:
LOAD *,
If(Index(Input, '_', -1), Left(Input, Index(Input, '_', -1) - 1) & '-' & Right(Input, Len(Input) - Index(Input, '_', -1)), Input) as Output;
LOAD * INLINE [
Input
LUNG_GI_ATEZO
LUNG_GI_GI
LUNG_GI_LUNGA
LYT_STD
LYTHSM_STD
OCREView
];
Hi,
try this:
Replace(Input,'_','-')
This
Table:
LOAD *,
If(Index(Input, '_', -1), Left(Input, Index(Input, '_', -1) - 1) & '-' & Right(Input, Len(Input) - Index(Input, '_', -1) - 1), Input) as Output;
LOAD * INLINE [
Input
LUNG_GI_ATEZO
LUNG_GI_GI
LUNG_GI_LUNGA
LYT_STD
LYTHSM_STD
OCREView
];
Hi,
It will not give correct output.
here i want to replace only last underscore not all.
Hi Bro,
here after last _ first is missing its giving like
LYTHSM_TD
but i need LYTHSM_STD
may be it will work right
If(Index(Input, '_', -1), Left(Input, Index(Input, '_', -1) - 1) & '-' & Right(Input, Len(Input) - Index(Input, '_', -1) ), Input) as Output;
Try this as well -
=Left('LUNG_GI_ATEZO',index('LUNG_GI_ATEZO','_',-1)-1)&'-'&Subfield('LUNG_GI_ATEZO','_',-1)
Replace string with the field name.
Yes, you are right... this should work
Table:
LOAD *,
If(Index(Input, '_', -1), Left(Input, Index(Input, '_', -1) - 1) & '-' & Right(Input, Len(Input) - Index(Input, '_', -1)), Input) as Output;
LOAD * INLINE [
Input
LUNG_GI_ATEZO
LUNG_GI_GI
LUNG_GI_LUNGA
LYT_STD
LYTHSM_STD
OCREView
];
Yes bro, its perfectly working
you are master of Qlik
Regards
Mahesh