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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Search and find a string

Hi All,

I have a requirement to find a string from the data base and represne in a table.

Input data :

Data :

ABC1230

dfg ABC11 th

yur ABC435000 mm

kk ABC76859 ndf ght ii

I need to find the string Which start from ABC.

Expected Output:-

data

ABC1230

ABC11

ABC435000

ABC76859

You help will be highly appriciated

Thanks!
D J

1 Solution

Accepted Solutions
alexandros17
Partner - Champion III
Partner - Champion III

This is the working expression

If(Index(VAL,'ABC')>0,

  If(Index(Mid(VAL, Index(VAL,'ABC')),' ') > 0,

  Mid(VAL, Index(VAL,'ABC'), Index(Mid(VAL, Index(VAL,'ABC')),' ')),

  If(Index(Mid(VAL, Index(VAL,'ABC')),' ') = 0,

  Mid(VAL, Index(VAL,'ABC')),

  '---'

  )

  )

  ,'---'

)

View solution in original post

7 Replies
rustyfishbones
Master II
Master II

You could try

KEEPCHAR(data,'ABC0123456789') AS Data

alexandros17
Partner - Champion III
Partner - Champion III

This is the working expression

If(Index(VAL,'ABC')>0,

  If(Index(Mid(VAL, Index(VAL,'ABC')),' ') > 0,

  Mid(VAL, Index(VAL,'ABC'), Index(Mid(VAL, Index(VAL,'ABC')),' ')),

  If(Index(Mid(VAL, Index(VAL,'ABC')),' ') = 0,

  Mid(VAL, Index(VAL,'ABC')),

  '---'

  )

  )

  ,'---'

)

rustyfishbones
Master II
Master II

Or try

TRIM(PURGECHAR(data,'abcdefghijklmnopqrstuvwxyz')) as [New Data]

Not applicable
Author

KeepChar is not working because it will return all the character in that string .

Thanks

D J

tresesco
MVP
MVP

May be like:

Input:

Load SubField(data, ' ')  as NewData From <>;

Output:

Load

          NewData

Resident Input Where WildMatch(NewData, 'ABC*') ;

Drop table Input;

rustyfishbones
Master II
Master II

See attached

rustyfishbones
Master II
Master II

You could also try

2014-03-10_1018.png