web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Form's Item property i...
Power Apps
Answered

Form's Item property is throwing an "Invalid formula. Expected a value compatible with Datasource" error when I use a global variable. Why?

(0) ShareShare
ReportReport
Posted on by 831 Moderator

I had this working but think I may have accidentally did something to make it break. I have a form that works fine when submitting a record. However, I now get an error for the Form's Item property. In this property I have a global variable. I discovered this when I was on my gallery screen and selected an item from the gallery and hit copy. I get redirected back to the form. Unfortunately, no form is showing.

 

I dropped a label on the screen to check what display mode the form is in and it does say 'edit'.

 

Tried a label for one of the combo boxes that should be populated, and it is blank. 

 

Checked the global variable and there is data there. Even double checked using a label to pick the value in one of the columns. 

 

I'm just not sure why the global variable is throwing the  "Invalid formula. Expected a value compatible with Datasource" now.

Categories:
I have the same question (0)
  • Verified answer
    Ami K Profile Picture
    15,687 Super User 2024 Season 1 on at

    @futr_vision - the error is appearing because you’re populating the variable with a record which contains a specific schema, but then somewhere else in your app, you’re also populating the same variable with a record which has a different schema.

     

    Some classic checks

     

    The EditForm control contains two important properties, the DataSource property and the Item property (which is used to display a specific record).

    The schema used in the DataSource property and the schema returned in the Item property must match. In your example, you’re populating the Form's Item property with a Global Variable generated on a Gallery selection. If the data source used in the Gallery Items property is different than the data source used in the DataSource property in the Edit Form control, you will receive an error.

    This occurs very often when users leverage the AddColumns or GroupBy function when modifying the Items property of a Gallery control. If you have modified the schema of the Gallery like this, then the data source used in the Gallery Items property, and the data source used in the DataSource property of the Edit Form, will no longer match.

    To accommodate for this, it is best to use a Look Up function in the Item property of the Edit Form. For example:

     

    Lookup(
     'Your data source', 
     ID = Gallery1.Selected.ID
    )

     

    Or for a Variable in your case:

     

    Lookup(
     'Your data source', 
     ID = MyVariable.ID
    )

     

    If your scenario matches the above description, it is important to restart the app after you make this correction in order for the error to disappear.

     

    Other checks:

     

    Ensure you do not have a Global Variable and a Collection with the same name.

     

    Follow a process of elimination to identify which variable declaration is causing the error. For example, navigate to the variables menu to view how and where the variable is being defined, and then for each declaration of that variable:

    1. Delete one instance where the “Set('variablename','output')” is being declared.
    2. Click save and restart the app and check if the error still appears.
    3. If the error continues to appear, repeat for the next declaration and keep restarting the app.
    4. Once the error disappears, you can then pinpoint exactly which declaration was causing the error, and then investigate further.
  • futr_vision Profile Picture
    831 Moderator on at

    I see what I did. First I set two separate forms to use the same global variable so I got a mashup of the two data sources. The other, which I think might be less offensive, is that the button the goes into the first form I had removed setting the global variable to the data source defaults like this

     

    Set(glbFormData, Defaults('Tracking URL DB'));

     

  • jessicadduffey Profile Picture
    on at

    Thank you so much for your explanation!  I have been getting this error for the past week - now my app is working perfectly!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 536

#2
WarrenBelz Profile Picture

WarrenBelz 426 Most Valuable Professional

#3
Haque Profile Picture

Haque 305

Last 30 days Overall leaderboard