docx-stamper icon indicating copy to clipboard operation
docx-stamper copied to clipboard

Replacing Expressions in a .docx Template but outputting Variable Value

Open codewithpav opened this issue 4 years ago • 2 comments

Hi there

Apologies if this has been dealt with already but I know that it's possible to do:

${person.name.equals("Homer") ? "Duff" : "Budweiser"}

But I'm struggling to get this to work so that a value from another variable is displayed instead.

${person.surname.equals("Homer") ? ${person.favourite_drink} : "Duff"}

Any help would be appreciated.

Thanks

Pav

codewithpav avatar Dec 09 '20 07:12 codewithpav

Try this:

${person.surname.equals("Homer") ? person.favourite_drink : "Duff"}

thombergs avatar Dec 09 '20 07:12 thombergs

This is perfect. Thank you for your quick response.

Thanks again.

Pav

codewithpav avatar Dec 09 '20 08:12 codewithpav