Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
Not applicable

Trimming Data

I have a column of data that has Property Codes & Property Codes_Area Codes

3ALB272

3ALBERO7

3ALBER7A

3CAR16/2A

3BRAD5_BR2

3MANN2A_BR3

3MOZ3

3CP3-18

3MIT117_BR12

I need create a column that has just the property code, that is delete the _ and data after it.

The script below works for all that have an _ but doesn't bring across those that don't

Left (code,Index(code,'_')-1),code as Property_Code1,

How can I add to this, or is there another way, so that the column of info above ends up like below

3ALB272

3ALBERO7

3ALBER7A

3CAR16/2A

3BRAD5

3MANN2A

3MOZ3

3CP3-18

3MIT117

1 Solution

Accepted Solutions
Highlighted
Partner
Partner

Re: Trimming Data

Have you tried Subfield ?

Subfield(code,'_',1) as Property_Code1

View solution in original post

1 Reply
Highlighted
Partner
Partner

Re: Trimming Data

Have you tried Subfield ?

Subfield(code,'_',1) as Property_Code1

View solution in original post