Hello,
i have a gallery with sort, if and filter function. Now i want use the Distinct function to show the names
only show once.
SortByColumns( DISTINCT(If( !IsBlank(searchField.Text); Filter( myContracts; StartsWith( Nachname; searchField.Text ) || StartsWith( Mitgliedsnummer; searchField.Text ) ); Filter( myContracts; ArtName = DropdownGew.SelectedText.Value ) ); "Mitgliedsnummer"; If( SortDescending1; Descending; Ascending ) );Mitgliedsnummer)
Has anyone an idea?
Thanks
Solved! Go to Solution.
Hi @Tamer66 ,
Do you want to show distinct Mitgliedsnummer value within your Gallery?
Do you want to only show Mitgliedsnummer value within your Gallery?
Based on the formula that you provided, I think there is something wrong with it. I have made a test on my side, please consider take a try with the following workaround:
1. If you just want to show Mitgliedsnummer value within your Gallery:
Set the Items property of the Gallery to following formula:
Distinct(
SortByColumns( If( !IsBlank(searchField.Text); Filter( myContracts; StartsWith(Nachname; searchField.Text) || StartsWith(Mitgliedsnummer; searchField.Text) ); Filter( myContracts; ArtName = DropdownGew.SelectedText.Value ) ), "Mitgliedsnummer"; If(SortDescending1; Descending; Ascending) ),
"Mitgliedsnummer"
)
2. If you want to show distinct Mitgliedsnummer value along with other column values within your Gallery, I think an nested Gallery and GroupBy function could achieve your needs:
Set the Items property of the Outer Gallery (Parent Gallery, Gallery1) to following:
GroupBy(
SortByColumns( If( !IsBlank(searchField.Text); Filter( myContracts; StartsWith(Nachname; searchField.Text) || StartsWith(Mitgliedsnummer; searchField.Text) ); Filter( myContracts; ArtName = DropdownGew.SelectedText.Value ) ), "Mitgliedsnummer"; If(SortDescending1; Descending; Ascending) ),
"Mitgliedsnummer",
"GroupData"
)
Then within the Outer Gallery, add a nested Gallery (Gallery2), set the Items property to following:
ThisItem.GroupData
within the nested Gallery, you could add some Label controls to display other column values from your "myContracts" data source using the following formula:
ThisItem.Nachname
ThisItem.ArtName
...
Please take a try with above solution, then check if the issue is solved.
Best regards,
HI @Tamer66
SortByColumns( DISTINCT(If( !IsBlank(searchField.Text); Filter( myContracts; StartsWith( Nachname; searchField.Text ) || StartsWith( Mitgliedsnummer; searchField.Text ) ); Filter( myContracts; ArtName = DropdownGew.SelectedText.Value ) ); "Mitgliedsnummer"); Result If( SortDescending1; Descending; Ascending ) )
SortByColumns( GroupBy(If( !IsBlank(searchField.Text); Filter( myContracts; StartsWith( Nachname; searchField.Text ) || StartsWith( Mitgliedsnummer; searchField.Text ) ); Filter( myContracts; ArtName = DropdownGew.SelectedText.Value ) ); "Mitgliedsnummer";"Grouped"); Result If( SortDescending1; Descending; Ascending ) )
Hi @Tamer66 ,
Do you want to show distinct Mitgliedsnummer value within your Gallery?
Do you want to only show Mitgliedsnummer value within your Gallery?
Based on the formula that you provided, I think there is something wrong with it. I have made a test on my side, please consider take a try with the following workaround:
1. If you just want to show Mitgliedsnummer value within your Gallery:
Set the Items property of the Gallery to following formula:
Distinct(
SortByColumns( If( !IsBlank(searchField.Text); Filter( myContracts; StartsWith(Nachname; searchField.Text) || StartsWith(Mitgliedsnummer; searchField.Text) ); Filter( myContracts; ArtName = DropdownGew.SelectedText.Value ) ), "Mitgliedsnummer"; If(SortDescending1; Descending; Ascending) ),
"Mitgliedsnummer"
)
2. If you want to show distinct Mitgliedsnummer value along with other column values within your Gallery, I think an nested Gallery and GroupBy function could achieve your needs:
Set the Items property of the Outer Gallery (Parent Gallery, Gallery1) to following:
GroupBy(
SortByColumns( If( !IsBlank(searchField.Text); Filter( myContracts; StartsWith(Nachname; searchField.Text) || StartsWith(Mitgliedsnummer; searchField.Text) ); Filter( myContracts; ArtName = DropdownGew.SelectedText.Value ) ), "Mitgliedsnummer"; If(SortDescending1; Descending; Ascending) ),
"Mitgliedsnummer",
"GroupData"
)
Then within the Outer Gallery, add a nested Gallery (Gallery2), set the Items property to following:
ThisItem.GroupData
within the nested Gallery, you could add some Label controls to display other column values from your "myContracts" data source using the following formula:
ThisItem.Nachname
ThisItem.ArtName
...
Please take a try with above solution, then check if the issue is solved.
Best regards,
Hi
thanks for your cool support. This helps me realy.
I have tried following the example shown here because I have exactly the same issue. I am trying to get only distinct values. The formula below works perfectly but when I try to use Distinct, I am unable to get any results. Could someone help me please identify what I am doing wrong?
SortByColumns(
Filter(
'Vendor List',
TextSearchBox1.Text in ID || TextSearchBox1.Text in Title || TextSearchBox1.Text in Tier.Value || TextSearchBox1.Text in 'Vendor Status'.Value || TextSearchBox1.Text in 'Vendor Posture'.Value || TextSearchBox1.Text in 'SVM Analyst'.DisplayName
),
"Title",
If(
SortDescending1,
Descending,
Ascending
)
)
User | Count |
---|---|
160 | |
96 | |
76 | |
72 | |
59 |
User | Count |
---|---|
212 | |
166 | |
97 | |
95 | |
75 |