Saturday, 5 February 2022

How to display multiple SharePoint lists data in in Power App gallery

If you want to combine two SharePoint lists data and display the combined result within a gallery:

I have two SharePoint Lists: CustomerInfo and ProductInfo: In this scenario I will be comparing the Customer ID between two lists and getting the Price information on gallery.

I have created an app and added the Gallery control on the app:

Set the OnVisible property of your first screen of the app:
ClearCollect(
    CustColll,
    CustomerInfo
);
ClearCollect(
    ProdColll,
    ProductInfo
)


Set the Items property of the gallery control.:
AddColumns(
    CustColll, 
    "tempPriceValue",
    LookUp(
        ProdColll,
        CustID = CustomerID,
        Price
    )
)


Here: 
AddColumns: Function which will add the columns to table.
CustColl: Is the collection variable which I created above.
tempPriceValue: Above formula will add this column to result.

Finally, insert the label into gallery and update the Text property as below:
    ThisItem.tempPriceValue

No comments:

Post a Comment