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

Conditional LOAD

Hi. I have 2 types of exel files. One type contents direct tables,  another type contents transposed tables.

I can open each one in macro by excel API to check is table direct or transope, then  make script by macro and after it load.

But it seems to me this is too difficult for such a simple problem

Is there another solution?

Maybe something like

Load * from [2.xlsx](ooxml, embedded labels, table is Лист1, if( value = 1,  filters(Transpose())); ?

1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: Conditional LOAD

You could check a fieldname/fieldvalue before you load the data completely. You need only a unique field.

Check:

Load @1 as Check From .... where rowno() = 1;

let vCheckLoad = if(peek('Check', 0, 'Check') = 'ANY', 'direct', 'transposed');

if '$(vCheckLoad)' = 'direct' then

     Load .... first

else

     Load .... second

end if

- Marcus

2 Replies
MVP & Luminary
MVP & Luminary

Re: Conditional LOAD

You could check a fieldname/fieldvalue before you load the data completely. You need only a unique field.

Check:

Load @1 as Check From .... where rowno() = 1;

let vCheckLoad = if(peek('Check', 0, 'Check') = 'ANY', 'direct', 'transposed');

if '$(vCheckLoad)' = 'direct' then

     Load .... first

else

     Load .... second

end if

- Marcus

Not applicable

Re: Conditional LOAD

Thank you!