Page 1 of 1

How to get previous month in the sequence/Basic language

Posted: Fri Nov 25, 2016 7:37 pm
by chandu123
I am passing parameters to a Job activity in the sequence. I have two parameters current month (YYYYMM format) and previous month (YYYYMM) format. Is there a way to derive previous month from the current month (preferably in the Value Expression section of the Job Activity)?

Please suggest.

Posted: Fri Nov 25, 2016 9:09 pm
by JRodriguez
...and you have the current month, right? Then it will be a matter of date arithmetic. Resolved the first day of the current month and substract 1 day to it.
OConv(Iconv(CurrMonth:"01" ,"D YMD[4,2,2]") - 1), "D YM[4,2]")

I would suggest to do this in a user variable and then pass the user variable to the job's parameter instead of doing this logic directly on the value expression for the paraneter

Posted: Sat Nov 26, 2016 4:23 am
by ray.wurlod
Take a look at the date Transforms supplied in every project. There are useful, pre-defined Transforms for things like MONTH.FIRST and MONTH.LAST, which can recognize a MONTH.TAG structure such as you are using.