Cache Steps
  • Updated on 09 Nov 2015
  • 5 minutes to read
  • Print
  • Dark
    Light

Cache Steps

  • Print
  • Dark
    Light

This tutorial demonstrates how to use Cache Steps in Decisions . With Cache Steps we can store and retrieve some Data values in memory for defined time. In Decisions we are able to define different types of Cache . When we are trying to store some value in Cache , we need to define an Instance of the Cache , its type and a Key to access current Value .
Note: [List] Add Item and [List] Get From Cache steps are explained in the following tutorial: http://documentation.decisions.com/cache-fetch-flow-behavior/
Example:
In this example we are going to use Cache steps to store the values of the selected row on the Report to use this values on the Form .
For this example we created a simple Report on the Northwind Customers database table.
reportCust.png

Next, we are going to create a Flow for the Selected Row. In the Designer Folder we click Create Flow on the Folder Actions Panel.
createFlow.png

In the resulting window we Name the Flow , select Report Selected Row Handler Flow Behavior , and click Create to proceed to the Flow Designer.
createSelectedRowFlow.png

In the Flow Designer we add Put In Cache step from the All Steps [Catalog] > Data > Cache category.
addPutInCache.png

Then, we configure data for this Step as following… Define Constant Cache Instance Name (this can be any name that we want to associate with this cache) . Constant Cache Type Name (this can be either default decisions cache or our custom cache that is defined in the System > Administration > Cache Folder in the Portal).
defaultCaches.png

Constant Key for this Value . Finally, we Select Value that we want to store from the Selected Row Fields . In this step we are going to store CustomerId field that will be accessible by ID key in this Cache Instance.
configureFirstPutInCache.png

Next, we add another Put In Cache step from theAll Steps [Catalog] > Data > Cache category.
addSecondPutInCacheStep.png

We configure this step in the similar manner we configured previous Put In Cache step except this time we define different Key and Value . As a result, we save different Value with different Key in the same Cache .
configuredSecondPutInCache.png

Then, we add another Put In Cache step from the All Steps [Catalog] > Data > Cache category.
addThirdPutInCache.png

Again, we configure this step to store our desirable Value with the Key that we can use to access this Value .
configureThirdPutInCache.png

Finally, we connect steps in our Flow as following. This completes our Cache Flow . We can save the Flow and close Flow Designer.
selectedRowFlowCompleted.png

Then, we are going to create a Flow that will be using Cached values. In the Designer Folder we click Create Flow on the Folder Actions Panel.
createSecondFlow.png

In the resulting window we Name the Flow and click Create to proceed to the Flow Designer.
nameSecondFlow1.png

In the Flow Designer we add Get From Cache Step from the All Steps [Catalog] > Data > Cache category. With this step we can access our cached values.
addGetFromCacheStepFirst.png

We configure this step as following… We define Constant Cache Instance and Type that we created in the first Flow in this tutorial. Then, we define Constant Key of the Value that we need to retrieve from the Cache (in this case it is ID which is a Key for CustomerId value in SelectedCustomer instance of the Default.MemoryCache) . Also, we Rename the Result Value output.
configureFirstGetFromCache.png

Then, we add another Get From Cache Step from theAll Steps [Catalog] > Data > Cache category.
addGetFromCacheSecond.png

We configure this step to get Contact Name Value from the Instance of the Cache that we defined for this tutorial.
configureSecondGetFromCache.png

Next, we add and configure another Get From Cache Step from the All Steps [Catalog] > Data > Cache category. With this step we are going to get Company Name value from our Cache .
configureThirdGetFromCache.png

Then, we add a Show Form step from Favorite Steps category.
addShowForm.png

In the resulting window we Name the Form and click Create to proceed to the Form Designer.
nameForm.png

On this Form we are going to display our Values from Cache . When we finished Form design we can save the Form and close Form Designer.
formDesign.png

Back in the Flow Designer we connect the outcome from the Form Step to the End Step. This completes our Display Flow . We save the Flow and close Flow Designer.
DisplayFlowCompleted.png

Next, we are going to create a Page to display Report and Form . In the Designer Folder we click Create Report/Page > Create Page/Dashboard option on the Folder Actions Panel .
createPage.png{height ="103" width="759"}
In the Page Designer we are going to display our Report with Report Viewer component. We are going to Edit Behavior of the Report Viewer.
reportBehavior.png{height ="704" width="282"}

Using Selected Row Flow picker we select our Flow that stores Values in Cache .
selectFlowForRow.png

Then, with Flow Run Part component we are going to add ourDisplay Flow to the Page . This completes our Page Design . We save our Page and close Page Designer.
addFlowToPage.png

In the Designer Folder we add our Page as a view for the Folder .
displayExistingPage.png

When the Page is displayed, our Form displays values from the first row in the Report .
pageRunsFirst.png

Then, we select different Row on the Report and click Refresh on the Form .
selectRowAndRefresh.png

Our Form reloads and displays new cached values from the current selected row on the Report .
refreshed.png

Cache Steps that are not covered in this tutorial:
Clear Cache: Clear desired Instance in Cache (in this tutorial it would be SelectedCustomer instance of the Default.MemoryCache)
Key Exist In Cache: check if the Instance of the Cache contains the Key (in this tutorial we had ID, CONTACTNAME, and COMPANYNAME keys)
Put In Cache [generated key]: With this step we can put the Value in our Cache and the step generates and outputs a Key to access this value.
Remove Key From Cache: Removes the Value from our Cache instance by Key.

Was this article helpful?