Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
newqlik2017
Creator II
Creator II

Parsing in Qlikview

Hello,

I have a column with below values:

New Haven County
Fairfield County
Los Angeles County
Atlantic County

Result should be:

New Haven
Fairfield
Los Angeles
Atlantic

Result am getting by using IF(CNTY_NM LIKE '*COUNTY*',  SUBFIELD(CNTY_NM, ' ', 1))
New

Fairfield

Los
Atlantic

Thanks.

1 Solution

Accepted Solutions
MarcoWedel

seems to work for me

QlikCommunity_Thread_288334_Pic1.JPG

LOAD *,

    IF(CNTY_NM LIKE '*COUNTY*',  SUBFIELD(CNTY_NM, ' County', 1)) as Result

INLINE [

    CNTY_NM

    New Haven County

    Fairfield County

    Los Angeles County

    Atlantic County

];

View solution in original post

9 Replies
m_woolf
Master II
Master II

if(right(CNTY_NM,,6)='County',left(CNTY_NM,len(CNTY_NM)-7),CNTY_NM)

MarcoWedel

IF(CNTY_NM LIKE '*COUNTY*',  SUBFIELD(CNTY_NM, ' County', 1))

newqlik2017
Creator II
Creator II
Author

@Marco Wedel - The county word still appears after the county name, which I need to get rid of.

@m w - I got error in the expression but I tweaked your version to this and it seems to be working

LEFT(CNTY_NM, len(CNTY_NM)-7)

Thank you both.

juraj_misina
Luminary Alumni
Luminary Alumni

How about simple Replace(CNTY_NM, ' County', '')?

m_woolf
Master II
Master II

Slick Marco. I would mark yours  or Juraj's as Correct, but they will all work.

MarcoWedel

seems to work for me

QlikCommunity_Thread_288334_Pic1.JPG

LOAD *,

    IF(CNTY_NM LIKE '*COUNTY*',  SUBFIELD(CNTY_NM, ' County', 1)) as Result

INLINE [

    CNTY_NM

    New Haven County

    Fairfield County

    Los Angeles County

    Atlantic County

];

newqlik2017
Creator II
Creator II
Author

@Marco Wedel - your solution works perfect. I had County as uppercase instead of lowercase on my script so I overlooked.

@ Juraj Misina - your solution works as well.

Thank you all.

Anonymous
Not applicable

You can also simplify and use Replace(CNTY_NM , ' County', '').

MarcoWedel

What about these counties:

QlikCommunity_Thread_288334_Pic2.JPG