Hi,
I have two tables, Product and Product Category, in Dataverse and there is a many-to-many relationship between two tables. I used the out-of-the-box many-to-many relationship. In the Product table, I have two columns, productName (text type) and productImage (image data type). In Product Category table, I have a column called category (text type).
I created a canvas app with a gallery and a combo box. The gallery is used to list the related products of the selected category in the combo box.
I set the gallery's items property comboBox.Selected.Products. When the canvas app is initially displayed, nothing is shown in the product gallery. If I select a category from the combo box, related products are shown.
My requirements:
The gallery should show all of the products if no category has been selected in the combo box. If a category is selected, show all related products.
How do fill the products in the gallery based on the selected category in the combo box?
I am totally new canvas app.
Thanks
Thank you for all your help!
It works now.
In OnChange property of combobox:
I set the Items property of the gallery as follows:
@Anonymous They are the columns (fields) that you want to display in the Gallery.
For column1 and column2, etc., don't you need to specify a formula for the columns?
@Anonymous Try it out first in the temporary collection to be sure that you have all the required columns (Not only the GUID). Then you can add it to the Items property of the Gallery.
ClearCollect(colTEMP, AddColumns(First(comboBox.SelectedItems).Products), "column1", "column2",........))
Please remember to give a 👍 and accept my solution as it will help others in the future.
Where should I put "AddColumns(First(comboBox.SelectedItems).Products), "column1", "column2",........)"?
Are column1, column2, etc., the display name, schema name, or logical name?
@Anonymous This confirms that the records are being returned but sometimes they may not have all the values that you need to show in the Gallery. You can wrap it around with a AddColumns().
AddColumns(First(comboBox.SelectedItems).Products), "column1", "column2",........)
Please remember to give a 👍 and accept my solution as it will help others in the future.
The collection contains the GUIDs of the related products. Can I create the collection of the products' GUID in the OnStart of the app or the in the OnSelect of the combobox?
@Anonymous Can you collect the following in a collection in the OnSelect of a Button and see if the collection has any records.
ClearCollect(colTEMP, First(comboBox.SelectedItems).Products)
Please remember to give a 👍 and accept my solution as it will help others in the future.
It still doesn't display the product name and image in the gallery when a category is selected.
@Anonymous
Please try the following,
If(CountRows(comboBox.SelectedItems)=0, Products, First(comboBox.SelectedItems).Products)
Please remember to give a 👍 and accept my solution as it will help others in the future.
WarrenBelz
223
Most Valuable Professional
MS.Ragavendar
110
stampcoin
80