No, unfortunately that isn’t possible today. Pack formulas can only operate on simple types, such as strings, numbers, dates, booleans, and arrays of those. While you can’t pass an entire row, you can of course pass the contents of a row, by mapping each column to a formula parameter.
Can you provide some more background on what you are trying to accomplish?
We have a token substitution system in our applicant tracking system that:
is a hassle to maintain because it has to be re-implemented in every table it’s used (is not DRY),
and can’t be extended with the features we want because of Coda’s limited regex capabilities.
It’s input is a message and one or more rows:
{{ applicant.firstName }}, thanks for applying for the {{ position.label }} position!
Then uses the row data to create the personalized message:
Eric, thanks for applying for the GIVE ME MOAR PACK FEATURES position!
–
I was hoping that we could use packs to standardize and extend the feature. In this case, I would be passing Applicant and Position objects to the pack function alongside the message template.
More generally, there are a lot of use-cases like this where I have some pretty sophisticated (and gnarly / hard to maintain) columns that take a row as input that I’d love to refactor with JS or enhance with pack-based code.
Rather than having to pass every property individually, I’d rather pass the object and figure out which column is which in the pack, or define the mapping once in a configuration section and be good to go.
–
As a separate matter, I recently learned about the new / hidden Object() function and plan on using that to create that mapping of row objects that I’ll be passing to my Pack.
Thanks for the context @Christian_Rodriguez3. I can totally see how passing a row or table would make sense for a templating formula, and I’ll pass this feedback on to the team.
Unless you pass the row ID to the Pack and then use the Coda API to extract the entire row object. Indeed, this works but it’s like turning off a light switch with a wrecking ball. And, if the Pack needs to reach out to other domains, you need to compel the Codans to allow access to more than one domain.
For anyone that comes across this, I decided on creating a column in each table of note called “Object” that uses the Object method to create a JSON representation of that row. Then I pass that object around and provide it to my pack methods to simplify operations (for internal packs, anyways)