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
  • 0
    Certified Senior Developer
    Hi Nalini ,

    For choice values it won't allow duplicate values for ignoring that
    can you try the bellow

    load(

    local!data:index(local!variable,"columnname" {})
    -------
    -------
    ------..etc,
    a!dropdownField(

    label: " ",
    placeholderLabel: "--select --",
    choiceLabels: union(
    local!data,
    local!data
    ),
    choiceValues: union(
    local!data,
    local!data
    ),
    value: {},
    saveInto:{}
    )

    may it helps you.....

    Thanks
  • 0
    Certified Lead Developer
    in reply to prakashb9987
    The values must be unique. As mentioned in the response, union will remove duplicates. However, the better approach may be to create a lookup table of values. That table should have and ID (pk) and text. The ID can be a number (sequence) for normalization or the text value.
    If you are querying a table that just continues to grow and have more and more records, the union will start to slow and may degrade performance.
Reply
  • 0
    Certified Lead Developer
    in reply to prakashb9987
    The values must be unique. As mentioned in the response, union will remove duplicates. However, the better approach may be to create a lookup table of values. That table should have and ID (pk) and text. The ID can be a number (sequence) for normalization or the text value.
    If you are querying a table that just continues to grow and have more and more records, the union will start to slow and may degrade performance.
Children