Search code examples
powerappspowerapps-canvaspowerapps-formulapowerapps-collection

How to add property on an object power apps


I'm trying to build an app with power apps, I created a form where I collect data and then create a new object to store it in a collection, the problem is that i need to be able to modify the properties of that object and I can't.

I'm using Set() to create the object with all the properties already filled, like this :

Set(newObj, {property1: value, property2: value, property3: value; ...})

But whenever I try to Patch it to modify or add properties it does not work, nothing is added or modified

I'm doing Patch like this :

Patch(newObj, {newProperty: value, propertyToModify: value})

Do you know what i'm doing wrong ?


Solution

  • You cannot add any new property to your object with Patch. With patch you can only add rows to this object and not change the definition of you object by adding new property.

    with set you have defined your object with property1,property2 and property3.

    You will have to define your object completely in set.

    so it will be like

    Set(newObj{property1: value, property2: value, property3: value; newProperty: value, propertyToModify: value})