Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
yastest
Contributor
Contributor

Trim, Match, Len, If - which combination?

I have following below product values and would like to remove some characters at the end of text only.  These are ";" "; ;" and " ;"

Any ideas would be great.

 

PRODUCT

Car; Doll;

Doll; ;

Lego;

 

 

Labels (1)
1 Solution

Accepted Solutions
MarcoWedel
MVP
MVP

one possible solution:

 

MarcoWedel_0-1688588380268.png

table1:
LOAD PRODUCT as PRODUCTsource,
     Replace(Replace(RTrim(Replace(Replace(PRODUCT,Chr(9),'@->TAB<-@'),';',Chr(9))),Chr(9),';'),'@->TAB<-@',Chr(9)) as PRODUCT
Inline [
PRODUCT
Car; Doll;
Doll; ;
Brick;
Brick;Car
Plane; ; Car;
Car; ; Plane; ;
Doll
Doll;Car; ; Plane; ;;
Brick;Car; ; Plane; ; ;
Brick;Doll;	;	Plane; ; ;
];

View solution in original post

5 Replies
Henry_Laser
Contributor
Contributor

Hi,

Where are you extracting your data from? Excel, QVD, SQL Stored Procedure?

yastest
Contributor
Contributor
Author

QVD

Henry_Laser
Contributor
Contributor

It might be easier to fix your data before you store it into your  QVD. If you run your QVD from a SQL SP, you can remove those characters by using the substitute function or replace function, same if you load your QVD from a Excel file. Or you can have a look here on how to apply the replace function.

https://help.qlik.com/en-US/sense/May2023/Subsystems/Hub/Content/Sense_Hub/Scripting/StringFunctions...

yastest
Contributor
Contributor
Author

Thanks tried this, but it replaces all values. I would like to replace the last few characters.

MarcoWedel
MVP
MVP

one possible solution:

 

MarcoWedel_0-1688588380268.png

table1:
LOAD PRODUCT as PRODUCTsource,
     Replace(Replace(RTrim(Replace(Replace(PRODUCT,Chr(9),'@->TAB<-@'),';',Chr(9))),Chr(9),';'),'@->TAB<-@',Chr(9)) as PRODUCT
Inline [
PRODUCT
Car; Doll;
Doll; ;
Brick;
Brick;Car
Plane; ; Car;
Car; ; Plane; ;
Doll
Doll;Car; ; Plane; ;;
Brick;Car; ; Plane; ; ;
Brick;Doll;	;	Plane; ; ;
];