Quantcast
Channel: SCN : Discussion List - SAP BusinessObjects Design Studio
Viewing all articles
Browse latest Browse all 4041

Defining Last x Months Variables(ArrayString)

$
0
0


Hi DS Gurus,

I am going bald in struggling in 2 area:

 

1) How can I get the last 12 or 6 months from today's date (ie. for Nov 27, 2014.. last 6 months would be: June,July,Aug,Sept,Oct,Nov)

 

//Below is what I have but if they go under 1(Jan) then it'd become 0 or negative numbers..

var var_CurrentMonth = Convert.stringToInt(Convert.subString(APPLICATION.getInfo().dateNowInternalFormat, 4,6));

 

var var_Month1 = var_CurrentMonth - 1;

var var_Month2 = var_CurrentMonth - 2;

var var_Month3 = var_CurrentMonth - 3

var var_Month4 = var_CurrentMonth - 4;

var var_Month5 = var_CurrentMonth - 5;

var var_Month6 = var_CurrentMonth - 6;

var var_Month7 = var_CurrentMonth - 7;

var var_Month8 = var_CurrentMonth - 8;

var var_Month9 = var_CurrentMonth - 9;

var var_Month10 = var_CurrentMonth - 10;

var var_Month11 = var_CurrentMonth - 11;

 

 

 

2) After having the months, I have to add a "0"(zero) to any month that has only 1 digit so for Jan = 01, Feb =02 but skip adding "0" if its Oct/Nov/Dec which end result would be a string.

 

Any help is appreciated since I don't have much hair to pull out soon...

 

Thanks a lot!!
-Randy


Viewing all articles
Browse latest Browse all 4041

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>