Run the Template App in Delta Mode |
Scroll Previous Topic Top Next Topic More |
In a productive environment with high requirements on reload times, a complete reload of the MPM Template App might be too slow. Therefore, the MPM Template App offers a delta mode where only fresh data is loaded and added to the previously created complete data model.
We recommend to trigger a full reload in a regular manner, e.g. overnight to ensure data quality in case of failing relaod tasks in the qlik sense environment. |
1.Open the tab 0. Init.
2.Load the MPM Template App in normal mode by setting the variable mvDeltaLoad to 0 and setting the mvStoreMPMModelQVD to 1.
Let mvDeltaLoad = 0;
Let mvStoreMPMModelQVD = 1;
It is neccessary to store the complete MPM data model before starting a delta load. |
3.Open the tab 0. Init again.
4.Set the variable mvDeltaLoad to 1 to set the template app to delta mode - it is set to 0 if delta mode is disabled.
Let mvDeltaLoad = 1;
5.Go to the tab 1B. Load Delta EventLog behind 0. Init and before the "1C. Load EventLog" tab.
6.Create a delta log with the actual event data that you would like to add to the existing data in the MPM Template App.
7.Load the DeltaLog equally to the EventLog-load that you have defined in the tab "1c. Load EventLog" by adapting the template below. Please note, that a field ActivityKey is obligatory. This field serves as unique event identifier in the delta logic.
To detect if events are already loaded to the MPM data model by a former reload, you need to create a unique activity key. In the example given below an identifier with CaseID, ActivityStartTimestamp and ActivityName is sufficient. In other cases different id-criteria might be necessary to uniquely identify one event. |
DeltaLog: //Delta Log table name: "Deltalog"
load
//ProcessAnalyzer information
CaseID,
CaseID & '_' & Timestamp(ActivityStartTimestamp) & '_' & "ActivityName" as ActivityKey,
"ActivityName" as ActivityType,
AutoNumber(ActivityName) + 100 as ActivityTypeID,
Timestamp(ActivityStartTimestamp) as ActivityStartTimestamp,
Timestamp(ActivityEndTimestamp) as ActivityEndTimestamp,
null() as SortingColumn,
//Event information
//Here you can add other event-related information (dimensions and values)
UserName as ActivityUserName,
if(WildMatch("UserName", 'Value 6'), 0, 1) as RealUser, //delete if no user avaiable
EventDimension1, //EventDimension1
EventDimension2, //EventDimension2
EventDimension3 //EventDimension3
FROM [$(DataConnection)DeltaLog.qvd] (qvd)
where len(ActivityName) > 1;
8.Adapt the variable mvUniqueEventKey: this key is unique for an event and has to match the ActivityKey created in the delta log if the event is part of the delta load and has been loaded before in another delta load or by the full load. The statement has to be a valid load-logic for the pa_activity_log that already exists within the MPM Template App.
// define a unique key for activities, so that updates from the delta log can be made on existing activities
Set mvUniqueEventKey = CaseID & '_' & ActivityStartTimestamp & '_' & 'ActivityType';
9.Fill in the delta case information table template by writing the same logic as in the tab "1c. Load EventLog". The delta case information will be concatenated to the case information from before.
concatenate (CaseInformation) load
CaseID,
CaseDimension1,
CaseDimension2,
CaseDimension3
FROM [$(DataConnection)DeltaLog.qvd] (qvd);
10.Once you completed the 9 steps, click on load data.
11.If the data load was successful, created automated reload tasks in the Qlik Management Console (QMC).
12.Recommendation: Trigger a full reload on a regular basis by providing another MPM Template App without delta-mode which created a complete data model.