Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Loading limited data amount via variable

Hi there,

my name is Oliver, I'm from germany and I'm brandnew in the Qlik-Community.

Last week I had the courses QlikView Designer & Developer and now I'm so excited that I spend the hole day on QlikView

I built up the data modell and nearly everything works fine. Now I would like to do a little bit of fine tuning and for that I want to limit the amount of data. I don't want to do this with commenting and uncommenting "FIRST 100", so I thougt about an other possibility.

I try the following and for the first moment it seems to work well:

Let vLine = if($(vLimit) = '100','FIRST 100', '');

$(vLine)

TableName:

LOAD ...

On the surface there is an input box with a dropdown (vLimit -> 100;complete) wich allows me to make the selection.

But if I use this way, the code highlighting in the script "says" that there is a mistake and that irritates me (see screenshot).

Can someone give me a hint or tell me a better way?

Thanks in advance

Greetings from germany (Black Forrest)

Oliver

1 Solution

Accepted Solutions
Not applicable
Author

Hi Simone,

GREAT - That's it!

Very cool idea and very helpful for me. Thank you very much

Oliver

View solution in original post

16 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Oliver

The syntax check in the editor is quite sensitive to possible errors and it does not handle variable expansions in the code very well. The script itself runs properly, its just the editor. The only workaround that comes to mind in this case is this:

if $(vLimit) = '100' Then


     <load with First 100>


else


     <load normally>


end if


You do know that you can do this in the debugger? In the script editor, click the Debug button to start the debugger. This will give you breakpoints and limited loads as options.


HTH

Jonathan



Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Hi Jonathan,

thank you for the very quick response.

OK, so I have to deal with the irritation or use the debugger.

Not applicable
Author

Sorry I'm ill at home - thats the reason of the autoreply

To get the correct syntax highlighting I tried to include the script, but I'm not familiar with including, so I get an error.

$(Include=$(SCRIPTPATH)limit100.txt);

TableName:

LOAD ...

Content of limit100.txt

Let vLine = if($(vLimit) = '100','FIRST 100', '');

$(vLine)

Error

Unknown statement

FIRST 100

I don't understand why I get this error. Perhaps I need some more basics about including scripts.

Can someone give me a hint please? Thanks in advance.

Oliver

simospa
Partner - Specialist
Partner - Specialist

Hi, try this

Content of limit100.txt

Let vLine = if($(vLimit) = '3','First 3 ', '');

In load script:

//I setted vLimit = 3, you have to retrieve the value in the way you know

Set vLimit = '3';

$(Include=limit100.txt);

MyMonths:

$(vLine) LOAD * INLINE [

    MonthsName, MonthsID, MonthsOrder

    Jan, 1, 10

    Feb, 2, 11

    Mar, 3, 12

    Apr, 4, 1

    May, 5, 2

    Jun, 6, 3

    Jul, 7, 4

    Ago, 8, 5

    Sep, 9, 6

    Oct, 10, 7

    Nov, 11, 8

    Dec, 12, 9

];

Pay attention: the correct syntax is FIRST 3 LOAD * .... and not LOAD FIRST 3 *

Let me know

S.

Not applicable
Author

Hi Simone,

thanks for your help.

That works pretty good, but also confuses the syntax highlighting.

Seems to me, that I have to deal with...

simospa
Partner - Specialist
Partner - Specialist

I see... it is tiresome... I think is a bug, like the one you get if you create a set analysis with -= operator...

S.

simospa
Partner - Specialist
Partner - Specialist

You could insert this script in a separated sheet of load script. You insert only this.

Then you continue to insert your application script in others sheets. Sintax errors seems live inside a specific sheet.

It's a trick, it can be useful?

S.

Not applicable
Author

Hi Simone,

GREAT - That's it!

Very cool idea and very helpful for me. Thank you very much

Oliver

simospa
Partner - Specialist
Partner - Specialist

You're welcome!

Rememeber to mark post as useful

S.