How to define formula parameter that can accept multiple types?

I want to have a parameter that can accept multiple types, specifically either a Coda Date or a string. However, the documentation seems to imply each parameter can only have a single type.
Is this possible somehow?

No. You can’t have a single parameter natively support multiple types.

You could probably use two optional parameters though. One date and one string giving your users the option

1 Like

Thanks for the response! I guess that’s a feature request then.

This could be solved by either allowing an array of types, or having an “any” parameter type, then the function can take care of figuring out what its type is. The former is less error prone, the latter can be more flexible.

(having two optional parameters may solve the immediate problem, but is a poor API to expose to users)

1 Like

try making the parameter a string type.
then i would expect coda to cast a date type to string for you.
your pack can then parse the string version of dates.

not in my office, so cant test this yet.

1 Like

Thanks for the feature request! We’ve heard similar wishes from other makers, so I’ll raise it with the team again. Can you provide any more color about your particular use case for a feature like this?

It works, I do this all the time.