
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using if condition to store into qvd
I am loading data into table, but I only want to store data into qvd (overwrite existing qvd) if the the table contains data. If the table contains no data, I want to keep the existing qvd. I am getting an error on if statement:
//load new data
StockLevels:
LOAD "ITEMS";
SQL SELECT
"ITEMS"
FROM "PRODUCTS";
//check
if Count(Peek(ITEMS)) = 0 then
Store StockLevels into ..\QVD\StockLevels.qvd;
end if
Drop Tables StockLevels;
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
As i understand you want to store the data into qvd if there is data into the SQL tables otherwise do not store the QVD. Then check for no of rows in the table like
//load new data
StockLevels:
LOAD "ITEMS";
SQL SELECT
"ITEMS"
FROM "PRODUCTS";
LET vNoofRows = NoOfRows('StockLevels');
//check
if $(vNoofRows) > 0 then
Store StockLevels into ..\QVD\StockLevels.qvd;
end if
Drop Tables StockLevels;
Regards
Anand


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
As i understand you want to store the data into qvd if there is data into the SQL tables otherwise do not store the QVD. Then check for no of rows in the table like
//load new data
StockLevels:
LOAD "ITEMS";
SQL SELECT
"ITEMS"
FROM "PRODUCTS";
LET vNoofRows = NoOfRows('StockLevels');
//check
if $(vNoofRows) > 0 then
Store StockLevels into ..\QVD\StockLevels.qvd;
end if
Drop Tables StockLevels;
Regards
Anand

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
if NoOfRows('StockLevels') > 0 then
trace rows>0;
store ...........;
endif;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
If I understand you. You want to store data coming from SQL into a table in QVD file if a particular table has data?
What might be worth trying is using QvdTableName.
So
IF(QvdTableName('D:\Dir\FileName.qvd')) <> 0 THEN
STORE blah blah
ELSE
exit blah blah
ENDIF
Give that a try.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please try
if NoOfRows('StockLevels') > 0 then
Store StockLevels into ..\QVD\StockLevels.qvd;
end if
thanks,
Rajesh Vaswani
