Good morning, all!
Back in January, I posted a question about having problems with date parameters getting cached on a scheduled job, and received this code (which I put in the beforeFactory script), and it works perfectly:
var paramDate = "" + (params["HIDDEN_ReferenceDate"].value).getTime(); //Get reference parameter value as string
var currentDate = "" + (BirtDateTime.today()).getTime(); //Get current day as string
if(paramDate !== currentDate){ //If reference parameter and current day dont match then this is a scheduled report
iterator = reportContext.getDesignHandle().getParameters().iterator(); //Get report parameters
while (iterator.hasNext()) { //Loop through each report parameter
scalarParameterHandle = iterator.next(); //Get next report parameter handle
var paramName = scalarParameterHandle.getName(); //Get parameter name
var defaultValue = "" + scalarParameterHandle.getDefaultValueList()[0]; //Get parameter default value
if(defaultValue.indexOf("BirtDateTime")>-1) //If the parameter uses BirtDateTime for dynamic value
params[paramName].value = eval(defaultValue); //Update the parameter value with new dynamic value
}
}
Now, I'm trying to do the same thing with a datadesign (that is scheduled to run every 30 minutes), but am having issues with it. It seemed to run fine yesterday (before midnight), but subsequent runnings after midnight failed. The errors I'm getting are pointing to the above script. I thought I had copied out the exact error, but it didn't get captured.
My question: Is there a way to use the above script in generating the data object? Right now, I have it in the beforeOpen of one of the data sets, but I'm guessing it's not the correct place. Unfortunately, there aren't as many places in a datadesign to bury a script as there are in a report design.
Thanks in advance for any help!
Scott