I'm new to javascript and I need to create a function that will change a period parameter into a date. Example would be 200804 would need to be shown as April 2008.
I was given an example of a function to do this which is listed below.
function Period_to_LongMonthYear(iPer)
{
var sPer;
var sYear;
var mon;
var Month_Titles;
var aMonth_Titles;
Month_Titles = "January February March April May June July August September October November December";
aMonth_Titles = Month_Titles.split(" ");
sPer = String(iPer);
mon = sPer.substr(4,2);
sYear = sPer.substr(0,4);
return(aMonth_Titles[(mon * 1)-1] + " " + sYear);
}
On my report I used the following to display the results in the header.
jscript:"From " + Period_to_LongMonthYear(req.Option("INTEGER.PERIOD").Value);
When the report runs, I get the following error:
ERROR: Script evaluation failed for script
Is there something wrong with the function or my formula on the report or both?
Thanks for any help.
I was given an example of a function to do this which is listed below.
function Period_to_LongMonthYear(iPer)
{
var sPer;
var sYear;
var mon;
var Month_Titles;
var aMonth_Titles;
Month_Titles = "January February March April May June July August September October November December";
aMonth_Titles = Month_Titles.split(" ");
sPer = String(iPer);
mon = sPer.substr(4,2);
sYear = sPer.substr(0,4);
return(aMonth_Titles[(mon * 1)-1] + " " + sYear);
}
On my report I used the following to display the results in the header.
jscript:"From " + Period_to_LongMonthYear(req.Option("INTEGER.PERIOD").Value);
When the report runs, I get the following error:
ERROR: Script evaluation failed for script
Is there something wrong with the function or my formula on the report or both?
Thanks for any help.