cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
anklez
Level: Powered On

Expected a value compatible with 'DataSource' even when datasource is correct.

I am getting the "Expected a value compatible with 'DataSource'" error when trying to create an EditForm.

 

The Form's Item property is set to DataTable.Selected, and its DataSource property is the same as DataTable. 

 

I think it might have something to do with the fact that I have a formula in the Item property for DataTable, but I am not sure how to resolve it. 

 

Please help. 

7 REPLIES 7
Super User
Super User

Re: Expected a value compatible with 'DataSource' even when datasource is correct.

The DataSource on the EditForm needs to be the data source that is being used in the Items property of the DataTable.



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
anklez
Level: Powered On

Re: Expected a value compatible with 'DataSource' even when datasource is correct.

I have tried copying and pasting the Item property from the DataTable into the DataSource property of the EditForm, which clears the error, but creates another error with my Submit button. 

 

The Submit button now gives the error "The data source supplied to the function is invalid". The function being SubmitForm(EditForm).

 

The form also displays the "This form isn't connected to any data" message in the background. It most definitely is connected to data. 

Super User
Super User

Re: Expected a value compatible with 'DataSource' even when datasource is correct.

What is the value in the DataSource of the EditForm?



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
anklez
Level: Powered On

Re: Expected a value compatible with 'DataSource' even when datasource is correct.

Currently, the value for both DataSource in the EditForm and the Item property in the DataTable is - 

 

SortByColumns(Filter(AddColumns('Electronic Diary',"FormattedDateandTime", Text('Date and Time', "[$-en-GB]dd/mm/yyyy,  hh:mm")), SearchInput.Text in Title || SearchInput.Text in Details || SearchInput.Text in 'Ticket Number' || SearchInput.Text in FormattedDateandTime	|| SearchInput.Text in Equipment ),"DateandTime",Descending)

The data is manipulated before being displayed in the DataTable to change date format and use a search bar (one search bar for all columns).

 

I have tried setting the DataSource property in the EditForm to 'Electronic Diary' (The actual datasource of the table, prior to manipulation) but that is when I am presented with the compatible value error. 

Super User
Super User

Re: Expected a value compatible with 'DataSource' even when datasource is correct.

I believe the issue is that AddColumns creates temp collection and DataTable.Selected is a record on that temp collection. Is there a unique value on the selected record? If so you could change the Item property of the EditForm to Lookup('Electronic Diary', DataTable.Selected.UniqueFieldValue = UniqueFieldValue) which will give you the record in 'Electronic Diary'.



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
anklez
Level: Powered On

Re: Expected a value compatible with 'DataSource' even when datasource is correct.

Thank you for your help so far @Jeff_Thorpe, I'm a lot closer now. 

The lookup method you suggested -

Lookup('Electronic Diary', DataTable.Selected.UniqueFieldValue = UniqueFieldValue)

seems to return the wrong record. 

 

Could this be because the temp collection is sorted by date, whereas the DataSource is unsorted? I can't really think of any other cause. 

 

Super User
Super User

Re: Expected a value compatible with 'DataSource' even when datasource is correct.

The sort shouldn't affect the lookup value being returned since the condition is based on a unique field value. If the value isn't  unique then the lookup will return the first one it finds with that value (DataTable.Selected.UniqueFieldValue = UniqueFieldValue).

 

 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,001)