Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

LTrim and replace, with exception.

Hi all,

I have the following script which works in eliminating the Zero’s and blank spaces in the imported field “Material”.

replace(ltrim(replace(Material, '0', ' ')), ' ', 0) as Product,  

I need this to exclude any item in “Material” that contains “.” Or “/” from the action of the above script but still include them in the new field “Product".

For example:

An item in Material that is

000000123456 needs to become 123456

But 0002.abc needs to remain as 0002.abc

The current action returns this as 2.abc

All spaces in the item need to be removed, which I believe the trim action achieves

The Material field contains text and numbers and both.

The new field Product then should contain all entries, so if you start with 1000 you end up with 1000 that been subject to the script actions.

If anyone has any idea how this can be achieved, I'd appreciate the help.

Thank-you.

2 Replies
its_anandrjs

Hi,

Use Subfield( ) function to remove . from the field after doing do some thing like Subfield(0002.abc,'.' 1)

Rgds

Anand

Not applicable
Author

how about:

Load

if(isnum(Material),num(Material),Material) as Product,

etc.