Custom Picker Question

I am using a custom picker.

Fetching names from a group.

And i want to pass a name using rule input.

Then that name should not be visible in custom picker.

How can i do it ?

  Discussion posts and replies are publicly visible

  • Pass that name in the suggestion function and with the help of remove and whereContains, you can remove that name from the datasubset being returned by that suggestionFunction

  • Hi Pawan,

    please find the below example its working for me. Try like this way and modified based on your requirement.

    Code:

    a!localVariables(
    local!pickedState,
    local!stateLabels: { "Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming" },
    local!stateAbbreviations: { "AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY" },
    a!pickerFieldCustom(
    label: "State of Residence",
    instructions: "Value saved: " & local!pickedState,
    placeholder: "Type to select the employee's state of residence",
    maxSelections: 1,
    suggestFunction: rule!PS_ucArrayPickerFilter(
    filter:_,
    labels: local!stateLabels,
    identifiers: local!stateAbbreviations
    ),
    selectedLabels: a!forEach(
    items: local!pickedState,
    expression: index(local!stateLabels, wherecontains(fv!item, local!stateAbbreviations))
    ),
    value: local!pickedState,
    saveInto: local!pickedState
    )
    )

    Rule :

    =with(
    local!matches: where(
    a!forEach(
    items: ri!labels,
    expression: search( ri!filter, fv!item)
    )
    ),
    a!dataSubset(
    data: index( ri!labels, local!matches),
    identifiers: index( ri!identifiers, local!matches)
    )
    )

    Thanks,

    Pradeep Sridharan

  • Note, the example above comes from the recipe to configure an Array Picker: https://docs.appian.com/suite/help/latest/recipe-configure-an-array-picker.html

    However, the poster also said that they wanted to have it so that "that name should not be visible in custom picker" - I'm not sure I follow what this means, can you give an example of what you're trying to achieve here?

  • I'm not sure I follow what this means

    I assumed it meant they want the ability to manually exclude specific potential matches from the suggestion results; however i'm not clear whether Pradeep's suggested code actually accomplishes this, from what I can see now.

  • Ah I see what you mean - in that case they would likely need to either apply a filter to a query (if they're using a query in their suggestion function) or like Harshit said they would somehow filter the dataset through SAIL functions like wherecontains / index.