I am using a!queryProcessAnalytics for showing 'User tasks report' in grid

Certified Lead Developer

Hi,
I am using a!queryProcessAnalytics for showing 'User tasks report' in grid. I followed all the steps given in SAIL Recipes(forum.appian.com/.../SAIL_Recipes.html .
The only thing which I added extra is, I am using 'contextProcessModels' attribute for process model context. but irrespective of what value I have for contextProcessModels attribute it always shows the same data in report.

below is my code snippet for queryProcessAnalytics

local!report: a!queryProcessAnalytics(
report: cons!UC_TASKS_FOR_USER_REPORT,
contextProcessModels: cons!SMS_ADD_STUDENT_PROCESS_MODEL,
query: a!query(
pagingInfo: local!pagingInfo
)
)
          
Thanks
Ajinkya

OriginalPostID-174579

  Discussion posts and replies are publicly visible

Parents
  • @ajinkya bhai Correct, to the best of my knowledge, the new addition i.e. contextProcessModels shouldn't make any difference. Because the report you have chosen, Task per User, has a context of its own, i.e. the report has the user as a context.

    So even if you make use of other arguments such as contextProcessModels, contextGroups they won't make any impact on your query and I guess that's an expected behavior because the report object constructed by you wouldn't be able to recognise any context other than User.

    Thumb rule is, you should be always passing the context to the report based on its category. Processes per Process Model expects process model(s) as context, Tasks per Group expects Group as context and so on.

    And re the solution, to work around this as per the experience I have so far is:
    1. Add a new column of type Number Integer in the report and configure its value as pm!id, you may call it as Process Model Id.
    2. And make use of the query filter in the queryProcessAnalytics as follows:

    a!queryProcessAnalytics(
    report: cons!UC_TASKS_FOR_USER_REPORT,
    query: a!query(
    pagingInfo: local!pagingInfo,
    logicalExpression: a!queryLogicalExpression(
    operator: "AND",
    filters: {
    a!queryFilter(field: "c2", operator: "in", value: {cons!SMS_ADD_STUDENT_PROCESS_MODEL}),
    /*
    \ tLet's say 'c2' represents the new column of type integer configured in your report which holds the value pm!id
    \ tcons!SMS_ADD_STUDENT_PROCESS_MODEL auto boxes to integer and your report will be filtered\t
    \ t*/
    }
    )
    )
    )

    I hope that gives you leads over the issue. Still if you have any questions or issues or concerns feel free to reach out to me bhai. :)
Reply
  • @ajinkya bhai Correct, to the best of my knowledge, the new addition i.e. contextProcessModels shouldn't make any difference. Because the report you have chosen, Task per User, has a context of its own, i.e. the report has the user as a context.

    So even if you make use of other arguments such as contextProcessModels, contextGroups they won't make any impact on your query and I guess that's an expected behavior because the report object constructed by you wouldn't be able to recognise any context other than User.

    Thumb rule is, you should be always passing the context to the report based on its category. Processes per Process Model expects process model(s) as context, Tasks per Group expects Group as context and so on.

    And re the solution, to work around this as per the experience I have so far is:
    1. Add a new column of type Number Integer in the report and configure its value as pm!id, you may call it as Process Model Id.
    2. And make use of the query filter in the queryProcessAnalytics as follows:

    a!queryProcessAnalytics(
    report: cons!UC_TASKS_FOR_USER_REPORT,
    query: a!query(
    pagingInfo: local!pagingInfo,
    logicalExpression: a!queryLogicalExpression(
    operator: "AND",
    filters: {
    a!queryFilter(field: "c2", operator: "in", value: {cons!SMS_ADD_STUDENT_PROCESS_MODEL}),
    /*
    \ tLet's say 'c2' represents the new column of type integer configured in your report which holds the value pm!id
    \ tcons!SMS_ADD_STUDENT_PROCESS_MODEL auto boxes to integer and your report will be filtered\t
    \ t*/
    }
    )
    )
    )

    I hope that gives you leads over the issue. Still if you have any questions or issues or concerns feel free to reach out to me bhai. :)
Children
No Data