Applying User Picker to Report Sections

Hi All, 

I'm trying to add a User Picker filter that applies to 4 different sections of a report, all of which are backed by different DSE's or Views. It was suggested to me to use the a!pickerFieldUsers field to do this, so in my Dashboard I added this filter:

 

            a!columnLayout(
              contents: {
                a!pickerFieldUsers(
                  label: "Study Monitor",
                  instructions: "Type any study monitor name",
                  labelPosition: "ABOVE",
                  value: local!studymonitor,
                  saveInto: local!studymonitor
                )
              }
            ),

Then for the first Bar Chart I'm trying to apply the filter to, I added the Rule Input of "selectedStudyMonitors" and wanted to compare this value that's fed in from the Filter selections to the "studyMonitor" field of the view that's backing this Chart like this: 

if(
                isNull(
                  ri!selectedStudyMonitors
                ),
                {},
                a!queryFilter(
                  field: "studyMonitor",
                  operator: "includes",
                  value: ri!selectedStudyMonitors
                  
                )
              )

But I'm getting this error below; I originally tried "=" but it didn't like that operator either. I checked that the data values being returned in both interfaces are the User Names, so something like "first.last" or "monitor.one" etc -- they should match/be able to be compared using either = or includes, right? 

Thanks for any help!

  Discussion posts and replies are publicly visible

  • Hi Sarah,
    UserPicker function gets you the username of the name selected that means if you type s you will get saraf as an option and you will select that, and on selection your local will be saved by your username in appian. So include operator will not work. Instead you should use '=' operator and if your field in View is having the user name then you need to convert your username to the firstname+lastname.

    Hope this will help

    Thanks
    Ekansh
  • Hi Sarah.K
    Can you check the rule input "selectedStudyMonitors" it might be array type. If yes can you remove it and check the filter condition. Let us know if that resolved your issue.
    I think know that includes operator might returns the Multiple rows as well, if your requirement is to get multiple rows as well the you can use that.
    Eg:
    In your data you have three rows like below
    9-116, flat number 405
    9-116, flat number 104
    9-116, flat number 105
    9-116, flat number 406

    applying query filter with include operator for value "flat number" will return all of the above rows.
  • 0
    Certified Lead Developer
    Hi I recommend you, try testing your expression rule first, instead of directly testing it via interface.

    Also, may I know what's the typeof right!selectedStudyMonitors variable? Is that of type text, text (Multiple), User , User (Multiple) ?

    Hence best option to debug this issue could be as follows:

    Input the test values into the expression rule (similar as what's being passed via interface with respect to the type) and check whether it's working or not.

    Also, I am a bit curious about, why did you use includes operator, when you are using user picker to fill the value into ri!selectedStudyMonitors variable. Because user picker do not return the partial value instead it returns the username of the selected user. And if the same is stored into DB, then why don't you use "=" operator for your filter criteria?

    Hope this helps.
  • Hi thanks for the reply. I was just trying anything to get it to work, hence the includes operator (it was originally = ). I got this to work with the help of a more experienced developer, we added some local variables to save in the selections, then pass these into a link inside of each chart and grid so that the selected choices were both saved up into the filter (so it could be cleared) and drill down the grid to the selected elements.

    Thanks for all the replies and suggestions!