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), ),
Discussion posts and replies are publicly visible
I described this in my blog: https://appian.rocks/2022/12/22/create-new-items-using-a-custom-picker/
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
Well, the pattern I describe is how to get started. Maybe I misunderstand your intention.
You have any solution to do?
Andrei Alexandru Mois said:You have any solution to do?
Again... Stefan spells out exactly how to do this in his blog post.
You can take his concept of appending new values to the list.
Have a text input side by side with the pickerfield with a button add to list.
If you search in pickerfield and it does not exist type it in the textbox and click add to list button. You can even append it to the selected values in the pickerfield in the buttons save parameter using a!save() like this you don't need to retype it in the picker field. If you don't like the button you can just keep the textbox by itself and save on UNFOCUS etc
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) ), )
Yes, this works, thank you very much!!!
Duplicate thread - community.appian.com/.../save-value-in-a-custom-picker