Need to apply Avoid duplicate values from the Dataservice

Hi Everyone, Need an urgent help.
We are trying to pull the data from the Data service and populating the data in the Dropdown list in Apps. When there are duplicates its showing the entire list. Need a help to retrieve only distinct values.

Current Expression :

Fetch(of SRProjectList)(createFilterGroup(New QueryFilter(){addFilter(“HSParameter”, “=”, NewPage1.Dropdown1.Value.HSParameter)}, Nothing, 0), Nothing, Nothing, Nothing, New ExpansionFieldOption(){addExpansionFieldOption(“CreatedBy”, New String(){“Id”,“Name”}), addExpansionFieldOption(“UpdatedBy”, New String(){“Id”,“Name”})})

Note : Need to take the distinct values based in HSParameter

@Manikandasamy_Subburayalu,

Can you try this one suggested by LLM

Fetch(
    of SRProjectList)(
        createFilterGroup(
            New QueryFilter() {
                addFilter("HSParameter", "=", NewPage1.Dropdown1.Value.HSParameter)
            }, 
            Nothing, 
            0
        ), 
        Nothing, 
        Nothing, 
        Nothing, 
        New ExpansionFieldOption() {
            addExpansionFieldOption("CreatedBy", New String() {"Id", "Name"}), 
            addExpansionFieldOption("UpdatedBy", New String() {"Id", "Name"})
        }
    ).Distinct("HSParameter")

Hi @Manikandasamy_Subburayalu

Try below Linq:

Fetch(of SRProjectList)(
createFilterGroup(New QueryFilter() {
addFilter(“HSParameter”, “=”, NewPage1.Dropdown1.Value.HSParameter)
}, Nothing, 0),
Nothing,
Nothing,
Nothing,
New ExpansionFieldOption() {
addExpansionFieldOption(“CreatedBy”, New String() {“Id”, “Name”}),
addExpansionFieldOption(“UpdatedBy”, New String() {“Id”, “Name”})
}
).GroupBy(Function(x) x.HSParameter).Select(Function(g) g.First())

Am getting an below error

‘Distinct’ is not a member of ‘ListSource(Of SRProjectList)’

@Manikandasamy_Subburayalu,

Looks like LLM hallucinated :smiley:

Here you go one working solution try and learn: