Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
abhaysingh
Specialist II
Specialist II

Trim dedicated String

Hi Guys,

I have field in which values are like below

jaipur

imp. jaipur

Bearings

imp. Bearings

i want to exclude imp. from the values.. how can i achieve it

thanks

1 Solution

Accepted Solutions
PrashantSangle

Hi,

Use replace()

try like

replace(fieldName,'imp.','')

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

View solution in original post

12 Replies
PrashantSangle

Hi,

Use replace()

try like

replace(fieldName,'imp.','')

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Chanty4u
MVP
MVP

out.PNGtry this

ss:

LOAD * INLINE [

    naem

    jaipur

    imp. jaipur

    Bearings

    imp. Bearings

];

Main:

LOAD * ,

PurgeChar(naem,'imp.') as new

Resident ss;

danansell42
Creator III
Creator III

Hi Abhay

The answer from Max will work or you could also use the substring command.

Wouldn't use purgechar as it will also drop any other i,m or p's from the text

Thanks

Dan

avinashelite

Try with Replace()

replace(Field,'imp.','')

avinashelite

sureshqv‌ we should not use Purgechar() in this case it will eliminate all the words with letter i, m , p and . You could see the same in your example where jaipur has become jaur

maniram23
Creator II
Creator II

Hi,

May be it will full for you.

T1:

load * Inline [

ABC

jaipur

imp. jaipur

Bearings

imp. Bearings

];

LOAD *,

LTrim(Replace(ABC,'imp.','')) as new

Resident T1;

DROP Table T1;

qlikview979
Specialist
Specialist

Hi Try this,

T1:

LOAD * INLINE [

    name

    jaipur

    imp. jaipur

    Bearings

    imp. Bearings

];

T2:

LOAD * ,

"Replace(name,'imp.','') as replace

Resident T1;



MindaugasBacius
Partner - Specialist III
Partner - Specialist III

Apart from what is already said:

load *

  ,if(left(Field, 4) = 'imp.', trim(SubField(Field, 'imp.', 2)), trim(Field)) as Field2

  ,if(left(Field, 4) = 'imp.', trim(right(Field, len(Field) - 4)), trim(Field)) as Field3

inline [

Field

jaipur

imp. jaipur

Bearings

imp. Bearings

];

Result:

Screenshot_1.jpg

Check the attachment.

Chanty4u
MVP
MVP

thnx avi fro ur clarification