Set function for Record type value #889
-
In the testing I've done so far, I can't seem to update Record type objects with mutation functions. Maybe there's some other flag I need to set to make this possible? So here's the idea: I have a Record, and it has three objects in it (all strings, to keep things simple):
I declare a var for it using FromJson:
and the record and its member objects are all accessible to me. BUT, when I go to set one:
I get the error "Invalid argument type." referring to the Patch method. The Patch on its own outputs exactly what I'd expect (a new Record Object that is a match for the old one but has an updated Id) but Set seems unable to accept its output. I thought maybe it was just the type of Var I was declaring (because of the FromJson) so I also tried it with NewRecordFromFields, but the results are the same
So what's the piece I am missing here? How am I supposed to mutate a Record type Var, if not as documented here? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 12 replies
-
Here, I think this screengrab is a really good illustration of the problem I am seeing: I can Set() a Record and feed it a new record manually, no problem. |
Beta Was this translation helpful? Give feedback.
-
What version of the codebase are you using? There was a PR 16 days ago that changed the return type of Patch to Record, as it was returning Table prior to that (which would be an invalid argument type as you're seeing). |
Beta Was this translation helpful? Give feedback.
-
According to the documentation, there are 3 implementations of Patch function:
The PR mentioned by @jorisdg is actually a very similar fix to this problem but for a different Patch implementation (the first in the list above).
This problem with |
Beta Was this translation helpful? Give feedback.
According to the documentation, there are 3 implementations of Patch function:
Patch( DataSource, BaseRecord, ChangeRecord1 [, ChangeRecord2, … ])
- ImplementedPatch( DataSource, BaseRecordsTable, ChangeRecordTable1 [, ChangeRecordTable2, … ] )
- Not implemented yetPatch( Record1, Record2 [, …] )
- The one you are trying to execute. Contains known issues.The PR mentioned by @jorisdg is actually a very similar fix to this problem but for a different Patch implementation (the first in the list above).
The following code is similar to yours but execute a different implementation (the first in the list above).