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

Exclude data in a field after (-)

Hi Guys,

How can i do this in the script.

I have a field and the values in it like this

FieldName

New York - ABC

Atlanta - ABCD

Miami - RF

How can I get a field to be like

Field Name1

New York

Atlanta

Miami

So basically i want to exclude anything after from the dash and over.

Thxs for your help

Alec

1 Solution

Accepted Solutions
alec1982
Specialist II
Specialist II
Author

I guess I found it but just in case someone else needs a solution I used

SubField(FieldName,'-',1)

Thxs,

Alec

View solution in original post

4 Replies
Nicole-Smith

subfield(FieldName, '-', 1)

disqr_rm
Partner - Specialist III
Partner - Specialist III

Load subfield(FieldName, '-', 1) as NewField

Not applicable

Probably something like this would suit you best:

LEFT(FieldName, index(FieldName,' -') ) as FieldName1,

Keep in mind this has a space before the - assuming you have that in your example above.  If you don't simply change the inside of the index part to '-'

Hope this helps!

alec1982
Specialist II
Specialist II
Author

I guess I found it but just in case someone else needs a solution I used

SubField(FieldName,'-',1)

Thxs,

Alec