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

extract function

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

Capture.PNG

Thankss

1 Solution

Accepted Solutions
vishsaggi
Champion III
Champion III

Use

LOAD *,

Subfield(EVENTDETAILS4, '-', 1) AS yournumber,

Subfield(EVENTDETAILS4, '-', 2) AS yourtext


FROM yourtablename;

View solution in original post

8 Replies
vishsaggi
Champion III
Champion III

Use

LOAD *,

Subfield(EVENTDETAILS4, '-', 1) AS yournumber,

Subfield(EVENTDETAILS4, '-', 2) AS yourtext


FROM yourtablename;

Chanty4u
MVP
MVP

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;

Anil_Babu_Samineni

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

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sdmech81
Specialist
Specialist

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

Chanty4u
MVP
MVP

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     

shraddha_g
Partner - Master III
Partner - Master III

You can also try

left( FieldName, index(Fieldname,'-',1)-1) as Newfield

master_student
Creator III
Creator III
Author

Thank you for your interation guys