r3 - 04 Sep 2007 - 02:10:58 - IrwinTanYou are here: TWiki >  Main Web  >  ElixirReport > ElixirReportCookbook > SectionInvocation

Section Invocation

Sections can be enabled / disabled sections during runtime. The following codes demostrate how to retrieve a dynamic parameter to determine the sections to be rendered :-

- Code Snippet -
(Written at the report template, 'On Render Begin' of the Report)

  //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

Parameter passed in are separated by the StringTokenizer() and for loop set the flag to enable the sections.

toggleopenShow attachmentstogglecloseHide attachments
Topic attachments
I Attachment Action Size Date Who Comment
elsejar DynamicSection.jar manage 3.0 K 04 Sep 2007 - 02:10 IrwinTan Sample
Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r3 < r2 < r1 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback