Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have a question and I hope someone can help.
Within a map I can have 0, 1, or multiple files with a name ending with 'projectactuals', so 123_projectactuals.qvd, 456_projectactuals, etc. Within a model-qvd I want to load these QVD's BUT ONLY IF THEY EXIST.
This means LOAD 'D:\DATA\*_projectactuals.qvd' will return an error when the file does not exist.So I want to check if files ending with 'projectactuals' exist.
When I use the following statement it works fine:
LET vListQVDExistsProjectactuals = NOT isnull(QVDCreateTime('D:\Data\123_Projectactuals.qvd'));
IF $(vListQVDExistsProjectactuals) THEN LOAD...
However there can multiple files all ending with 'projectactuals' and the prefix '123' is random.
I have tried LET vListQVDExistsProjectactuals = NOT isnull(QVDCreateTime('D:\Data\*_Projectactuals.qvd'));
but that doesn't work as the variable probably wants to have 1 unique file name and the * (star) is within the quotes, so this doesn't work.
Please help.
Hi,
Try like this
SET ERRORMODE = 0;
Test:
LOAD
Count(DISTINCT FileName()) AS Files
FROM D:\DATA\*_projectactuals.qvd (qvd);
LET vFileCount = Alt(Peek('Files'), 0);
SET ERRORMODE =1;
Regards,
Jagan.
Hi,
Use the following before "LOAD 'D:\DATA\*_projectactuals.qvd'"
SET ERRORMODE = 0;
This will not prompt for any error while reloading.
Regards,
Vivek
Hi,
Try like this
SET ERRORMODE = 0;
Test:
LOAD
Count(DISTINCT FileName()) AS Files
FROM D:\DATA\*_projectactuals.qvd (qvd);
LET vFileCount = Alt(Peek('Files'), 0);
SET ERRORMODE =1;
Regards,
Jagan.
Great, this works. Thanks guys.