Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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;
one possible solution:
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; ; ;
];
Hi,
Where are you extracting your data from? Excel, QVD, SQL Stored Procedure?
QVD
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.
Thanks tried this, but it replaces all values. I would like to replace the last few characters.
one possible solution:
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; ; ;
];