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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
kris_vliegen
Partner - Creator III
Partner - Creator III

Excel to qvd

Hi All,

I've created a script that makes a Qvd out of an excel.

Sometimes the excel has no records. Now I would like to create the qvd only if there are records in the excel.

I've created the script to calculate the maximum rownumber.

Who can help me with this?

Regards Kris

StocksrowTemp:

Load

   RowNo() as Row

resident Stocks;

NoConcatenate

Stocksrow:

Load

   max(Row) as MaxRow

   Resident StocksrowTemp;

drop table StocksrowTemp;

directory ..\03_QVD ;

If ( MaxRow > 0,

store

  Stocks into Stocks.QVD);

1 Solution

Accepted Solutions
its_anandrjs
Champion III
Champion III

Hi,

Try this way and load a if condition

Ex:-

if NoOfRows('TabA') > 0 then

STORE  TabA into TabA.qvd;

ENDIF

In your example:-

if NoOfRows('Stocks') > 0 then

     store My_Table into My_Table.qvd;

endif

Regards

Anand

View solution in original post

8 Replies
ali_hijazi
Partner - Master II
Partner - Master II

suppose your table is called My_Table

My_Table:

Load *

from path to excel file....

you can check the number of rows in this table:

if not isnull(NoOfRows('My_Table') and NoOfRows('My_Table') > 0 then

     store My_Table into My_Table.qvd;

endif

I can walk on water when it freezes
kris_vliegen
Partner - Creator III
Partner - Creator III
Author

Hi Ali

Thanks for your responf.

I've created this script and it isn't working.

And as you can see there is an error in the script...

If_Store.JPG

Anonymous
Not applicable

Looks like you are missing a closing bracket on the IsNull function.

Not applicable

You can't use not as part of the if statement. Also the isnull is missing a ) to close it out.

Try:

if isnull(NoOfRows('My_Table')) = 0 and NoOfRows('My_Table') > 0 then

     store My_Table into My_Table.qvd;

endif

its_anandrjs
Champion III
Champion III

Hi,

Try this way and load a if condition

Ex:-

if NoOfRows('TabA') > 0 then

STORE  TabA into TabA.qvd;

ENDIF

In your example:-

if NoOfRows('Stocks') > 0 then

     store My_Table into My_Table.qvd;

endif

Regards

Anand

Not applicable

I thought IsNull can be one of two value 0 or -1. Therefore maybe the '>' you use not correct either.

ali_hijazi
Partner - Master II
Partner - Master II

you miss the ) for the isnull function

I can walk on water when it freezes
kris_vliegen
Partner - Creator III
Partner - Creator III
Author

Thanks everyone. It is working fine now.

if NoOfRows('Stocks') > 0 then

     store My_Table into My_Table.qvd;

endif