View Single Post
 
Old 04-04-2020, 03:22 PM
eduzs eduzs is offline Windows 10 Office 2019
Expert
 
Join Date: May 2017
Posts: 262
eduzs is on a distinguished road
Default Advanced field coding, given date instead of today.

I have this field code that works fine:

Code:
{ SET xM{ = { DOCVARIABLE dt1 \@ M}} }{ SET xMM{ = { DOCVARIABLE dt1 \@ MM}} }{ SET xY{ = { DOCVARIABLE dt1 \@ yyyy}} }

{ QUOTE { SET Delay 1 } { SET m { =MOD({ xMM }+Delay+11;12)+1 } }{ SET y { =INT({ xY }+(Delay+{ xM }-1)/12) } } “{ m }-{ y }” \@ “MMMM/yyyy” }
But I want to define a variable to repeat the field elsewhere in the document, saving space / lines (no need to repeat this long field code).

I tried this:

Code:
{ SET xDate{={ QUOTE { SET Delay 1 } { SET m { =MOD({ xMM }+Delay+11;12)+1 } }{ SET y { =INT({ xY }+(Delay+{ xM }-1)/12) } } “{ m }-{ y }” \@ “MMMM/yyyy” }}}
{ xDate \@ “MMMM/yyyy” }
But this returns an error: unexpected end of formula.

Thanks in advance
__________________
Backup your original file before doing any modification.

Last edited by eduzs; 04-04-2020 at 05:58 PM.
Reply With Quote