cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Invalid Formula. Expected a value compatible with 'DataSource'

I am facing an error when I try to build an Edit Form based on my Gallery selection, based on the SharePoint List "Opportunities and Risk".

 

In my gallery, named "BrowseGallery1", I have the following script in the "Items" field:

 

Filter('Opportunities and Risk', 'Entry Type'.Value = Label2.Text)

 

I configured by Edit Form, labelled "Form 1" Datasource:

 

'Opportunities and Risk'

 

And the Item field:

 

BrowseGallery1.Selected

 

However, I am getting error "Invalid Formula. Expected a value compatible with 'DataSource'". I believe I am already pointing the Form and Gallery to the same data source. What could be missing from my setup?

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please try with this alternative workaround.

Set OnSelect of BrowseGallery1:

Set(SelectedItemID, ThisItem.ID)

Set Form1.Item property:

LookUp('Opportunities and Risk',ID=SelectedItemID)

Use lookup function to retrieve the record from data source, and I believe this will resolve the error.

Hope this helps.

Sik

View solution in original post

12 REPLIES 12
v-siky-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please try with this alternative workaround.

Set OnSelect of BrowseGallery1:

Set(SelectedItemID, ThisItem.ID)

Set Form1.Item property:

LookUp('Opportunities and Risk',ID=SelectedItemID)

Use lookup function to retrieve the record from data source, and I believe this will resolve the error.

Hope this helps.

Sik

The workaround seems to work, although i have had the "Gallery.Selected" method working before.

All seems hit and miss.

 

"We strive to work in an environment without workarounds"...

Just ran into this issue today. workaround worked, but, this is clearly a bug??? I have another app with the same datasource that works with .Selected just fine.

SarathSub
Frequent Visitor

Hit on the same issue! How irritating is this?

Did anyone find any direct solutions?

LuisAbarcaPeru
New Member

Same Issue.

Workaround worked fine. 

Amazing solution, works!

Grainy
Advocate I
Advocate I

Great workaround @v-siky-msft ! Been scratching my head for days.

How can I integrate this workaround with the option to put in a new entry? Right now I have a variable that I either set with the selected item from my gallery, or I set it to default values (with some info pre-populated) and allow a new entry

 

Gallery.onSelect = UpdateContext({ selected:ThisItem })

ButtonAddNew.Select = UpdateContext({ selected:Patch(Defaults(MyDataSource),
    { Title:"my title", 
    Active:true }
    )
    })

Form.Item = selected
mj07
Frequent Visitor

Hi! i tried the workaround, but it did not reflect any output from the gallery to the form

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,877)