Hi Folks,
My below filter results in a table with 1 record only, but i want to use it in Patch function:
Patch(ProjectDataAccessControl , Filter(ProjectDataAccessControl, User().FullName in ProjectDataAccessControl.User), {ColumnA: Text})
How do I convert/use this table into/as record?
Solved! Go to Solution.
Hi @IMathur ,
The delegation issue is seemly caused by in operators and User() function in Filter formula, and the First(Filter(..)) function can be replaced by LookUp function which can find the first record of all records that meet the criteria.
Please try to save the User().FullName to variable at the start of app.
Set(VarUserName, User().FullName)
Then modify the Patch formula as follows.
Patch(ProjectDataAccessControl , LookUp(ProjectDataAccessControl, User = VarUserName ), {ColumnA: Text})
Hope this helps.
Sik
used First(Filter(ProjectDataAccessControl, User().FullName in ProjectDataAccessControl.User)), but seems like First is not delegable function, which function should i use here?
Presumably, the Patch function is added to the onSelect property of some control. It's almost always a best a practice to use a context variable to build your object before passing it to a Patch. In your case, put a function before the Patch function that sets a context variable. Like:
UpdateContext( { locName: (Your Patch Record) } );
Then put the context variable in your Patch. This allows you to trace what was being patched, and can help with delegation issues and troubleshooting.
Anywhere that would change the context of the record you're going to patch. You may need to reset it after a patch, for example. You may update its value based on user input from different controls, for example.
Context variables only exist on a screen, so if you need it on multiple, consider a global variable, by the way.
Hi @IMathur ,
The delegation issue is seemly caused by in operators and User() function in Filter formula, and the First(Filter(..)) function can be replaced by LookUp function which can find the first record of all records that meet the criteria.
Please try to save the User().FullName to variable at the start of app.
Set(VarUserName, User().FullName)
Then modify the Patch formula as follows.
Patch(ProjectDataAccessControl , LookUp(ProjectDataAccessControl, User = VarUserName ), {ColumnA: Text})
Hope this helps.
Sik