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

Certified Associate Developer

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

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Can you provide some code snippets you use?

  • 0
    Certified Associate Developer
    in reply to Stefan Helzle

    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),{})

  • 0
    Certified Lead Developer
    in reply to ankitas209

    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".

  • 0
    Certified Associate Developer
    in reply to Stefan Helzle

    Hi ,

    I am passing month and year in the grid data expression rule and filter data expression rule.

    please check the below code

    a!localVariables(
      local!ShowcurrentMonth: true,
      a!columnsLayout(
        columns:{
          a!columnLayout(
            
          contents: {
            rule!MA_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
              }
            ),
          }
        ),
          a!columnLayout(
            contents: {
              a!checkboxField(
                label: "",
                choiceLabels: {
                  "Show Current Month Data"
                },
                choiceValues: {
                  true
                },
                value: if(
                  or(
                    local!ShowcurrentMonth,
                    ri!ClickedTileNumber > 0
                  ),
                  true,
                  null
                ),
                saveInto: {
                  a!save(
                    local!ShowcurrentMonth,
                    if(
                      isnull(
                        save!value
                      ),
                      false,
                      true
                    )
                  ),
                  a!save(
                    local!empId,
                    null
                  )
                },
                disabled: if(
                  ri!ClickedTileNumber > 0,
                  true,
                  false
                )
              )
            }
          )
        }
      )
    
    
    )

    ri!ClickedTileNumber is numeric type which contains value from 1 to 8

    idenifiers is written like this in other rule, thankyou for noticing.

  • 0
    Certified Lead Developer
    in reply to ankitas209

    I still do not see the whole picture.

    Can you somehow show how the data changes during your interaction?

    Did you validate all the related locals and rule inputs for plausibility?

  • 0
    Certified Associate Developer
    in reply to Stefan Helzle

    Sorry i cant put the whole code here due to project constraints, and yes i have validated all the related locals and rule inputs. The same CustomPicker code is reused on some of the places and I am getting the same issue.

    Its only happening when i am pasting the value in custom picker field by following above mentioned steps, if I type the characters one by one then its providing the suggestions.

  • 0
    Certified Lead Developer
    in reply to ankitas209

    You did not mention that this only happens when copy&pasting the search text. Could it be that there is a trailing new-line?

  • 0
    Certified Associate Developer
    in reply to Stefan Helzle

    No there is no new-line trailing, I have already attached the code which i am using for custompicker

  • 0
    Certified Lead Developer
    in reply to ankitas209

    You wrote: "Its only happening when i am pasting the value in custom picker field by following above mentioned steps, if I type the characters one by one then its providing the suggestions."

    It seems like this makes the difference.

  • 0
    Certified Associate Developer
    in reply to Stefan Helzle

    The problem is with the Custom Picket Field, why custom picker while copy pasting second time does not populate values. After removing a character or putting a character one by one it works.

    Why with the provided custom code does not pre-filled second time

Reply Children