Skip to main content
July 14, 2023
Question

queryProcessAnalytics with Refresh Interval

  • July 14, 2023
  • 6 replies
  • 0 views

Hello All,

We need to show the generated docs in the interface, and if there is any error in the document generation need to show an error to the user.

Document creation takes time so we created the PM to generate the document and used the process report for the generate document process model.

We are using queryProcessAnalytics in the interface with a refresh variable to check the "generate document" process status.

We need to stop re-querying the queryProcessAnalytics if any error is received from the process report, used the below code to achieve this.

local!processReportData:

a!refreshVariable(

value: if(

true(), /*Some conditions*/
a!queryProcessAnalytics(
report: <<process report>>,
contextProcessModels: <<process model to be checked>>
query: a!query(
/*
c1 - processStatus (1=Completed)
c3 - process Id
c6 - errorMessage
*/
logicalExpression: a!queryLogicalExpression(
operator: "AND",
filters: a!queryFilter(
field: "c3",
operator: "=",
value: ri!reportProcessId
)
),
pagingInfo: a!pagingInfo(1, 1)
)
).data,
null
),
refreshInterval: if(
or(
isnull(fv!value),
tointeger(tostring(index(fv!value, "c1", 0))) = 1,
not(
rule!Empty(tostring(index(fv!value, "c6", null)))
)
),
null,
0.5
)
)

all the refresh interval conditions are true and it should not execute the queryProcessAnalytics but it is not happening and local!processReportData is getting refreshed.

Please let me know if anyone tried to stop refreshing the queryProcessAnalytics with a refresh interval.

Thank You,

Sneha.

    6 replies

    July 14, 2023

    Thank you Stefan for the response.

    We are also stopping the refresh based on the variable returned from the process report but wondering why it's refreshing the process report even refresh interval is null.

    stefanhelzle0001
    Brainy
    July 14, 2023

    Is that refresh then still in an interval, or on user interaction? Are you aware that the parameter refreshOnReferencedVarChange is set to true by default?

    ignacio.moran
    July 17, 2023

    Hi Sneha, 

    What I see is that your value for the IF() inside the local!processReportData value is always true(), the you will always query the process report.

    What I would do is: 

    • Create a local variable (for example, local!refresher) that refreshes every 0.5 minutes which value is an if() statement, if(variable from process report = whatever, null, true).
    • Then the local!processReportData should be also an if() statement, if(local!refresher, a!queryProcessReport, null), refreshOnReferencedVarChange: local!refresher.
    July 18, 2023

    Thank you for the response.

    Yes "IF" condition is true and I assumed process report data will not refresh as the refresh interval condition is false.

    Let me try this approach. Thank You