cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mmurch
New Member

Invalid Formula: Expected a value compatible with data source

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?

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@mmurch 

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.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

4 REPLIES 4
RandyHayes
Super User III
Super User III

@mmurch 

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?

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

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?)

RandyHayes
Super User III
Super User III

@mmurch 

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.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

mmurch
New Member

Wizardry. Thanks @RandyHayes .

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

PA Community Call

Power Apps Community Call

Next call is happening on April 21st at 8a PST.

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (60,565)