Local variable based on queryEntity not refreshing

Hi,

I have a CDT based on a view I built on the Appian MariaDB database.
An expression rule (say, rule!GetAllData) pulls from the corresponding DSE through a simple queryEntity, retrieving all results.

In an interface, I have a local variable defined as the rule result:

local!data: rule!GetAllData()


I also have a refresh button, with a dynamic link supposed to refresh the content of the variable, via

a!save(local!data, rule!GetAllData())


The weirdest problem happens: when clicking the link, nothing changes. Appian seems to somehow cache the results of the rule. Note that the records in the query differ between refreshes, so Appian maintains cached records that do not exist in the view anymore!
I have verified this from the interface designer, inspecting the value of local!data.

Even this does not solve the problem:

{
  a!save(local!data, null),
  a!save(local!data, rule!GetAllData())
}

Even if I comment out the second line, click the link, verify that local!data is set to null, decomment the second line, click the link, the old "cached" data reappears.
Of course, performing a refresh of the page from the browser works just fine, the new values are pulled from the database.

a!refreshVariable does nothing.

Any ideas for debugging this?
My only "reasonable" guess is that somehow the fact that the CDT is mapped to a manually-defined view messes up the Appian-Hibernate mappings, and Appian is unable to determine that a change has occurred on the DB side, thus thinking it's OK to cache the result. I think and hope that I am mistaken, though.


Thanks in advance.

  Discussion posts and replies are publicly visible

  • +1
    Certified Lead Developer

    My first guess here would be that you need to make sure the local variable is properly set up to refresh.  Can you share any further detail about how "rule!GetAllData()" is set up?  Also, have you thought about setting up local!data in such a way that it refreshes on button click without having to manually save a new query result back into it?  Such as by using the "refreshOnVarChange" parameter in a!refreshVariable()?

  • Thank you for the suggestion of looking into the expression rule.
    I was treating it as a "black box" performing the query, but I overlooked the fact that it wasn't a plain wrapper of the queryEntity: it used local variables inside to cast the results of the queryEntity to a CDT.
    I had even a wrong mental model on how these local variables would behave when including the expression rule inside an interface (I believed the entire expression rule would be always re-evaluated "from scratch", as a "function", when in reality the SAIL of the expression rule simply gets substituted in the SAIL of the interface).
    In the end, I set the correct refresh attributes in the local variables inside the expression rule, and now everything is fine.