Skip to main content
August 10, 2021
Question

Data Caching

  • August 10, 2021
  • 4 replies
  • 1 view

Background: In my application there is a simple paging feature that utilizes a server side application to retrieve data for each page of a grid that needs looked at. Upon receiving a response from the server, the onSuccess callback of the startProcess function that is called will use an expression rule which matches the data returned with data found in a view on the appian cloud db. This matching is done in order to alter one column of the data to fill it in with task Ids when one is found in the db for the given data row.

Problem: Creating a new task works great and a task Id will show properly in the grid. Paging works great and existing task Ids will show properly. The issue is found when a user creates a task, navigates to a previous page, and then returns to the page where the task Id was. In this case the task Id will not be found.

Walkthrough:

Scenario 1
Navigate to page 3, making previous page page 2
create task, task Id shows
navigate to page 2
navigate to page 3
task Id is gone.

Scenario 2
Navigate to page 3, then page 2, making previous page page 3
create task, task Id shows
navigate to page 3
navigate to page 2
task Id is gone.

My suspicion is that the use of queryEntity with the same parameters is caching the original output of the query that is used to match server side data with task data in appian. I'm thinking this because of the documentation found here but I'm not sure. a!queryEntity() Function - Appian 21.2

Any insight or advice here would be great. Thanks in advance.

    4 replies

    selvakumark
    Participating Frequently
    August 11, 2021

    Hi [mention:32a14c6717b444389349bc40a7c978e9:e9ed411860ed4f2ba0265705b8793d05],

    I think the issue resides in how we query the data while paging and not with the a!queryEntity() function. In the paging save into, are we executing the query to fetch the task Ids from DB? Could you please share the code here?

    stefanhelzle0001
    Brainy
    August 11, 2021

    I assume you use some local variables in your expression. When you call an expression inside the same interface multiple times, by default the local variable value is not evaluated again. To achieve this, you might want to use a!refreshVariable() and set refreshAlways to true.

    This is only relevant for cases where the user stays in the same top-level interface.

    peter.lewis
    Employee
    August 11, 2021

    Also if you don't want to always refresh, you can create a dummy variable that you only update on page changes (usually I just keep incrementing this variable by 1). Then, you can use the "refreshOnVarChange" parameter in a!refreshVariable() to only refresh withen this variable changes.