How can I filter this report with user name?

I am using below recipe to create a SAIL report. How can I filter this report with user name? Please note that I have added a column "Assign To" in the portal report that display's tp!owner information. I was able to add the user picker to the below recipe, but I am unable to filter the grid based on user that is being selected by the user picker control object.

forum.appian.com/.../SAIL_Recipes.html
Thank you for your help in advance!

OriginalPostID-147970

OriginalPostID-147970

  Discussion posts and replies are publicly visible

  • Does it show all the tasks for all the users ? Or just for the logged in user ?

    If this is the case then the issue might be around recipe step#4, while creating the portal task report you have "4. Select the Tasks by owner context type, type in your username, and click Next" . I think basic report itself is filtered for the username specified here.
  • The portal report shows all the tasks for a single process model. It displays the user id (tp!owner) in the "Assign To" column of the grid. I would like to filter the grid with a user picker on top of the grid. How can I add this filtering capability to the recipe code? Thanks!
  • Hi zulfiqarp Though I haven't seen the recipe, here goes a few simple steps to add single query filter while querying the process analytics as desired by you:

    Step - 1: Execute the a!queryProcessAnalytics() (with/without filters).
    Ex: a!queryProcessAnalytics(
    report: <your report>,
    contextGroups: {},
    contextProcessIds: {},
    contextProcessModels: {
    <your process model>
    },
    contextUsers: {},
    query: a!query(
    logicalExpression: null,
    pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 1
    )
    )
    )

    Step - 2: Observe the 'columnConfigs' attribute from the output obtained from Step - 1. Identify the desired field which you want to apply the filter on.

    For instance, [label:Owner,field:c3,drilldownField:dp3,configuredFormatting:NUMBER,configuredDrilldown:]; where label is the name of column in report and 'c3' is the corresponding field name which you should apply filter on.

    Step - 3: Build a query filter from the field identified in Step - 2 and a value desired by you. You can reflect the same structure in the logicalExpression parameter of a!queryProcessAnalytics() or you can save the following into a local variable when you select a user from pick list.

    Example: a!queryFilter(
    field: "c3",
    operator: "=",
    value: local!selectedUser
    )

    Step - 4: Integrate the Step - 3 in a!queryProcessAnalytics definition on conditional basis.

    Example:
    a!queryProcessAnalytics(
    report: <your report>,
    contextGroups: {},
    contextProcessIds: {},
    contextProcessModels: {
    <your process model>
    },
    contextUsers: {},
    query: a!query(
    logicalExpression: if(
                                                                          rule!APN_isEmpty(local!selectedUser),
                                                                          null,
                                                                          a!queryFilter(
                                                                                    field: "c3",
                                                                                    operator: "=",
                                                                                    value: local!selectedUser
                                                                          )
                                                                ),
    pagingInfo: a!pagingInfo(
                                                                startIndex: 1,
                                                                batchSize: -1
                                             )
    )
    )

    Please do let me know if you have any follow up questions.
  • How do I know the name of field for which I am applying filter because it is created in Portal report? Please note that in my portal report I am using "Assign To" as Display Name, Definition is "tp!owner" and Formatting is "User Name" for the column on which I am applying this filter.
    Thanks!
  • @zulfiqarp No issues, Refer the Step - 2 specified above and observe the columnConfigs array from the results of the queryProcessAnalytics function.

    You might have a row similar to this in the columnConfigs array: [label:Assign To,field:c4,drilldownField:dp4,configuredFormatting:USER_NAME,configuredDrilldown:] where the field and drilldownField changes in your results. The value of the 'field' is the column which you need to apply filter on.
  • So based on my portal report column setting of Assign to (Definition is "tp!owner", Display Name is "Assign To" and Formatting is "User Name"), what is the field name? Sorry to be creating confusion. I really appreciate your help. On a different note, is c4 is the name of the column or fourth column of the data that you are retrieving from queryprocessanalytics?
  • No worries, feel free to ask as many questions as you want. As you are bit confused in identifying the field name, I would like to rephrase my explanation as follows:

    First of all, execute the step - 1 as specified above. This returns you an output. Now observe the value of columnConfigs in this output.
    This columnConfigs is nothing but the array of the columns in your portal report. If we look at the Appian report, we will be able to say what column does what. But when a!queryProcessAnalytics gets us the data, it helps us in identifying the each column by providing the attributes of each column(name of the column, field of the column etc) in the columnConfigs array.

    So every column in the portal report is identified by a!queryProcessAnalytics as c1, c2... and so on.

    That's the reason why we use the same in queryFilter as well. Similarly in order to access a column in final output, for ex. we read a field 'c1' in the final output as index(<datasubset_variable>.data,"c1",null).
  • In order to answer your other question, c4 may not be necessarily the 4th column. Here is my analysis so far regarding this order:
    >> Appian goes on incrementing the id in the report as and when you add columns. For ex, if your report already has 4 rows Appian already generates keys as follows: c1, c2, c3, c4
    Though you move the columns up and down in report configurations, Appian helps us identifying the columns with the help of the assigned unique id. So the column c4 can be at any place in the report, but the way you access it (i.e. by using 'c4' for ex.) will help Appian in identifying the right column.
    >> Now let's assume that you have added a 5th column. Appian assigns 'c5' to the new column.
    >> Now let's assume that you have deleted the newly added 5th column and added one more column. Appian assigns 'c6' to the new column. From this we can infer that Appian assigns the ids to report columns similar to auto incremented primary key of a table.
  • Hmmm.... so let me give you a scenario and ask my question again. Lets say you have a portal report in which you have created a column "Assign To" which displays tp!owner information formatted as User Name. After executing step 1 to return an output with array of columns, what is the field name Appian gives to "Assign To" column?