queryProcessAnalytics with Refresh Interval

Certified Senior Developer

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.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Associate Developer

    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.
  • 0
    Certified Senior Developer
    in reply to Ignacio Morán

    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

Reply Children
No Data