Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Issue with custom function

Status
Not open for further replies.

scoobyroo

Programmer
May 10, 2007
47
US
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.
 
[ ]
What is this?:

sPer = String(iPer);

I don't see that variable anywhere else in your function.

mmerlinn


"Political correctness is the BADGE of a COWARD!"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top