Hi!
I have a dropdown that shows items in a column in a table to filter items and I want to include the "All" option:
So...
In a multi column Table01
The contents of Column01 are...
Column01
Item 1
Item 2
Item 3
etc...
I was hoping to get this in the "Result" column of a one column collection:
Result
All
Item 1
Item 2
Item 3
etc...
To do so I wrote the following snippet in On Visible in the specific screen:
ClearCollect(coll_Jeepers, {Result: "All"});
Collect(coll_Jeepers, Distinct(Table01, Column01))
Instead I get the two column collection collJeepers like so:
Result Value
All
Item 1
Item 2
Item 3
etc
I can choose either for my dropdown, but not the consolidated one column "Result" collection as required.
Btw: I'm using the Distinct function to make the results a one column table, but I don't really need it. All the values in that column will be unique.
Any thoughts as to what I'm doing wrong?
Thanks!
MIchael
Hi MudassarSZ365!
Thanks for the latest proposed solution. It didn't work but will accept it because it gave me the inspiration to arrive at the solution (I even sorted the dropdown list with a little trick: " Todos" (" All") has a leading space to remain at the top after sorting).
// Works Ok and Sorted
ClearCollect(
collectProyecto,
{Value: " Todos"}
);
Collect(
collectProyecto,
Distinct(Sort(tblProyectos,Proyecto,SortOrder.Ascending),Proyecto)
)
;
Important: The Dropdown has to be set for Items -> CollectProyecto and Value -> Value
Thanks!
you can try this
ClearCollect(coll_Jeepers, {Result: "All"});
Collect(coll_Jeepers, RenameColumns(Distinct(Table01, Column01), "Result", "Result"));
Try the updated code, and if it resolves your issue, please consider accepting this solution. 😊
Hi MudassarSZ365
Thanks for your input. Unfortunately, it isn't working either:
I also tried changing the order to have "All" at the beginning (Changing the position AND the Collect / ClearCollect) but it still gave the same error.
Here it is:
can u provide the whole error msg and maybe copy paste it in here?
thanks
Hi @mmbr1606
Thanks for your help.
Unfortunately, I'm getting this error:
btw; The vertical bar after the comma is just the cursor
Hi @MichaelBranches ,
You can try this code
ClearCollect(
coll_Jeepers,
AddColumns(
Distinct(Table01, Column01),
"Result",
Result
)
);
Collect(
coll_Jeepers,
{Result: "All"}
);
However, you will notice that the "All" item is added to the end of the collection. If you want "All" to appear as the first item in the dropdown, you should reverse the order of the ClearCollect and Collect like this:
ClearCollect(coll_Jeepers, {Result: "All"});
Collect(coll_Jeepers, Table01.Column01);
If this solution helps you, please consider accepting it. 😊
hello @MichaelBranches
try the following approach:
ClearCollect(coll_Jeepers, {Result: "All"});
ForAll(Distinct(Table01, Column01), Collect(coll_Jeepers, {Result: Result}));
Let me know if my answer helped solving your issue.
If it did please accept as solution and give it a thumbs up so we can help others in the community.
Greetings