Skip to main content
Known Participant
Jun 14, 2023 12:05 PM UTC
Solved

Save a value in a custom Picker

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

Inspiring
Jun 14, 2023 2:49 PM UTC

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
Jun 14, 2023 12:07 PM UTC
Known Participant
Jun 14, 2023 1:19 PM UTC

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
Jun 14, 2023 2:02 PM UTC

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

Inspiring
Jun 14, 2023 2:49 PM UTC

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

Known Participant
Jun 14, 2023 2:52 PM UTC
Yes, this works, thank you very much!!!
harshitb6843
Brainy
Jun 14, 2023 4:22 PM UTC