UniversE
UniversE

Reputation: 2507

QlikView: How to set a selection for PDF reports?

Situation:

I have some sheets in my QVW and two alternate selection states: 1. Standard (for selection of an arbitrary date in the reports) 2. PreviousDayFix (for sheets that shall display the data of the previous day only)

For 1.) the user can select the filters and for 2.) the fields are set by document triggers (on open document) and the filters are not displayed for the user, so he cannot change them.

Problem:

I have a report based on one of the "previous day sheets". When I distribute this report as PDF via E-Mail, it seems, that the document triggers are not executed. So the "previous day" will not be set correctly. So when someone opens the Document on 20th Jan, the date is set to 19th Jan. If he doesn't open it on 21st Jan, then the PDF report will stick on the 19th Jan.

I've seen, that you can select one of the following options in the report settings:

  1. Current selection
  2. Clear selection
  3. Bookmark

But there seems to be no option: "use whatever the document triggers set".

How can I fix / workaround this?

Upvotes: 1

Views: 1043

Answers (1)

UniversE
UniversE

Reputation: 2507

Ok - I did not found an option in qlikview, but a very clean workaround.

  1. Add a field to your calender IsYesterday with if(Date = today()-1, 1, 0)
  2. Don't set the Day, Month, Year fields with the document trigger, but set the IsYesterday field to 1
  3. Make sure, you ran the script at least once

Then it doesn't matter, if the PDF report distribution executes the trigger or not, because the filter stays the same. And since the data is reloaded, the IsYesterday-filter automatically adjusts to the correct date.


Because my question is not only valid for Dates, this answer is not only valid for dates, too.

Basically the trick is, to use a field, where you programatically implement the filter condition and return a boolean. Then you select that boolean (manually or with a document trigger) and save the QVW. Next time, the PDF report generates, the filter is applied.

Upvotes: 0

Related Questions