11-14-2021, 09:34 AM
(This post was last modified: 11-14-2021, 09:36 AM by BoolTaxCoder.
Edit Reason: forgot to mention that it runs once when QM starts
)
Hi guys,
i'm new here, my first post
So i need for several macros and autotext a global variable that contains the quarter of the last month.
- We have now November 2021 so the question is: To which quarter belongs October 2021 (previous month)?
- Send me this back in a variable (letztesQuartal) in this Style (October = 4th quarter in 2021): Q4/2021.
- This runs as function once when i start QM.
I get what i want with my code. But i guess it could be written much better.
Any ideas?
Thanks for your ideas and stay healthy
Achim
i'm new here, my first post
So i need for several macros and autotext a global variable that contains the quarter of the last month.
- We have now November 2021 so the question is: To which quarter belongs October 2021 (previous month)?
- Send me this back in a variable (letztesQuartal) in this Style (October = 4th quarter in 2021): Q4/2021.
- This runs as function once when i start QM.
I get what i want with my code. But i guess it could be written much better.
Any ideas?
Thanks for your ideas and stay healthy
Achim
function'str
str Monat
str brauchbaresMonatsDatum
DateTime pcDatum.FromComputerTime
pcDatum.AddMonths(-1) ;; calc previous month
Monat = brauchbaresMonatsDatum.timeformat("{MM}" pcDatum) ;;format to month
int rechner = val(Monat) ;; val = converter like .ToInteger
rechner = (rechner + 2) / 3 ;; Formula if Ceiling isn't available
;; pull Year
str brauchbaresJahresDatum
str Jahr
Jahr = brauchbaresJahresDatum.timeformat("{yyyy}" pcDatum) ;;format Year
str Teileins
str Teilzwei
str Teildrei
str Teilvier
Teileins = "Q"
Teilzwei = rechner
Teildrei = "/"
Teilvier = Jahr
str+ letztesQuartal ;; str+ sets global available variable
letztesQuartal.from(Teileins Teilzwei Teildrei Teilvier)
out letztesQuartal