Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
hopkinsc
Partner - Specialist III
Partner - Specialist III

Purge anything after - from field in script

Hi all,

I have a field that has names but some have a hyfen then numbers after it (-1).

I want to purge the hyphen and everything after it but unsure on how to do it.

Eg.

abcdef2-1

ghijk-1

ghijk-2

ghijk-3

lmno-211

lmno-212

so i would end up with the following values in the field

abcdef2

ghijk

ghijk

ghijk

lmno

lmno

I know how to purge the hyphen and numbers but some names have numbers in them so i cant do that.

thanks

1 Solution

Accepted Solutions
datanibbler
Champion
Champion

Hi,

just use SUBFIELD([field], '-', 1) to catch everything in front of the hyphen instead.

Best regards,

DataNibbler

View solution in original post

2 Replies
datanibbler
Champion
Champion

Hi,

just use SUBFIELD([field], '-', 1) to catch everything in front of the hyphen instead.

Best regards,

DataNibbler

qv_testing
Specialist II
Specialist II

Hi Hop,

Try this,

Left(Fieldname, Index(FieldName, '-')-1) as FieldName