Skip to main content
swapnar6405
February 21, 2024
Solved

pickerFieldCustom: selected value is NOT staying

  • February 21, 2024
  • 6 replies
  • 0 views

Hi,

I am using below code in my interface where I am using pickerFieldCustom. Also, I am sharing my expression rule.

The issue which I am facing: After search with a certain text, I am able to get the result into the picker control, but it is disappearing upon the selection. 

a!localVariables(
local!pickedName,
{
a!pickerFieldCustom(
label: "Name",
maxSelections: 1,
suggestFunction: rule!TestExpression(search: _),
selectedLabels: local!pickedName,
value: local!pickedName,
saveInto: a!save(local!pickedName, union(save!value, save!value))
)
}
)

------------------

a!localVariables(
local!data: a!queryEntity(
entity: cons!Employee,
query: a!query(
logicalExpression: a!queryLogicalExpression(
operator: "AND",
filters: {
a!queryFilter(
field: "name",
operator: "includes",
value: ri!search
)
},
ignoreFiltersWithEmptyValues: true
),
pagingInfo: a!pagingInfo(startIndex: 1, batchSize: - 1)
),
fetchTotalCount: false
).data,
a!dataSubset(data: index(local!data, "name"))
)

Best answer by stefanhelzle0001

This might be because your final datasubset does not define the identifiers which the picker field requires.

6 replies

srmm0001
February 21, 2024

Interface with Picker Field Custom

a!localVariables(
local!pickedName,
{
a!pickerFieldCustom(
label: "Name",
maxSelections: 1,
suggestFunction: rule!TestExpression(search: _),
selectedLabels: if(isnull(local!pickedName), {}, index(local!pickedName, "label", {})),
value: local!pickedName,
saveInto: a!save(local!pickedName, fv!selection)
)
}
)

Below is a template assuming you're querying an entity for names.

a!localVariables(
local!data: a!queryEntity(
entity: cons!Employee,
query: a!query(
logicalExpression: a!queryLogicalExpression(
operator: "AND",
filters: {
a!queryFilter(
field: "name",
operator: "includes",
value: ri!search
)
},
ignoreFiltersWithEmptyValues: true
),
pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 10)
),
fetchTotalCount: false
).data,
map(
a!forEach(
items: local!data,
expression: {
id: fv!item.id,
label: fv!item.name
}
)
)
)

stefanhelzle0001
February 21, 2024

This might be because your final datasubset does not define the identifiers which the picker field requires.

February 21, 2024

Hi swapnar6405,

As Stefan explained, your final data subset does not define the identifiers which the picker field requires. and also after defining the Identifier as per your code, it will showcase the selected identifier in the picker field,
you need to get the name based on the selected identifier. you can achieve it with the help of the index and the whercontain functions
this is an SS  of a picker field.

you can also go through this Documentation:-docs.appian.com/.../recipe-configure-an-array-picker-with-a-show-all-option.html

swapnar6405
February 22, 2024

Thank you