cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JamesM
Level 8

DataSource for a view Form?

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

 

Set(storeDetail,InSiteConnector.GetPricelineStoresDetailed({order:"DESC",ordercol:"RowInsertDateTime",server:"P284S001"}))

And then trying 

 

First(storeDetail)

in DataSource but the form is blank. What am I missing? 

7 REPLIES 7
Super User
Super User

Re: DataSource for a view Form?

Hi James,

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.

Super User
Super User

Re: DataSource for a view Form?

Hi @JamesM,

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.

JamesM
Level 8

Re: DataSource for a view Form?

I will give that a try, but does that mean that in order for a Form to be available, you must also have a data table on the screen? (Even set to not visible, this seems hacky?) 

Super User
Super User

Re: DataSource for a view Form?

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.

Community Support Team
Community Support Team

Re: DataSource for a view Form?

Hi @JamesM,

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:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/connections-list#tables

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:

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Super User
Super User

Re: DataSource for a view Form?

Hi @JamesM and @v-xida-msft,

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.. 

Super User
Super User

Re: DataSource for a view Form?

Hi guys,
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.

formCol1.PNG


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:
formCol2.PNG


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.

 

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps 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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (4,567)