Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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);
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
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
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...
Looks like you are missing a closing bracket on the IsNull function.
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
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
I thought IsNull can be one of two value 0 or -1. Therefore maybe the '>' you use not correct either.
you miss the ) for the isnull function
Thanks everyone. It is working fine now.
if NoOfRows('Stocks') > 0 then
store My_Table into My_Table.qvd;
endif