Skip to main content
June 14, 2023
Solved

Save a value in a custom Picker

  • June 14, 2023
  • 9 replies
  • 0 views

Hello, does anyone know how I can make a custom picker to save the value if it is not in the list?

The code is that:

                              a!pickerFieldCustom(
                                label: "Tipo de entrada",
                                labelPosition: "ABOVE",
                                maxSelections: 1,
                                suggestFunction: rule!ERYM_FiltroComponente(
                                  filter:_ , 
                                  labels: local!tipoEntrada, 
                                  identifiers: local!tipoEntrada
                                ),
                                selectedLabels: a!forEach(
                                  items: ri!expediente.tipoEntrada,
                                  expression: index(local!tipoEntrada, wherecontains(fv!item, local!tipoEntrada))
                                ),
                                value: ri!expediente.tipoEntrada,
                                saveInto: ri!expediente.tipoEntrada,
                                showWhen: a!isNotNullOrEmpty(ri!expediente.inTipoExpediente),
                              ),

Best answer by miriamp6529

Try this into your suggestFuction:

if(
    count(local!matches) > 0,
    a!dataSubset(
      data: index(ri!labels, local!matches),
      identifiers: index(ri!identifiers, local!matches)
    ),
    a!dataSubset(data: ri!filter, identifiers: ri!filter)
  ),
  
)

9 replies

stefanhelzle0001
Brainy
June 14, 2023
June 14, 2023

Hello, but that is not what I am looking for, what I want is that if they write a word inside the custom picker and it does not exist, it is saved in the indicated variable to use it in the future

stefanhelzle0001
Brainy
June 14, 2023

Well, the pattern I describe is how to get started. Maybe I misunderstand your intention.

June 14, 2023

Try this into your suggestFuction:

if(
    count(local!matches) > 0,
    a!dataSubset(
      data: index(ri!labels, local!matches),
      identifiers: index(ri!identifiers, local!matches)
    ),
    a!dataSubset(data: ri!filter, identifiers: ri!filter)
  ),
  
)

June 14, 2023
Yes, this works, thank you very much!!!
harshitb6843
June 14, 2023