Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
nareshthavidishetty
Contributor III

trimming the field values

Hi,

I need to extract a detail from the below field value.

 

Actual:

Product ID:

HAI000200020876-11300
HAI000200020332-11300
HAI000200020000-11300

AND000200256543-11304
AND000200256525-11304
AND000200256523-11304
CLE136198-11300
CLE133712-11300
CLE133660-11300
CLE133523-11300

 

Required output:

Product ID:

HAI000200020876-11300
HAI000200020332-11300
HAI000200020000-11300

200256543-11304
200256525-11304
200256523-11304
136198-11300
133660-11300
133523-11300

Thanks..

 

Labels (1)
6 Replies
Highlighted
nareshthavidishetty
Contributor III

trimming the field values

Hi,

I need to extract a detail from the below field value.

 

Actual:

Product ID:

HAI000200020876-11300
HAI000200020332-11300
HAI000200020000-11300

AND000200256543-11304
AND000200256525-11304
AND000200256523-11304
CLE136198-11300
CLE133712-11300
CLE133660-11300
CLE133523-11300

 

Required out put:

Product ID:

HAI000200020876-11300
HAI000200020332-11300
HAI000200020000-11300

200256543-11304
200256525-11304
200256523-11304
136198-11300
133660-11300
133523-11300

Thanks..

 

Highlighted
Luminary
Luminary

Re: trimming the field values

Hi,
How about below expression?

1. mid(Product ID,4)
2. keepchar(Product ID,'1234567890-')
3. mid(Product ID,index(Product ID,'1234567890'))
4. IF(Left(Product ID,3)='HAI',Product ID,mid(Product ID,4))

Highlighted

Re: trimming the field values

The first 3 Product ID stayed the same, but others changed. Is there a logic behind what you are trying to do?

image.png

Highlighted

Re: trimming the field values

Look at my response here

Highlighted
Community Manager
Community Manager

Re: trimming the field values

Hi, Can you tell me what Qlik product you are discussing, I would like to move this to the forum specific to it as this is a general discussion forum. Thanks

Sue Macaluso
Highlighted
ramasaisaksoft
Valued Contributor III

Re: trimming the field values

Hi Naresh,

 

As i Know Trim will drop the spaces between words (Left Trim,Right Trim,Trim..etc..)

but here your requirement will different than Trim 

CLE136198-11300  o/p you are expecting like 136198-11300

so you need to be use purgechar().

 

so you need to use Purgechar(FieldName,'AND000200256543-11304')-- as [Test field] it will omit data from your field

now you need to do like 

purgechar([Test field],'CLE') it will remove the characters from your field.

Ex:-

keepchar(Amit1234,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz') //

 

it will give result       Amit

 

purgechar(Amit1234,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz')

 

it will give result       1234