fetch Data from a db column to drop down component

Hi All,

 

I'm trying to fetch data form one of the column of database to the drop down component on UI.

Column has redundant data e.g india,india,india, in 100 rows let say.

I'm using index(local!variable,"columnname" {}) function, but it is throwing error.. Duplicate items are not allowed in the choice Values array.

Please guide on this ..

 

TIA,

Nalini 

  Discussion posts and replies are publicly visible

Parents
  • Hi,
    Follow these steps:
    1. write query entity to fetch that column
    2. save only that column data in a local variable, let's suppose local!a
    3. give local!finalData: union(local!a,local!a)
    4. use local!finalData in choiceValues and choiceLabels

    Note: 3rd step might give error saying can't perform union on local!a, in this scenario write below line:
    local!finalData: union(touniformString(local!a),touniformString(local!a))
  • My requirement is to fetch unique values from DB column with the help of record type to populate in dropdown values. I have used this code


    a!localVariables(

    local!projectManager: a!queryRecordType(
    recordType:XYZ Record type,
    fields: a!aggregationFields(
    groupings: {
    a!grouping(
    field: XYZ Record type.field,
    alias: "projectManager"
    )
    }
    ),
    pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 5000)
    ),

    a!recordFilterList(
    name: "projectManager",
    options: a!forEach(
    items: local!projectManager.data,
    expression: a!recordFilterListOption(
    id: fv!index,
    name: fv!item.projectManager,
    filter: a!queryFilter(
    field:  XYZ Record type.field,
    operator: "=",
    value: fv!item.projectManager
    )
    )
    )
    ),
    )

     But this returns a Facet type object which has many fields and i want to access some specific field which contains unique values

  • 0
    Certified Associate Developer
    in reply to Niharika
    You have added a grouping clause hence in the query. Hence, it will return unique project manager names. User filter expect Facet type object. Hence, your code is correct. You need to enter your code in "Filter Expression" available in User Filters.
    See the screenshot below for reference:
Reply Children
No Data