@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:
- Delete one instance where the “Set('variablename','output')” is being declared.
- Click save and restart the app and check if the error still appears.
- If the error continues to appear, repeat for the next declaration and keep restarting the app.
- Once the error disappears, you can then pinpoint exactly which declaration was causing the error, and then investigate further.