Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

MS Access Import data issue

hi all,

i am importting 2 tables from same MS access and doing left join and using iF statement , but giving error. see below syntax:

ODBC CONNECT To [MS Access Database; DBQ=path];

raw:

select

category,

[country of issue],

[Coll Type],

[buss code],

if([buss code]='ufu', 'Europe',if([buss code]='afu','Asia','')) as Region

from table1;

left join

select

category,

value

from table2;

Gives error on:

-If statement syntax

-left join as ODBC Failed

please advise

thanks

1 Solution

Accepted Solutions
mwoolf
Honored Contributor II

Re: MS Access Import data issue

Something like this:

raw:

load

     *,

if([buss code]='ufu', 'Europe',if([buss code]='afu','Asia','')) as Region;

select

category,

[country of issue],

[Coll Type],

[buss code],

from table1;

4 Replies
mwoolf
Honored Contributor II

Re: MS Access Import data issue

The IF is QlikView syntax and can't be used inside a SQL Select statement.

Do a preceding load and use the IF there.

Not applicable

Re: MS Access Import data issue

as i mentioned the import is from MS Acess, thus Load will not work. i have to use Select

please advise

mwoolf
Honored Contributor II

Re: MS Access Import data issue

Something like this:

raw:

load

     *,

if([buss code]='ufu', 'Europe',if([buss code]='afu','Asia','')) as Region;

select

category,

[country of issue],

[Coll Type],

[buss code],

from table1;

MVP & Luminary
MVP & Luminary

Re: MS Access Import data issue

MS-Access has the iif construct. Maybe this works:

    

     iif([buss code]='ufu', 'Europe',iif([buss code]='afu','Asia','')) as Region.

It's possible you need to use double quotes instead of single quotes.

Alternatively you can use a preceding load:

Table1

Load

     category,[country of issue],[Coll Type],[buss code],

     if([buss code]='ufu', 'Europe',if([buss code]='afu','Asia','')) as Region;

Select category,[country of issue],[Coll Type],[buss code]

from table1;

Why the left join fails is impossible to tell without more information. Do you also get an error if you load table two as a table like this:

Table2:

select category, value from table2;



talk is cheap, supply exceeds demand
Community Browser