Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
sujeetsingh
Master III
Master III

Automated Script

I need a automated script for reload in Qlikview.

i have a Menu table :

Here i have to check the presence of a brand LEVIS

LEVISCheck:

select  distinct Brand_Name from MenuTable

where Brand_Name='LEVIS';

Now If the Brand name exsist then i have to load the LEVIS Dictionary table.

------------------------CHECK SCRIPT------------

Let RowCount=NoOfRows('LEVISCheck');

If '$(RowCount)'<>'0' THEN

------------------------------------------------------

LevisDetails:

select ID,ProductNo,order ,Stock,Price

from LEVIS_Data;

end if;

Now in case there is no LEVIS Brand then the error comes that Table Not found .

How to avoid this error.

1 Solution

Accepted Solutions
sujeetsingh
Master III
Master III
Author

Jagan ,

I do not want to use this function in .

Well I am now going for macro.

thank You guys for your valuable reply

View solution in original post

11 Replies
Not applicable

Can you try using Peek function and storing the value from LEVISCheck table to a variable. And then try condiitional IF based on this newly created variable?

Does this meet your expectations?

nilesh_gangurde
Partner - Specialist
Partner - Specialist

Hi,

dont put 0 in the single quotes.

If '$(RowCount)'<>'0' THEN


this should be like below.


If '$(RowCount)'<> 0 THEN


Try and let us know.


-Nilesh

Not applicable

Can you try below:

If RowCount <>'0' THEN or


If RowCount <>0 THEN


Thanks,

Angad

sujeetsingh
Master III
Master III
Author

Ok

Not applicable

Hi,

You can also set the ErrorMode= 0 : you will have an error, but that will not interrupt your process.

You may use also:

Tables:

SQLTables

In order to see the tables that have been read. But in your case, not sure, you will not have also an error.

Fabrice

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Simplest method: use Lookup() function. Returns NULL if nothing found and doesn't require you to create a new table that may or may not exist.

For example:

:

LET vLevisExists = Lookup('Brand_Name', 'Brand_Name', 'LEVIS', 'MenuTable');

IF len(trim('$(vLevisExists)')) > 0 THEN

// Load Levis details table

END IF

:

or something like this. Note that this works even if MenuTable doesn't exist...

Peter

sujeetsingh
Master III
Master III
Author

i can not set error mode to 0 because it will hide other valid reasons too .

sujeetsingh
Master III
Master III
Author

Guys,

do we have any function to find the reloaded tables in Qlikview .

jagan
Luminary Alumni
Luminary Alumni

Hi Sujeet,

You can try using TableName() and TableNumber() functions for this.  Please find below example.  Table Number starts from 0.

Month:

LOAD * INLINE [

   Month

    Jan

    Feb

    Mar

    Apr

    May

    Jun

    Jul

    Aug

    Sep

    Oct

    Nov

    Dec

];

LET vTableNumber = TableNumber('Month');

LET vTableName = TableName(TableNumber('Month'));

So, now vTableNumber  = 0 and vTableName  = Month after reloading.

Regards,

Jagan.