Ganesh M
Ganesh M

Reputation: 27

How to set global variable with Power Apps OnStart property

I have created blank canvas app and I want to create product details like product name, price, category,quantity, color, etc..., by using set function with OnStart property. Please, suggest any information about this.

I want to create global variable with Onstart property in blank canvas app.

Upvotes: 2

Views: 6959

Answers (1)

Ganesh Sanap - MVP
Ganesh Sanap - MVP

Reputation: 2248

If you have fixed set of products, you can write function like below in OnStart property of App object in your app:

Set (
    gvProducts,
    Table(
        {
            ProductName: "Product 1", 
            Price: 100,
            Category: "Category 1",
            Quantity: 5,
            Color: "Red"
        },
        {
            ProductName: "Product 2", 
            Price: 200,
            Category: "Category 2",
            Quantity: 10,
            Color: "Green"
        }
    )
)

It creates table of multiple records with same properties. You can adjust the data type of each property and add multiple records/objects as per your requirements.

enter image description here

Upvotes: 2

Related Questions