Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

which function I can use?

Hello All

I have a field with values like below

1234-abc

13422-monday

136647536-tuesday

I need to display only the part before '-' 

eg) 1234  ,  13422,  136647536.

Kindly help me what function I can use to get above result.

Thanks in advance...

1 Solution

Accepted Solutions
sunny_talwar

You can use SubField function here:

SubField(FieldName, '-', 1) as FieldName

View solution in original post

24 Replies
sunny_talwar

You can use SubField function here:

SubField(FieldName, '-', 1) as FieldName

Peter_Cammaert
Partner - Champion III
Partner - Champion III

=SubField(YourOriginalField, '-', 1)

oknotsen
Master III
Master III

= left(fieldname, (len(fieldname) - index(fieldname, '-'))

May you live in interesting times!
sunny_talwar

See this script:

Table:

LOAD *,

  SubField(FieldName, '-', 1) as Part1,

  SubField(FieldName, '-', 2) as Part2;

LOAD * Inline [

FieldName

1234-abc

13422-monday

136647536-tuesday

];

It's output:

Capture.PNG

chrisg
Partner - Creator III
Partner - Creator III

Hi Chintan,

try this:

left(Value,index(Value,'-')-1) AS Partleft

best regards

Christoph

Do or Do Not. There is no try!
Anonymous
Not applicable
Author

Hello Sunny

Can I use this in front end report ?  I want something which can be user in report and not script.

Regards

Chintan Gala

avinashelite

Yes you can use in the front end also .

subfield(filed_name,'-',1) use this expression in the list box and charts

Anonymous
Not applicable
Author

Thanks!

Anonymous
Not applicable
Author

Good discussion thread here. Please be sure to mark helpful and correct answers.

Sara