I have tried adding as the DataSource for a view form the following
* a table variable
* a custom connector directly
* a collection
But nothing shows up in my view form in the designer. What am I doing wrong? As an example I try this on the OnVisible property of my screen
And then trying
in DataSource but the form is blank. What am I missing?
After you load your screen, if you click File>Variables, does the storeDetail variable appear and is it populated with data? If so, do you see a tablular view of data that you can bind to a view form? If you see some unusual data structure here (eg, a single row, single column field that contains your data in a nested table) , that might explain why your view form isn't populating.
Forms require a datasource and they display information from a single row in that datasource. The row is defined by the Item property. It is usually referenced by a row selected in a gallery or Datatable. Nothing will show up until you select one. Put a datatable on the screen and set its items property to the same datasource as the form. In the item property of the form put Datatable1.Selected. The form will then Populate.
Nope it can be on any screen. Usually you will navigate to a view screen from a gallery where you select the row in the datasource. The purpose of the view form is to show the details of a row you select in a gallery or a datatable. I just wanted to show you how it works. If this answers your question please mark the thread as solved.
Do you want to display a record within your data source within the Display form control?
Currently, the Display form (or Edit form) could only be connected to a Table data source PowerApps supports currently (e.g. Excel table, SharePoint list, SQL table, etc).
More details about Table data source within PowerApps, please check the following article:
If you want to connect the Display form (or Edit form) to a table variable, a custom connector or a collection, I afraid that there is no way to achieve your needs in PowerApps currently.
Note: I don't agree with @Drrickryp's thought, I don't think the Data Table control could achieve your needs.
If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:
I believe that I may not have been clear enough in my explanations. Kris is certainly correct that a View form works only with a primary data source and not a variable or collection. Moreover, unless it is in New mode, it displays only one record from the data source and that record is defined by the Item property. In the commonest use, the View form has the same datasource as a gallery or datatable and the row selected in either of these controls is referenced in the Form's Item property. The example I gave with the datatable was simply an illustration of one way to select a record for the Item property of the form provided that both the Form and Datatable had a single common datasource..
Could you clarify what you mean about Forms not working with collections or variables?
I've just tried and I can set the DataSource of a form to a collection (Customers in this example) which I built with ClearCollect. I can also set the DataSource of the form to a variable which I define with the Set function.
Returning to the original question, I think I understand the problem now. I think that by setting the storeDetail variable in the OnVisible property of the screen, there is some timing problem where the form attempts to bind to the data before it fully loads, and this explains why the form appears blank.
You can recreate this problem by moving the code that I have in my 'Create Collection' button to the OnVisible property. One way to work around this problem is to set the variable before the screen opens. If you have a button that opens the screen that contains the form, you can set the variable value before navigating to the screen, like this:
To clarify what @Drrickryp is saying, notice in my first screenshot how the Item property is set to Gallery2.Selected. If you don't want to add a gallery or data table to your app, you can set this to First(storeDetail) if you want the form to display the first record in your storeDetail collection.
If this doesn't work, show us what the structure of storeDetail looks like by screenshotting the Files > Variables page. I've uploaded this simple test app here in case it helps you.
Check it out!
Fill out a quick form to claim your user group badge now!
Find out where you can attend!
Features releasing from October 2019 through March 2020
The largest Power BI, Power Platform, and Data conference in New Zealand