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


  • If you are fetching the initial data using a query entity or even calling an Stored Procedure, we can use groupby using the column which is required. This will get unique data for the column and no need to doing extra manipulation of data in Appian side.

    for ex:

    local!mydropdownlaluves: a!queryEntity(
    entity: cons!MY_DATASTORE,
    query: a!query(
    aggregation: {
    a!queryAggregation(
    aggregationColumns: a!queryAggregationColumn(
    field: "MY_VALUE_COLUMN",
    isGrouping: true()
    )
    )
    },
    pagingInfo: rule!APN_pagingInfoAll()
    )
    )

    Regards
    Suresh
  • 0
    Certified Lead Developer
    in reply to sureshg57
    Yes, you don't want to waste bandwidth pulling more data than you need only to remove duplicates after you've pulled.

    Another option would be to create a constant with all the unique values, along with a Stored Procedure you can call when needed or on a schedule to update the constant to match the lookup table. This way, you run the query say every 2 weeks instead of every single time any user goes to the form that uses the dropdown. You need to look at how frequently this list of unique values changes. If it's not that frequent you might consider this option. If it doesn't change (every new row uses a value that has already been used before), I would do only the constant and no SP or query at all.
Reply
  • 0
    Certified Lead Developer
    in reply to sureshg57
    Yes, you don't want to waste bandwidth pulling more data than you need only to remove duplicates after you've pulled.

    Another option would be to create a constant with all the unique values, along with a Stored Procedure you can call when needed or on a schedule to update the constant to match the lookup table. This way, you run the query say every 2 weeks instead of every single time any user goes to the form that uses the dropdown. You need to look at how frequently this list of unique values changes. If it's not that frequent you might consider this option. If it doesn't change (every new row uses a value that has already been used before), I would do only the constant and no SP or query at all.
Children