Possibility to use more than 2 varargs

Hi Coda community!

For my pdf generation pack (connecting docMaker.co APIs), I am using varargs to let the users map their data with the variables in their docx templates.
So I have 2 varargs:

  • one is the key, retrieved from the user’s template in docMaker
  • the second is the value, provided by users in Coda:

But I also need to offer users the possibility to define other arbitrary key/ value pairs.
And it does not seem to work when adding one or more varargs in the code (then all varargs disappear).

Any idea how I could do it?

Hi @Elian_Faggion - I was excited to see your Pack in the gallery, very cool! Unfortunately it’s a known limitation that the builder UI for a action formulas only supports one or two varargs. While more varargs are possible in the Formula editor, they cannot be exposed in the builder UI.

And to be clear, adding more varargs would add them to the existing set, not create a new set of key/value pairs. It’s only possible to have a single set of varargs.

While the UX isn’t as nice, the best workaround we have for creating additional sets of varargs (if that is your goal) is to have an optional string parameter that expects a JSON value returned by a helper formula. You can learn more about that approach in this other post:

1 Like

Thank you very much @Eric_Koleda! Very clear about the current limitations of varargs.
And thanks for your very smart solution! Especially because I have already created the helper function as part of my pack! :smiley:
It is called “CreateLineItemJson()” and generates a JSON object based on a series of key/ value pairs.
So I will add an optional parameter and instruct users to use this formula to add their additional key/value pairs.
Thanks a lot for your help! :+1:

1 Like