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: 
JACKNIEKERK
Creator
Creator

Syntax for instr

a field in a tabelrecord wich shows based on 2 options wich i can filter,

option a 

a$="INVOICE 200010 CUSTOMERCODE:          1296 KLM  SHIPPING

here in VB i can do  Code$ = mid$(a$,instr(a$,":")+1), 12) 

option b

1296| 200010|KLM  SHIPPING

here in VB i can do  Code$ = left$(a$,instr(a$,"|")-1)

Now i have to do this qlikview  during load something like:

if (option = 'a' , mid(a$,instr(a$,':')+-1),12)  as Code,

if (option = 'b' , left(a$,instr(a$,'|')-1) as Code,

Please advice , thank you

    

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer

Just replace instr() with index() and it should work nearly without further adjustments whereby the use of subfield() might be even more suitable.

- Marcus

View solution in original post

2 Replies
marcus_sommer

Just replace instr() with index() and it should work nearly without further adjustments whereby the use of subfield() might be even more suitable.

- Marcus

JACKNIEKERK
Creator
Creator
Author

Yes , this does the job

if(a = '1300' , left(Reason,index(Reason,'| ',1)-1),Mid(Reason,index(Reason,': ',1)+2,12)) as Code

 

Thanks a lot

regards Jack