Hello.
What am i missing here?
I want to Patch entirely new columns in a Collection when a button is pressed. I'm trying to use ForAll in conjunction with Patch, but the error messages states "can't use same data source for both functions".
Any ideas for Patching in columns?
ForAll( collection_name, Patch( collection_name,
Defaults(collection_name), { x: Rand() * 1266, y: Rand() * 668 } ))
Solved! Go to Solution.
Hi @seadude,
Could you please share a bit more about your scenario?
Could you please show more details about the collection that you mentioned within your formula?
Further, do you want to add a new record into your collection or replace the entire record values with new values (pseudo-random numbers) within the collection?
The error message told that the ForAll function and Patch could not use same collection as data source.
If you want to add one new record into your collection, please take a try with the following formula:
Patch( collection_name, Defaults(collection_name), { x: Rand() * 1266, y: Rand() * 668 } )
If you want to replace the entire record values with new values (pseudo-random numbers) within the collection, please take a try with the following formula:
ForAll(
RenameColumns(
RenameColumns(Collection1,"x","x1"),
"y","y1"
),
Patch(
Collection1,
LookUp(Collection1,x=x1&&y=y1),
{
x:Rand()*1266,
y:Rand()*668
}
)
)
More details about the Patch function and ForAll function within PowerApps, please check the following article:
Patch function, ForAll function
Best regards,
Kris
Hi @seadude,
Could you please share a bit more about your scenario?
Could you please show more details about the collection that you mentioned within your formula?
Further, do you want to add a new record into your collection or replace the entire record values with new values (pseudo-random numbers) within the collection?
The error message told that the ForAll function and Patch could not use same collection as data source.
If you want to add one new record into your collection, please take a try with the following formula:
Patch( collection_name, Defaults(collection_name), { x: Rand() * 1266, y: Rand() * 668 } )
If you want to replace the entire record values with new values (pseudo-random numbers) within the collection, please take a try with the following formula:
ForAll(
RenameColumns(
RenameColumns(Collection1,"x","x1"),
"y","y1"
),
Patch(
Collection1,
LookUp(Collection1,x=x1&&y=y1),
{
x:Rand()*1266,
y:Rand()*668
}
)
)
More details about the Patch function and ForAll function within PowerApps, please check the following article:
Patch function, ForAll function
Best regards,
Kris
User | Count |
---|---|
176 | |
111 | |
86 | |
44 | |
42 |
User | Count |
---|---|
228 | |
116 | |
115 | |
72 | |
67 |