Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Feb 14, 2023 4:44:16 AM
Sep 21, 2021 5:26:28 AM
Some of the QlikView users should remember the Loop and Reduce functionality. It has been made available in Qlik Sense only through the use of API calls, which scared quite a few people uncomfortable with anything but the GUI. That was until the arrival of Qlik Application Automation which turns it in a piece of cake for everyone.
You can find other two articles on the Loop and Reduce block, they both are linked on the bottom of this page. Unlike the mentioned article, this solution will use only one dynaminc automation to process any application made or to come
We want any App with a master item DIMENSION having a specific TAG, will be splitted on that dimension. This will happen on every reload event. Moreover we also want to have the chance to drive the publish action on a specific space id.
From your tenant web hub:
We want to trigger this automation every time an app is reloaded. In the Start Block select:
The Loop and Reduce process produce several applications, and we don't want to pollute the personal space, for this reason, we want to move all of them to a separated space.
From the Qlik Cloud Service Connector drag the List Variables into the canvas and attach it to the start block. Fill the App Id with the app id coming from the start block:
App Reload Finished > Data > Id
This block will return all the variables in the app, we are going to use it later to catch the target space id.
We expect to see a special TAG named LR on a Dimension, in order to proceed in the loop and reduce process.
Now let's start the loop over all the Dimensions. From the left-hand side menu select Qlik Cloud Service and then drag the List Dimensions block just out of the List Variables loop. Fill the App Id fields with the reloaded app id coming from the start block:
App Reload Finished > Data > Id
List Dimension will loop over all dimensions in the reloaded app. For each dimension we want to check if there is the tag named LR. From the basic block, drag the condition block in the List Dimensions loop. We want to check if the Tags Array contain the TAG named LR.
In the first box set List Dimensions > Itam > Q Meta > Tags , then select Contain and in the last box type LR.
In case we found it we are ready to trigger the Loop And Reduce block, you can find it under the Qlik Cloud Service Connector. Fill the App Id field with the application id coming from the start block.
App Reload Finished > Data > Id
And fill the Reduction Field with the Dimension Title name
List Dimensions > Item > Q Meta > Title
The Loop And Reduce block create slices of the original application and export them with an Id. At this point we can re-import it in a different location and with a different name, for this work we need the Import App From Export Id block, you can find it in the Qlik Cloud Service Connector.
Fill in the fields as follow:
For the Space Id, click on the listVariables block, select the qDefinition then the below windows will appear. Select the last option and pick the value when the qName is equal to TargetSpace
In case the TargetSpace variable does not exist in the app, the reduced app will be generated in the personal space.
Open the App you want to reduce and create a new dimension. In this example the dimension is a simple field mapping, but you can use Qlik functions to build a complex field combination. You just need to add the TAG LR on the dimension you want to use for the Loop and Reduce.
If you want all the reduced apps to be collected in a space different from your Personal space, it is enough to add a new variable with the name "TargetSpace" and set it to the space Id.
As usual, you can follow the above steps to get your automation done or you can just import it from the Automation JSON definition attached in this article.
The information in this article is provided as-is and to be used at own discretion. Depending on tool(s) used, customization(s), and/or other factors ongoing support on the solution below may not be provided by Qlik Support.