How to create conditional variables at start of document then assign it to regular variable

I have a Writer document that will change some key words in the document depending on the value of a variable CountryCode. If CountryCode=“US” then I have a dozen different variables to be assigned values that needs to get set if CountryCode=“US”. Like variable Currency=“USD” and Country=“United States”. If CountryCode=“CDN” then Currency=“CAN” and Country=“Canada”. The variables Currency and Country appear throughout the document. This is a very large document and rather than use conditional variables throughout the document, I only want to define the conditional values once at the start of the document on the first page that doesn’t get printed, and assign the conditional variables value to ordinary variables at the start of the document. This allows me to insert only simple variables throughout the document and not have to repeat the same conditional logic over and over again for the same Currency variable. So only variables “Currency” and “Country” are used in the document pages 2 to 1000. Does this make sense to you?

Try to use Custon Document Properties (File - Properties - Custom properties), insert them into the document, and write a macro to change the values of them when it needed.

1 Like