Fetch a column from the reports

Hi,

I need to fetch a column details from a Report by passing processId and a variable which specifies the environment.

"queryProcessAnalytics" to fetch the details doesn't seem to work.

Any idea on this?

Thanks in advance,
Nimisha.

OriginalPostID-232179

  Discussion posts and replies are publicly visible

  • Please elaborate the issue..
    Why do you need to specify environment? Are you looking to utilize multiple Appian boxes for this?
    If for process instance details, you can create a new column in your process report that displays process ids, fetch querydatasubset from 'querProcessAnalytics' and index the data on process ids..
    Hope it helps!
  • Looks to be the way you created ur process report might be wrong. Check in the include subprocess data check box
    Create Process by Process Model and pass all the process model as Context
    If not variable will not hold the data properly and remains null

    Pass all the PM (contexts) in QPA and Process Report as well
  • @Tajinder - I have taken the same steps suggested by you, but while I input ID's I see null returning. without processID I see everything returned as a subset
  • Hi @nimishan - In that case, it looks to be some configuration isssue with your processid column on your report your are querying which might not be bringing any data. If you can somehow put your code relevant that pulls in your data from the report using a!queryprocessanalytics along with the structure (Sequence wise columns present on the report) - that would probably be helpful for me and other practitioners to review.

    Thanks !
  • Yes, you are right. When I input the below query I see the error thrown as displayed below

    a!queryProcessAnalytics(
    report: cons!Report_Fetch,
    contextProcessIds: tostring(536871599) (is of type Text in the report),
    query: a!query(
    pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: -1
    ))
    )

    O/P
    [startIndex=0, batchSize=0, sort=, totalCount=0, data=, identifiers=, name=Category Fetch Exception, description=, columnConfigs=, errorMessage=Empty context passed in for report Category Fetch Exception [id=13295]. (APNX-1-4156-000)]

  • If your report is based on a process model (I'm assuming it is), you'll need to use contextProcessModels and pass in the model for which the reports should run, and then use the process ID in the filter element of the a!query(), filtering on whatever the field name for the process ID is.
  • @nimishan I would like to let you know few things which might help you in recognising the reason of error:

    1. You are making use of the contextProcessIds, this means that you are using the context is already available and you don't need any additional column that holds processId. So you don't need to really care about the type of the process Id your process is holding as the queryprocessAnalytics by default identifies the record in the Report with the help of contextProcessIds even though there isn't any column in your report that holds processId and an additional column in the report isn't needed at all.

    2. contextProcessIds is of type Integer array. So it's better not to send string values to it. I hope you are aware of this, you can pass an integer value to the string and get the code working but the vice versa is not true and also the way you are passing the value creates an exception and throws an error saying that you are lacking the context. So there isn't a need to apply fn!tostring() function here when you are making use of contextProcessIds argument. Ex: contextProcessIds: {536871599,536871598}

    3. What's the category of your report? If it is process based, you can straight away pass the processIds, i.e. contextProcessIds: {536871599,536871598}. If the report's context is process model based, make use of the contextProcessModels argument and filter the processes by making by use of a!query() as said by @philb.