I’d love to help but I’m not sure I understand the problem.
Is it that the {1} {2} etc parameters are different for different sorts of contracts and therefore you cannot just use
Format(
thisRow.DocType.Template,
valueForParam1,
valueForParam2,...
)
?
There’s a few ways. The first way is to just standardize your mapping of number to field, and in certain templates you can just omit certain numbers, i.e. making a contract template that reads, e.g., Item {23}
is okay, too.
The second way is to move past named placeholders and implement named ones, e.g. I like the handlebars style like {{Name}}
. There is a pack that can do it that’s free and by a Codan (@Eric_Koleda) — or if you need it more rapidly it can also be done locally but it requires a little formula stretching — actually this could be a topic for my tomorrow’s video because why not.