Why Appian process report has data, but when I query it from expression rule using queryProcessAnalytics it returned no data

Certified Associate Developer

Hi everyone,

I'm having this issue and trying to find some help/ recommendation. 

I'm having this process report that contain 1 row of data. But when I run the expression rule to query it with 2 different user account, I get different results, even though the 2 accounts are in same All Users group and that group has Viewer level security in my report. 

With my main user account, when I run the query I get that 1 row of data back as output - expected

With my test account, I get null value as output - Even though when I open the report I can still see data displayed. 

Is there any other areas apart from security level that I should look at? 

This is my code snippet, I just input in the context process model and report

if(
  ri!isMissingMinimumInputs,
  if(
    ri!doReturnData,
    {},
    a!dataSubset()
  ),
  a!localVariables(
    local!columnConfigs: if(
      not(rule!GBL_isEmpty(ri!columnConfigs)),
      ri!columnConfigs,
      a!queryProcessAnalytics(
        report: ri!report,
        contextGroups: ri!contextGroups,
        contextProcessIds: ri!contextProcessIds,
        contextProcessModels: ri!contextProcessModels,
        contextUsers: ri!contextUsers,
        query: a!query(
          pagingInfo: a!pagingInfo(1,0)
        )
      ).columnConfigs
    ),
    local!filter: if(
      rule!GBL_isEmpty(ri!filter.field),
      null,
      updatedictionary(
        ri!filter,
        {
          field: displayValue(
            ri!filter.field,
            local!columnConfigs.label,
            local!columnConfigs.field,
            ri!filter.field
          )
        }
      )
    ),
    local!pagingInfo: if(
      rule!GBL_isEmpty(ri!pagingInfo),
      a!pagingInfo(
        startIndex: 1,
        batchSize: cons!GBL_VAL_DEFAULT_QUERY_BATCH_SIZE
      ),
      a!pagingInfo(
        startIndex: ri!pagingInfo.startIndex,
        batchSize: ri!pagingInfo.batchSize,
        sort: if(
          rule!GBL_isEmpty(ri!pagingInfo.sort),
          ri!pagingInfo.sort,
          a!sortInfo(
            /* Hijack pagingInfo sort field from the user-facing label ("label") 
            to the code recognized by the process report ("field") */
            field: rule!GBL_indexWhere(
              value: ri!pagingInfo.sort.field,
              initialArray: local!columnConfigs.label,
              finalArray: local!columnConfigs.field
            ),
            ascending: ri!pagingInfo.sort.ascending
          )
        )
      )
    ),
    local!portalDs: a!refreshVariable(
      value: a!queryProcessAnalytics(
        report: ri!report,
        contextGroups: ri!contextGroups,
        contextProcessIds: ri!contextProcessIds,
        contextProcessModels: ri!contextProcessModels,
        contextUsers: ri!contextUsers,
        query: a!query(
          logicalExpression: ri!logicalExpression,
          filter: local!filter,
          pagingInfo: local!pagingInfo
        )
      ),
      refreshAlways: true
    ),
    local!ds: a!dataSubset(
      startIndex: local!portalDs.startIndex,
      batchSize: local!portalDs.batchSize,
      sort: ri!pagingInfo.sort,
      totalCount: local!portalDs.totalCount,
      identifiers: local!portalDs.identifiers,
      data: a!forEach(
        local!portalDs.data,
        a!localVariables(
          local!thisRow: fv!item,
          createdictionary(
            keys: local!columnConfigs.label,
            values: a!forEach(
              local!columnConfigs,
              index(local!thisRow, fv!item.field, {})
            )
          )
        )
      )
    ),
    if(
      ri!doReturnData,
      index(local!ds,"data",{}),
      local!ds
    )
    /*local!ds*/
    /*local!portalDs*/
    /*local!columnConfigs*/
    /*local!filters*/
  )
)

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Did you test your report using plain a!queryProcessAnalytics?

  • 0
    Certified Lead Developer
    in reply to Linh

    Are you experienced in using process reports?

    We need all details. What type of report is this, which context. 

  • 0
    Certified Associate Developer
    in reply to Stefan Helzle

    This is a process based report (collecting data from executed process model, there is only 1 process it based on and I have already add my test account group in as viewer). In the report I have set security level for admin and viewers (my test account member of viewer group). 

    The test account can see data in the report when opening it. But when I run the queryProcessAnalytics I cannot see any result return (I did not add any filter). 

    The code I used for query is mentioned below in code snip, and the 2 rule inputs I provide data are ri!contextProcessModel and ri!report. 

    a!localVariables(
        local!columnConfigs: if(
          not(rule!GBL_isEmpty(ri!columnConfigs)),
          ri!columnConfigs,
          a!queryProcessAnalytics(
            report: ri!report,
            contextGroups: ri!contextGroups,
            contextProcessIds: ri!contextProcessIds,
            contextProcessModels: ri!contextProcessModels,
            contextUsers: ri!contextUsers,
            query: a!query(
              pagingInfo: a!pagingInfo(1,0)
            )
          ).columnConfigs
        ),
        local!filter: if(
          rule!GBL_isEmpty(ri!filter.field),
          null,
          updatedictionary(
            ri!filter,
            {
              field: displayValue(
                ri!filter.field,
                local!columnConfigs.label,
                local!columnConfigs.field,
                ri!filter.field
              )
            }
          )
        ),
        local!pagingInfo: if(
          rule!GBL_isEmpty(ri!pagingInfo),
          a!pagingInfo(
            startIndex: 1,
            batchSize: cons!GBL_VAL_DEFAULT_QUERY_BATCH_SIZE
          ),
          a!pagingInfo(
            startIndex: ri!pagingInfo.startIndex,
            batchSize: ri!pagingInfo.batchSize,
            sort: if(
              rule!GBL_isEmpty(ri!pagingInfo.sort),
              ri!pagingInfo.sort,
              a!sortInfo(
                /* Hijack pagingInfo sort field from the user-facing label ("label") 
                to the code recognized by the process report ("field") */
                field: rule!GBL_indexWhere(
                  value: ri!pagingInfo.sort.field,
                  initialArray: local!columnConfigs.label,
                  finalArray: local!columnConfigs.field
                ),
                ascending: ri!pagingInfo.sort.ascending
              )
            )
          )
        ),
        local!portalDs: a!refreshVariable(
          value: a!queryProcessAnalytics(
            report: ri!report,
            contextGroups: ri!contextGroups,
            contextProcessIds: ri!contextProcessIds,
            contextProcessModels: ri!contextProcessModels,
            contextUsers: ri!contextUsers,
            query: a!query(
              logicalExpression: ri!logicalExpression,
              filter: local!filter,
              pagingInfo: local!pagingInfo
            )
          ),
          refreshAlways: true
        ),
        local!ds: a!dataSubset(
          startIndex: local!portalDs.startIndex,
          batchSize: local!portalDs.batchSize,
          sort: ri!pagingInfo.sort,
          totalCount: local!portalDs.totalCount,
          identifiers: local!portalDs.identifiers,
          data: a!forEach(
            local!portalDs.data,
            a!localVariables(
              local!thisRow: fv!item,
              createdictionary(
                keys: local!columnConfigs.label,
                values: a!forEach(
                  local!columnConfigs,
                  index(local!thisRow, fv!item.field, {})
                )
              )
            )
          )
        ),
        if(
          ri!doReturnData,
          index(local!ds,"data",{}),
          local!ds
        )
    )

    Do you need anything else?

