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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Index Error

Hi all,

What I'm trying to do is:

If the 3 first character of H_SUPPLIERID1 = ‘FOU’ then H_SUPPLIERID1 else H_SUPPLIERID1 without the 3 first character

Ex : If ‘FOU_105758’ then ‘FOU_105758’

       If ‘55_FOU_105758’ then ‘FOU_105758’

my code:

SQL SELECT

  (H_CODE_SOCIETE) + '_' + (H_SUPPLIERID1) as CSUSUPID,

  (H_CODE_SOCIETE) + '_' + (H_CODE_SECTEUR) as IDCAPLAN,

  case when index(mid([H_SUPPLIERID1],3,1) '_')=0 then [H_SUPPLIERID1] else mid([H_SUPPLIERID1], 3) end as [SupplierId]

FROM SHARE.dbo.IDX;

The error message says there maybe a "with" or parenthesis missing with the index function.

I'd be greaful for any help.

Many thanks,

Florian

Labels (1)
1 Solution

Accepted Solutions
senpradip007
Specialist III
Specialist III

Try like

Load

If(Left(H_SUPPLIERID1,3) = 'FOU', H_SUPPLIERID1, Mid(H_SUPPLIERID1,4)) AS H_SUPPLIERID1,

...

;

SQL Select * from [Table name];

View solution in original post

1 Reply
senpradip007
Specialist III
Specialist III

Try like

Load

If(Left(H_SUPPLIERID1,3) = 'FOU', H_SUPPLIERID1, Mid(H_SUPPLIERID1,4)) AS H_SUPPLIERID1,

...

;

SQL Select * from [Table name];