Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Become an analytics expert with Qlik's new 15 week course: Applied Data Analytics using Qlik Sense. READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
hjm35055
Partner
Partner

Load script only if file exists?

Hi,

I am loading forecasts into my app and we do not always have a Q1 forecast.  I was wondering if there is a way to create an IF statement or something that only loads the script if it can find a file containing "Q1" and "fact"?

I am pretty new to Qlik so thanks in advance!

1 Solution

Accepted Solutions
kaushiknsolanki
Luminary Alumni
Luminary Alumni

Hi,

what is happening here is it is trying to find if the file exists or not.

So the qvdcreatetime() takes the filename with path, so if you have QVD in the same location where your qvw is located you dont need the path, but if its not in same folder then you need path.

So try this.

IF(NOT isNull(qvdCreateTime('QVDPATH\EDB Raw Q3 Forecast Fact.qvd'))) THEN

LOAD *

FROM

(qvd);

END IF


Regards,

Kaushik Solanki

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".

View solution in original post

9 Replies
kaushiknsolanki
Luminary Alumni
Luminary Alumni

Hi,

Do you have a separate file for Q1 forecast or its a value in your forecast field?

Regards,

Kaushik Solanki

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".
hjm35055
Partner
Partner
Author

All of the forecasts are separate QVDs. So 4 separate QVDs.

kaushiknsolanki
Luminary Alumni
Luminary Alumni

So you want to load entire 4 QVDs only when the Q1 forecast is there?

Regards,

Kaushik Solanki

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".
hjm35055
Partner
Partner
Author

No.  If Q1 QVD exists, I want to load it.  If not, skip script. The other 3 are loaded regardless if Q1 is there or not.

Thank you,

kaushiknsolanki
Luminary Alumni
Luminary Alumni

Hi,

You can try loading all QVD at one go like below.

LOad * from c:\Forecast*.qvd(Qvd);

Here * will take all QVDS which is named as ForecastQ1,ForecastQ2 and so on.

If this doesnt suit your requirement then you can write a statement like below.

IF (NOT isNull(qvdCreateTime('myqvdfile.qvd'))) THEN
    LOAD * FROM myqvdfile.qvd (qvd);
END IF


Regards,

Kaushik Solanki

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".
hjm35055
Partner
Partner
Author

Hi,

I am having trouble getting this to work.  I am trying to test it with a Quarter I have to see if it will load but nothing is happening.  Below is my script

IF(NOT isNull(qvdCreateTime('EDB Raw Q3 Forecast Fact.qvd'))) THEN

LOAD *

FROM

(qvd);

END IF

MayilVahanan

Hi

Try like this

LET vListqvdexists=isnull(QvdCreateTime('urpath\Filename.qvd'));  // if qvd exists then 0 else -1

//if Qvd is exist then Delta loading Else Initial Loading.


if $(vListqvdexists)=0 THEN

LOAD *

FROM

(qvd);

END IF

Thanks & Regards,
Mayil Vahanan R
sasiparupudi1
Master III
Master III

Please try full path of the qvd

IF IsNull(FileSize('Z:\Qlikview_EDB\EDB Data\QVD\EDB Raw Q3 Forecast Fact.qvd'))=0 THEN

LOAD *

FROM

(qvd);

END IF

kaushiknsolanki
Luminary Alumni
Luminary Alumni

Hi,

what is happening here is it is trying to find if the file exists or not.

So the qvdcreatetime() takes the filename with path, so if you have QVD in the same location where your qvw is located you dont need the path, but if its not in same folder then you need path.

So try this.

IF(NOT isNull(qvdCreateTime('QVDPATH\EDB Raw Q3 Forecast Fact.qvd'))) THEN

LOAD *

FROM

(qvd);

END IF


Regards,

Kaushik Solanki

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".

View solution in original post