Reply
  • 0
    Certified Associate Developer
    in reply to Stefan Helzle

    This is a process based report (collecting data from executed process model, there is only 1 process it based on and I have already add my test account group in as viewer). In the report I have set security level for admin and viewers (my test account member of viewer group). 

    The test account can see data in the report when opening it. But when I run the queryProcessAnalytics I cannot see any result return (I did not add any filter). 

    The code I used for query is mentioned below in code snip, and the 2 rule inputs I provide data are ri!contextProcessModel and ri!report. 

    a!localVariables(
        local!columnConfigs: if(
          not(rule!GBL_isEmpty(ri!columnConfigs)),
          ri!columnConfigs,
          a!queryProcessAnalytics(
            report: ri!report,
            contextGroups: ri!contextGroups,
            contextProcessIds: ri!contextProcessIds,
            contextProcessModels: ri!contextProcessModels,
            contextUsers: ri!contextUsers,
            query: a!query(
              pagingInfo: a!pagingInfo(1,0)
            )
          ).columnConfigs
        ),
        local!filter: if(
          rule!GBL_isEmpty(ri!filter.field),
          null,
          updatedictionary(
            ri!filter,
            {
              field: displayValue(
                ri!filter.field,
                local!columnConfigs.label,
                local!columnConfigs.field,
                ri!filter.field
              )
            }
          )
        ),
        local!pagingInfo: if(
          rule!GBL_isEmpty(ri!pagingInfo),
          a!pagingInfo(
            startIndex: 1,
            batchSize: cons!GBL_VAL_DEFAULT_QUERY_BATCH_SIZE
          ),
          a!pagingInfo(
            startIndex: ri!pagingInfo.startIndex,
            batchSize: ri!pagingInfo.batchSize,
            sort: if(
              rule!GBL_isEmpty(ri!pagingInfo.sort),
              ri!pagingInfo.sort,
              a!sortInfo(
                /* Hijack pagingInfo sort field from the user-facing label ("label") 
                to the code recognized by the process report ("field") */
                field: rule!GBL_indexWhere(
                  value: ri!pagingInfo.sort.field,
                  initialArray: local!columnConfigs.label,
                  finalArray: local!columnConfigs.field
                ),
                ascending: ri!pagingInfo.sort.ascending
              )
            )
          )
        ),
        local!portalDs: a!refreshVariable(
          value: a!queryProcessAnalytics(
            report: ri!report,
            contextGroups: ri!contextGroups,
            contextProcessIds: ri!contextProcessIds,
            contextProcessModels: ri!contextProcessModels,
            contextUsers: ri!contextUsers,
            query: a!query(
              logicalExpression: ri!logicalExpression,
              filter: local!filter,
              pagingInfo: local!pagingInfo
            )
          ),
          refreshAlways: true
        ),
        local!ds: a!dataSubset(
          startIndex: local!portalDs.startIndex,
          batchSize: local!portalDs.batchSize,
          sort: ri!pagingInfo.sort,
          totalCount: local!portalDs.totalCount,
          identifiers: local!portalDs.identifiers,
          data: a!forEach(
            local!portalDs.data,
            a!localVariables(
              local!thisRow: fv!item,
              createdictionary(
                keys: local!columnConfigs.label,
                values: a!forEach(
                  local!columnConfigs,
                  index(local!thisRow, fv!item.field, {})
                )
              )
            )
          )
        ),
        if(
          ri!doReturnData,
          index(local!ds,"data",{}),
          local!ds
        )
    )

    Do you need anything else?

Children