filter is not working on task report data

Certified Lead Developer
I am trying to use work with below snippet, the filter is no applying on process analytics.
With or with out filter is giving me the same result.Here filed "c8" contains Assigned To values for the task(i.e user(s) /group(s)).
Here I am trying retrieve the tasks assigned to particular group /(user),but it is fetching all the tasks.
a!queryProcessAnalytics(
          report:cons!TASK_REPORT,
          query:a!query(
                    filter:a!queryFilter(field:"c8",operator:"includes",value:togroup(876)),
                    pagingInfo:topagingInfo(1,-1)          
          )
)

OriginalPostID-244965

  Discussion posts and replies are publicly visible

Parents
  • @ramanjaneyulut Perfect, I have submitted it for internal review to my employer. If I hear any feedback, I will keep it posted here.
  • I wonder if I could ask a question related to the code shown in PC Search task Assignees.docx.

    I have been attempting to get this to work but have a problem. When I generate the queryFilter as "
    [field=c16, operator=includes, valueExpression=, value=paul_emsley@johnlewis.co.uk]" (ie for a User) it works fine.

    When I generate the queryFilter as "[field=c17, operator=includes, valueExpression=, value=[Group:2920]]" (ie for a Group) it does not work:
    [startIndex=0, batchSize=0, sort=, totalCount=0, data=, identifiers=, name=, description=, columnConfigs=, errorMessage=There was an error querying the Analytics report. (APNX-1-4275-000)]

    I can't find any documentation about this error. The Appian stdout log shows:
    12:15:26,175 INFO [stdout] (ajp-/0.0.0.0:8009-15) 2017-05-08 12:15:26,173 [ajp-/0.0.0.0:8009-15] ERROR com.appiancorp.expr.server.fn.query.QueryProcessAnalytics - java.lang.Long cannot be cast to java.lang.String
    12:15:26,175 INFO [stdout] (ajp-/0.0.0.0:8009-15) java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String
    12:15:26,175 INFO [stdout] (ajp-/0.0.0.0:8009-15) at com.appiancorp.record.data.bridge.FilterHandler$FilterOperatorIncludes.toSimpleColumnFilter(FilterHandler.java:196)
    12:15:26,175 INFO [stdout] (ajp-/0.0.0.0:8009-15) at com.appiancorp.record.data.bridge.FilterHandler.criteriaToFilters(FilterHandler.java:61)
    12:15:26,175 INFO [stdout] (ajp-/0.0.0.0:8009-15) at com.appiancorp.record.data.bridge.FilterHandler.criteriaToFilters(FilterHandler.java:74)
    12:15:26,175 INFO [stdout] (ajp-/0.0.0.0:8009-15) at com.appiancorp.record.data.bridge.FilterHandler.criteriaToFilters(FilterHandler.java:51)
    12:15:26,175 INFO [stdout] (ajp-/0.0.0.0:8009-15) at com.appiancorp.expr.server.fn.query.QueryProcessAnalyticsValidator.validateAndSetReportFiltersFromQuery(QueryProcessAnalyticsValidator.java:102)

    However, if I use the operator "=" instead of "includes", it works, providing my tasks have a single group assigned. Where I have multiple groups assigned, the filter does not show those tasks. So I need the "includes" to work.

    Any suggestions?
  • ok - I have the solution!

    When building the local variable "groupQueryFilters" I added the function "touniformstring" as shown below, and I am now able to filter tasks with mutiple assignees where one of the assignees matches the filter value.

    local!groupQueryFilters: if(
    rule!APN_isEmpty(local!groups),
    null,
    fn!apply(
    a!queryFilter(
    ri!formattedGroupAssignee_field,
    "includes",
    /*"=",*/
    _
    ),
    fn!touniformstring(union(local!groups,local!groups))
    )
    ),
  • 0
    Certified Senior Developer
    in reply to paule

    @Paule.....I really appreciate your suggestion. It was a lifesaver for me. I also had the same issue where in my case tasks could be assigned to both users or groups (multiple). For some reason users were working and I was struggling with the group piece since yesterday night.

    If it helps someone:

    In my report I have 2 separate colums for assignees:

    1. C29 (Assigned Users) = tostring(touser(task_assignee_owner())) of formatting "Normal Text"
    2. C30 (Assigned Groups) = tostring(togroup(task_assignee_owner())) of formatting "Group Profile"

    Code piece in my queryAnalystics

    if(
    runtimetypeof(ri!assignedTo_usrgrp)=5, /*Check for Groups*/
    apply(
    a!queryFilter(
    field:"c30", operator:"includes", value:_
    ),
    touniformstring(union(togroup(ri!assignedTo_usrgrp),togroup(ri!assignedTo_usrgrp)))
    ),
    {}
    ),
    if(rule!APN_isBlank(ri!assignedTo_usrgrp),{},
    a!queryFilter(
    applyWhen: runtimetypeof(ri!assignedTo_usrgrp)=4, /*Check for Users*/
    field:"c29",
    operator:"includes",
    value:ri!assignedTo_usrgrp))

Reply
  • 0
    Certified Senior Developer
    in reply to paule

    @Paule.....I really appreciate your suggestion. It was a lifesaver for me. I also had the same issue where in my case tasks could be assigned to both users or groups (multiple). For some reason users were working and I was struggling with the group piece since yesterday night.

    If it helps someone:

    In my report I have 2 separate colums for assignees:

    1. C29 (Assigned Users) = tostring(touser(task_assignee_owner())) of formatting "Normal Text"
    2. C30 (Assigned Groups) = tostring(togroup(task_assignee_owner())) of formatting "Group Profile"

    Code piece in my queryAnalystics

    if(
    runtimetypeof(ri!assignedTo_usrgrp)=5, /*Check for Groups*/
    apply(
    a!queryFilter(
    field:"c30", operator:"includes", value:_
    ),
    touniformstring(union(togroup(ri!assignedTo_usrgrp),togroup(ri!assignedTo_usrgrp)))
    ),
    {}
    ),
    if(rule!APN_isBlank(ri!assignedTo_usrgrp),{},
    a!queryFilter(
    applyWhen: runtimetypeof(ri!assignedTo_usrgrp)=4, /*Check for Users*/
    field:"c29",
    operator:"includes",
    value:ri!assignedTo_usrgrp))

Children
No Data