pickerFieldCustom: selected value is NOT staying

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

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

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

Reply
  • 0
    Certified Senior Developer

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

Children
No Data