I have the following code that I am writing inside BRIO (Hyperion Interactive Reporting Studio). The code is either in JavaScript or JScript, though I am not sure which as I am just learning the syntax and am not sure how they differ.
Anyway, I am getting syntax Script(line number) missing; before statement
error on the following lines:
if (xYear == 2012 && yMonth == 10) {stopIt = "Yes"} else (yMonth == 12) {stopIt = "Yes"}
and
var myDate = New Date(xYear, yMonth, 1)
in the code below.
var xYear
var yMonth
for (j = 2009; j = 2012; j++)
{
xYear = j
if (xYear == 2009) {yMonth = 7} else {yMonth = 1}
var StopIt = "No"
Do
{
var myDate = New Date(xYear, yMonth, 1)
Alert (myDate)
//var myQuery = ActiveDocument.Sections["qry_billing"]
//myQuery.Limits["Accounting Year Month"].CustomValues.RemoveAll()
//myQuery.Limits["Accounting Year Month"].CustomValues.Add(myDate)
//myQuery.Limits["Accounting Year Month"].SelectedValues.Add(myDate)
//myQuery.Process()
//var Path = "W:\\Major Accounts\\Alliance Process\\AAA\\reference_files\\Results"
//var File = "Results" + "_" + xYear + "_" + yMonth+ " .txt"
//ActiveDocument.Sections["Results"].Export(Path + "\\" + File,bqExportFormatText,true)
yMonth = yMonth + 1
if (xYear == 2012 && yMonth == 10) {stopIt = "Yes"} else if (yMonth == 12) {stopIt = "Yes"}
}
While (stopIt != "Yes")
}
Can someone please help me fix this issue, as I don't understand why it's asking me for the ;
, as I thought it wasn't even needed in BRIO document scripts.
Should be:
And when you indent the code properly, it's easy to notice this error:
Notes: javascript is case sensitive which means
Do
isn'tdo
alert
instead ofAlert
new
instead ofNew
But semicolons are not mandatory, you can use them or use not, as you wish.
Update:
From looking at the full code you posted, man, it has lots of weird things.
Should be something like:
You define a variable:
But use
stopIt
instead:You should take a javascript course\tutorial, it's not that difficult to learn, but your code in it's current state is totally broken!