Sections can be enabled / disabled sections during runtime. The following codes demonstrate how to retrieve a dynamic parameter to determine the sections to be rendered:
(Written at the report template, “On Render Begin” of the Report)
=Code Snippet =
//Get the list of sections
reportList = this.getSectionList();
ltIter = reportList.listIterator();
while (ltIter.hasNext())
{
tempString = (ltIter.next()).toString();
tempFlag = "True";
//Retrieve parameter and pass in to StringTokenizer to separate the string, ',' is the delimiter
st = new java.util.StringTokenizer
(Properties.getProperty("ListOfSections"),",");
//Enable / Disable Section
while (st.hasMoreTokens())
{
if(tempString.equals(st.nextToken()))
{
tempFlag = "False";
}
}
if(tempFlag.equals("True"))
{
ltIter.remove();
}
}
Sample parameter pass-in: Section 1, Section 2
The parameter passed in are separated by the !StringTokenizer() and for loop set the flag to enable the sections.
Please change the following .txt to .jar
DynamicSection.txt