Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Nicole-Smith
Not applicable

How to determine what started a dashboard reload?

Our team has built a process that reloads our dashboards only after certain criteria are met.  This is done using EDX triggers in the QMC.  However, sometimes other teams bypass our process, and reload our dashboards by logging into the QMC and hitting start.  I need a way to determine in the load script how the reload job was started--I really only need to know whether it was EDX or not.  Does anyone have any idea how/where to get this information?

1 Solution

Accepted Solutions
rwunderlich
Not applicable

Re: How to determine what started a dashboard reload?

There is no script function I know of to tell how you were triggered.  If you can access the TaskLog.txt in the distribution logs folder for the running task, the first line of the log does indeed tell what kind of trigger did kick off this task.

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

5 Replies
sunny_talwar
Not applicable

Re: How to determine what started a dashboard reload?

This is very interesting, I have no idea how you would do this, but would love to learn about this. May be @rwunderlich might be able to guide us.

rwunderlich
Not applicable

Re: How to determine what started a dashboard reload?

There is no script function I know of to tell how you were triggered.  If you can access the TaskLog.txt in the distribution logs folder for the running task, the first line of the log does indeed tell what kind of trigger did kick off this task.

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

Nicole-Smith
Not applicable

Re: How to determine what started a dashboard reload?

This is exactly what I needed, thanks @rwunderlich!

Highlighted
Nicole-Smith
Not applicable

Re: How to determine what started a dashboard reload?

For anyone else that comes across this thread, this is how I solved for this:

/* Directories to look for the logs in - these logs are split into different folders by day and dashboard */
LET vRootDirDate = DATE(TODAY(), 'YYYYMMDD');
LET vRootDir = CHR(39) & 'C:\ProgramData\QlikTech\DistributionService\1\Log\' & $(vRootDirDate) & '\*' & CHR(39);
SET vRootDirDate =;

/* Looping through the directory to get a list of each folder */
FOR EACH d IN DirList($(vRootDir));
	FolderList:
	LOAD '$(d)' AS [Folder]
	AUTOGENERATE 1;
NEXT d
SET vRootDir =;
SET d =;

/* Getting the latest folder for the current dashboard */
LastLoad:
LOAD MAXSTRING([Folder]) AS [LatestFolder]
RESIDENT FolderList
WHERE [Folder] LIKE '*' & SUBFIELD(DOCUMENTNAME(), '.', 1) & '*';
DROP TABLE FolderList;

LET vTaskLog = PEEK('LatestFolder', 0, 'LastLoad') & '\TaskLog.txt';
DROP TABLE LastLoad;

/* Determining how the dashboard load was started */
TaskLog:
LOAD @3 AS [TaskDetail]
FROM $(vTaskLog) (txt, utf8, no labels, delimiter is '\t', msq)
WHERE @3 LIKE '*Triggered By*';
SET vTaskLog =;

LET vTriggeredBy = SUBFIELD(SUBFIELD(PEEK('TaskDetail', 0, 'TaskLog'), 'Triggered by ''', 2), CHR(39), 1);
DROP TABLE TaskLog;

I end up using the vTriggeredBy variable to determine what started the load and have subsequent actions based on that value.

rwunderlich
Not applicable

Re: How to determine what started a dashboard reload?

Really nice bit of code Nicole. Thanks for sharing. 

-Rob