Qlik Community

Qlik Education Discussions

Discussion Board for collaboration related to Qlik Education.

umartareen
Contributor

Creating Qvd With The Latest Reload Time as its Name

Hi,

I am looking to create Qvds with the last reload time as their name.

So every time I reload the application, a new Qvd is generated for the same table in the same folder but with new date and time without overriding the previous generated Qvd.

In short, I have to generate a new Qvd for every reload with reload date and time as their name.

Any ideas, please help,

Thanks and Regards

Umar

1 Solution

Accepted Solutions
MVP
MVP

Re: Creating Qvd With The Latest Reload Time as its Name

table:

load rowno() as id

AutoGenerate 100;

let vDateTime = date(now(), 'YYYYMMDD_hhmmss');

let vFileName = '$(vDateTime)_table.qvd';

if len(trim(FileSize('$(vFileName)')))>0 then

  trace file exists;

ELSE

  trace 'file doesnt exists, store';

  trace $(vFileName);

  store table into '$(vFileName)' (qvd);

ENDIF;

if len(trim(FileSize('$(vFileName)')))>0 then

  trace file exists;

ELSE

  trace 'file doesnt exists, store';

  trace $(vFileName);

  store table into '$(vFileName)' (qvd);

ENDIF;

4 Replies

Re: Creating Qvd With The Latest Reload Time as its Name

Try something like this:

let vDateTime = now();

....

store table into table_$(vDateTime).qvd (qvd);

Maybe you need some additional formating for vDateTime to sort in a certain order and to avoid not allowed chars like ":" between hours and minutes.

- Marcus

umartareen
Contributor

Re: Creating Qvd With The Latest Reload Time as its Name

Hi, thank you for the reply.

I tried this way, but the qvd that is generated has its name as Table_.qvd.

It is not recording the date and time. I tried the Now() function as you suggested and also ReloadTime().

I have even changed the set variables Dateformat, Timeformat and Timestampformats from (Smiley Happy to (_), just in case the date and time do not appear.

MVP
MVP

Re: Creating Qvd With The Latest Reload Time as its Name

table:

load rowno() as id

AutoGenerate 100;

let vDateTime = date(now(), 'YYYYMMDD_hhmmss');

let vFileName = '$(vDateTime)_table.qvd';

if len(trim(FileSize('$(vFileName)')))>0 then

  trace file exists;

ELSE

  trace 'file doesnt exists, store';

  trace $(vFileName);

  store table into '$(vFileName)' (qvd);

ENDIF;

if len(trim(FileSize('$(vFileName)')))>0 then

  trace file exists;

ELSE

  trace 'file doesnt exists, store';

  trace $(vFileName);

  store table into '$(vFileName)' (qvd);

ENDIF;

umartareen
Contributor

Re: Creating Qvd With The Latest Reload Time as its Name

Great, thank you !

Community Browser