Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
nareshthavidishetty
Creator III
Creator 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
nareshthavidishetty
Creator III
Creator III
Author

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..

 

ryo_okabe
Partner Ambassador
Partner Ambassador

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))

sunny_talwar

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

image.png

sunny_talwar

Look at my response here

Sue_Macaluso
Community Manager
Community Manager

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
ramasaisaksoft

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