Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Guys
I hope you are good
I have a field in my database that contains number and test, I would like to extract only the number before the '-' with a qlikview function.
Any idea please
here 's my field :
for the first value for exampe i want to extract 2205 and put the result in a new field
Thankss
Use
LOAD *,
Subfield(EVENTDETAILS4, '-', 1) AS yournumber,
Subfield(EVENTDETAILS4, '-', 2) AS yourtext
FROM yourtablename;
Use
LOAD *,
Subfield(EVENTDETAILS4, '-', 1) AS yournumber,
Subfield(EVENTDETAILS4, '-', 2) AS yourtext
FROM yourtablename;
Try like below
a:
LOAD * INLINE [
Text
2205-EISA
6344-SECM MSC SOUSE
2846-SSS-678 MFJFG
];
Result:
LOAD
KeepChar(Text,'0123456789') as NewField
Resident a;
Chanty Bhai, Your expression won't work here due to he need only Number's of left hand side of the Field
From your data the out put came like below
2205 6344 2846678(This is wrong)
And he want
2205 6344 2846
Hi,
U can do this by many ways by using different sets f string functions.
Attaching string function list here.Go through n u can try as many as.
U can use Subfield fr this.Example is thr inside attachment.
Sachin
Hmmm ... He doesnt have that field value i just added if he require like that also he will get,
in his screen shot there is no value like below
2846-SSS-678 MFJFG
You can also try
left( FieldName, index(Fieldname,'-',1)-1) as Newfield
Thank you for your interation guys