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.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (3,149)