I have inserted the following piece of code in order to show always the updated number of available tasks to the users.
=a!localVariables( local!report: a!refreshVariable( value: a!queryProcessAnalytics( report: cons!IOC_USER_TASK_REPORT, contextProcessModels: { cons!IOC_PROCESS_MODEL_NOTIFICATIONS }, query: a!query( pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 1000), filter: a!queryFilter( field: "c1", operator: "<>", value: 2 ) ) ), refreshInterval: 0.5), "Workflows (" & length( local!report.data ) & ")")
=a!localVariables(
local!report: a!refreshVariable(
value: a!queryProcessAnalytics(
report: cons!IOC_USER_TASK_REPORT,
contextProcessModels: {
cons!IOC_PROCESS_MODEL_NOTIFICATIONS
},
query: a!query(
pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 1000),
filter: a!queryFilter(
field: "c1",
operator: "<>",
value: 2
)
),
refreshInterval: 0.5
"Workflows (" & length(
local!report.data
) & ")"
Sadly enough, the automatic refreshing is not working at all. Is this an expected behavior or there is something wrong with this code?
I am running on Appian Cloud 19.2
Discussion posts and replies are publicly visible
2 things:
Hi Mike,
Thanks for the info.
Could you please post sample code snippet for the 2nd point you mentioned?
Thanks in advance.
Rajesh Mahenderkar - here you go. In this example, the auto-refreshing variable (when it's the first/only one) will never auto-refresh. However if you un-comment the commented-out "override" local variable above it, and press "test" to start fresh, it will work as expected.
a!localVariables( /* local!override: "testing", */ local!firstVariable: a!refreshVariable( value: now(), refreshInterval: 0.5 /* will never refresh unless/until the local!override variable is un-commented. */ ), a!formLayout( label: "Variable AutoRefresh Test", contents: { a!textField( label: "RefreshTime", readonly: true(), value: text(local!firstVariable, "yyyy/mm/dd hh:mm:ss"), ) } ) )
This does not work
a!localVariables( local!startTime: now(), local!lastUpdated: a!refreshVariable( value: now(), refreshInterval: 0.5 ), { a!textField( label: "Last Updated", value: local!startTime, readOnly: true ), a!textField( label: "Last Updated", value: local!lastUpdated, readOnly: true ) } )
This does work
a!localVariables( local!fixAppianBrokenFunctionality: "Please", local!startTime: now(), local!lastUpdated: a!refreshVariable( value: now(), refreshInterval: 0.5 ), { a!textField( label: "Start Time", value: local!startTime, readOnly: true ), a!textField( label: "Last Updated", value: local!lastUpdated, readOnly: true ) } )
So having a first order local var that is referencing text seems to work whereas referencing now() does not.
Interesting, thanks for making the distinction - I didn't realize that the behavior was different depending on the data type of the initial local variable - I obviously didn't test that robustly after discovering the bug ;-)
I'm also noticing that once a button is pressed on form (even though it doesn't submit the form) the interval refresh variables seem to stop working.
Interesting... under what conditions? I just added a buttonWidget to basically the same test form as linked above (it doesn't save into anything but is clickable), and for me at least the autorefresh does continue happening correctly. But you might be doing something differently.
Yep, I encountered the same issue...