如何在对象上添加属性 Power Apps
我正在尝试使用电源应用程序构建一个应用程序,创建了一个表单,我收集数据,然后创建一个新对象以将其存储在集合中,问题是我需要能够修改该对象的属性和我不能。
我正在使用set()
来创建所有已经填充的属性的对象,
Set(newObj, {property1: value, property2: value, property3: value; ...})
但是每当我尝试修补它以修改或添加属性时,它不起作用,任何内容添加或修改了,
我正在做这样的补丁:
Patch(newObj, {newProperty: value, propertyToModify: value})
您知道我在做什么错吗?
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 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不能使用补丁程序向对象添加任何新属性。
使用补丁,您只能在此对象中添加行,而不是通过添加新属性来更改对象的定义。
使用设置,您已使用property1,property2和propert 3定义对象。
您将必须在集合中完全定义对象。
所以会
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
请注意,您不需要像这样重新定义对象。要记住的关键一点是 Patch 不会更新记录,它会返回更新后的记录。然后,您可以使用 Set 来设置对象,如下所示:
设置(newObj,补丁(newObj,{newproperty:4}))
Note that you don't need to redefine your object like that. The key thing to remember is that Patch doesn't update the record, it returns the updated record. You can then use Set to set your object, like this:
Set(newObj,Patch(newObj,{newproperty:4}))