Skip to main content
December 24, 2021
Question

Custom Picker field(1st filter) filter is not working properly when performing multiple search using check/uncheck the checkbox (2nd filter)

  • December 24, 2021
  • 12 replies
  • 0 views

Hi Experts,

I have 2 filters, one is custom picker EMPID and another is checkbox to "Show current month data", below are the steps i am performing to filter the data:

->Uncheck the check box & then search for an EMPID which is not of current month so that EMPID result shows up

->Now check the "Show current month data" check box & so that the search result cleared off 

->Again search for the same EMPID number & no result found shows up in when its checked (Working as expected as its not current month EMPID,)

->Uncheck the "Show current month data" check box & then search again for same EMPID

   No result found even after page refreshes with  "Show current month data" check box unchecked

12 replies

stefanhelzle0001
Brainy
December 25, 2021

Can you provide some code snippets you use?

December 28, 2021

I am using CustomPicker Interface inside main interface :

rule!CustomPicker(
pickerLabel: "Emp Id",
labelPosition: "JUSTIFIED",
placeholder: "--- Search EMP ID ---",
maxSelections: 1,
identifiers: touniformstring(local!empIDFilter),
choiceLabels: touniformstring(local!empIDFilter),
selectedValue: touniformstring(local!empId),
saveInto: {
local!empId
}
)

rule!CustomPicker

a!pickerFieldCustom(
  label: ri!pickerLabel,
  labelPosition: ri!labelPosition,
  required: ri!isRequired,
  placeholder: ri!placeholder,
  instructions: ri!instructions,
  maxSelections: ri!maxSelections,
  readOnly: ri!isReadOnly,
  requiredMessage: ri!requiredMessage,
  helpTooltip: ri!helpTooltip,
  validations: ri!validations,
  disabled: ri!isDisabled,
  showWhen: ri!isShowWhen,
  suggestFunction: rule!CustomPickerSuggestion(
    filter: _,
    labels: ri!choiceLabels,
    idenifiers: ri!identifiers
  ),
  selectedLabels: if(
    count(
      if(
        isnull(
          ri!type
        ),
        wherecontains(
          ri!selectedValue,
          ri!identifiers
        ),
        wherecontains(
          cast(
            ri!type,
            ri!selectedValue
          ),
          cast(
            ri!type,
            ri!identifiers
          )
        )
      )
    )<1,
    null,
    a!forEach(
      items: ri!selectedValue,
      expression: 
      rule!getArrayPickerLabel(
        identifier: tostring(fv!item),
        labels: touniformstring(ri!choiceLabels),
        identifiers: touniformstring(ri!identifiers)
      )
    )
  ),
  value: if(
    count(
      if(
        isnull(
          ri!type
        ),
        wherecontains(
          ri!selectedValue,
          ri!identifiers
        ),
        wherecontains(
          cast(
            ri!type,
            ri!selectedValue
          ),
          cast(
            ri!type,
            ri!identifiers
          )
        )
      )

    )>0,
    ri!selectedValue,
    null
  ),
  saveInto: {
    a!save(
      ri!saveInto,
      rule!ArrayPickerRemoveDuplicate(
        array: save!value
      )
    ),
    ri!additionalSave
  }
)

rule!CustomPickerSuggestion

with(
  local!matches: where(
    apply(
      search(
        ri!filter,
        _
      ),
      ri!labels
    )
  ),
  'type!{http://www.appian.com/ae/types/2009}DataSubset'(
    data: index(
      ri!labels,
      local!matches,
      {}
    ),
    identifiers: index(
      ri!idenifiers,
      local!matches,
      {}
    )
  )
)

rule!getArrayPickerLabel

index(ri!labels,wherecontains(ri!identifier,ri!identifiers),{})

stefanhelzle0001
Brainy
December 28, 2021

I do not see where your checkbox with the date filter would come into play. Can you somehow show how the data changes during your interaction? Did you all the related locals and rule inputs for plausibility?

There is a typo in the rule CustomPickerSuggestion the rule input "idenifiers" misses a "t".