Report Beforefactory chart drop errors in interactivity

Options
abhiallen
edited February 11, 2022 in Analytics #1
I am working on the report which changes the design mased on user input date range params which is set in initialize. I wrote a script in beforefactory which drop 2 charts based on the daterange param and only render and execute only 1 chart and corresponding dataset.

Report execute successfully but during interactivity, any action would throw exception of cannot execute beforefactory script below:

DaysChart = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("dayschart");
HoursChart = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("hourschart");
WeeksChart = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("weekschart");


if (chartType == "days"){
HoursChart.drop();WeeksChart.drop();
}
else if( chartType == "hours"){
WeeksChart.drop();DaysChart.drop();
}
else if(chartType == "weeks"){
HoursChart.drop();DaysChart.drop();
}
else{
}

How do i change this script so that this run only with the initial report generation/rendering and not during with any interactivity action.

Thanks
Abhishek

Comments

  • kclark
    kclark E
    edited December 31, 1969 #2
    Options
    Can you post the full output of the error you are getting and recreate this with the sample db and attach it?
    Warning No formatter is installed for the format ipb
  • abhiallen
    edited December 31, 1969 #3
    Options
    <blockquote class='ipsBlockquote' data-author="'kclark'" data-cid="111742" data-time="1353507540" data-date="21 November 2012 - 07:19 AM"><p>
    Can you post the full output of the error you are getting and recreate this with the sample db and attach it?<br /></p></blockquote>
    <br />
    <br />
    There are errors evaluating script "DaysChart = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("dayschart"); HoursChart = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("hourschart"); WeeksChart = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("weekschart"); if (chartType == "days"){ HoursChart.drop();WeeksChart.drop(); } else if( chartType == "hours"){ WeeksChart.drop();DaysChart.drop(); } else if(chartType == "weeks"){ HoursChart.drop();DaysChart.drop(); } else{ }": TypeError: Cannot call method "drop" of null (/report/method[@name=&quot;beforeFactory"]#7) (Element ID:1)
  • JasonW
    edited December 31, 1969 #4
    Options
    Are you sure this script is in the beforeFactory? If this script is in the initialize you will get an error.

    Jason