Hi, Thought I'd completed an app, but getting this error.
I'm using a dropdown to filter a gallery (Dropdown1) with this:
Distinct(D365Milestones,Workstream.Value)
The Item of the Gallery (BrowseGalleryMilestones) is doing this:
Distinct(Sort(Filter(D365Milestones, Workstream.Value = Dropdown1.Selected.Result), Created, Descending), Title)
Both work, and I thought I'd then just point an edit forms Item to BrowseGalleryMilestones.Selected, but I get "Invalild Formula: Expected a value compatible with data source". I'm stumped. Can anyone help me?
Solved! Go to Solution.
So your choice of Distinct is just the wrong one. Distinct is going to do as I mentioned before...give you a distinct list of JUST the column you want distinct of. There will be NO other record details with it.
Here is what I would recommend for your Items property of the Gallery:
ForAll(
GroupBy(
Filter(D365Milestones, Workstream.Value = Dropdown1.Selected.Result),
"Title",
"_recs"
),
Patch(First(SortByColumns(_recs, Created, Descending)), {Title: Title})
)
This will return the most recent record for each distinct title.
And, it will have the same record schema that is expected for the EditForm.
Your Items on the Gallery are going to return a Table with a single column called Result. That is NOT going to be compatible with your datasource record!
But here is my question...if you are using Distinct on your list for the Title and, let's say there are 5 items in your list that have the same title...which one would you then be expecting to edit in your EditForm???
So, the question is, do you need distinct on your gallery? And if so, then what do you expect to edit?
That's for the super quick reply. Unfortunately the user, if this refers works, does not want to overwrite the status of, say, a milestone, they want to create a separate record each time it's updated so they retain a history. Meaning there will be multiple records with the same title. So I need the gallery to only show the last created record for each title. This is what I thought the gallery was doing, so the edit form would navigate to that selected record. (Can you tell I'm new to this?)
So your choice of Distinct is just the wrong one. Distinct is going to do as I mentioned before...give you a distinct list of JUST the column you want distinct of. There will be NO other record details with it.
Here is what I would recommend for your Items property of the Gallery:
ForAll(
GroupBy(
Filter(D365Milestones, Workstream.Value = Dropdown1.Selected.Result),
"Title",
"_recs"
),
Patch(First(SortByColumns(_recs, Created, Descending)), {Title: Title})
)
This will return the most recent record for each distinct title.
And, it will have the same record schema that is expected for the EditForm.
User | Count |
---|---|
254 | |
246 | |
82 | |
44 | |
27 |
User | Count |
---|---|
341 | |
267 | |
123 | |
61 | |
58 |