Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Qlik Developers
I have a data base in which i have a table. The data in the table will be updated everyday and deletes the historical data. Suppose yesterday i have data in the table and today when i update the table yesterdays data will be replaced by todays data.
I want to create a qvd in which i can store historical data and current data.
For example today i have data in the table i want to store the data into qvd. Tomorrow the data in the table will be replaced by tomorrows data. I want to store both historical and current data. Can someone help me please. I have the below script in qliksense.
LIB CONNECT TO [PostgreSQL_qvhpepro (americas_kommerel)];
[pg_stat_activity]:
SELECT "datid",
"datname",
"pid",
"usesysid",
"usename",
"application_name",
"client_addr",
"client_hostname",
"client_port",
"backend_start",
text(date(backend_start)) as Date,
"xact_start",
"query_start",
"state_change",
"waiting",
"state",
"query"
FROM "pg_catalog"."pg_stat_activity";
Thanks
Anil
May be like this
LET vDate = Date(Today(), 'YYYYMMDD');
[pg_stat_activity]:
SELECT "datid",
"datname",
"pid",
"usesysid",
"usename",
"application_name",
"client_addr",
"client_hostname",
"client_port",
"backend_start",
text(date(backend_start)) as Date,
"xact_start",
"query_start",
"state_change",
"waiting",
"state",
"query"
FROM "pg_catalog"."pg_stat_activity";
STORE [pg_stat_activity] into [pg_stat_activity_$(vDate).qvd] (qvd);
I don't know of anyway to save the two into one qvd but you can save a qvd each day by adding the date or the num of the date to the qvd script. This will give you a qvd per day.
Bella Mae
Thanks for the reply. Can you please tell me how to save a qvd each day.Below is the script i am pulling data from DB.
LIB CONNECT TO [PostgreSQL_qvhpepro (americas_kommerel)];
[pg_stat_activity]:
SELECT "datid",
"datname",
"pid",
"usesysid",
"usename",
"application_name",
"client_addr",
"client_hostname",
"client_port",
"backend_start",
text(date(backend_start)) as Date,
"xact_start",
"query_start",
"state_change",
"waiting",
"state",
"query"
FROM "pg_catalog"."pg_stat_activity";
Thanks
Anil
May be like this
LET vDate = Date(Today(), 'YYYYMMDD');
[pg_stat_activity]:
SELECT "datid",
"datname",
"pid",
"usesysid",
"usename",
"application_name",
"client_addr",
"client_hostname",
"client_port",
"backend_start",
text(date(backend_start)) as Date,
"xact_start",
"query_start",
"state_change",
"waiting",
"state",
"query"
FROM "pg_catalog"."pg_stat_activity";
STORE [pg_stat_activity] into [pg_stat_activity_$(vDate).qvd] (qvd);
I think I used to use num of reload date but the variable works well too.