There is really no need to use a global variable here or have the function run at startup.
You can call it on demand using a function and local variables easy.
Can also simplify the code a bit.
create a Function and call that function from code when ever you need the value.
Function QuarterOfLastMonth
call this function any other function or macro
example from another function or macro
Function Function4
for Autotext can call it like this.
Two possible ways shown below.
One using a subfunction to call the function and one without using a subfunction at all.
Autotext Autotext18
Trigger $t
You can call it on demand using a function and local variables easy.
Can also simplify the code a bit.
create a Function and call that function from code when ever you need the value.
Function QuarterOfLastMonth
function str&lq
DateTime pcDatum.FromComputerTime
pcDatum.AddMonths(-1) ;; calc previous month
lq.from("Q" (val(pcDatum.ToStrFormat("{MM}")) +2 /3) "/" pcDatum.ToStrFormat("{yyyy}"))
call this function any other function or macro
example from another function or macro
Function Function4
for Autotext can call it like this.
Two possible ways shown below.
One using a subfunction to call the function and one without using a subfunction at all.
Autotext Autotext18
Trigger $t