Aspose.Report – A unit test case for RDL element types

The following is RDL script used by one of unit test cases.

 <?xml version=”1.0″?>
 <report name=”Simple” startaction=”prepare_query”  librarydir=”E:\reporttools\src\Aspose\ReportTools\ReportTools.RDLElement\bin\Debug”>
   <variable name=”var_action_1″ value=”gather_data” />
   <variable name=”var_action_2″ value=”format_report” />
   <reportaction name=”prepare_query” nextaction=”check_sql” description=”generate the Sql script for reports”>
      <log message=”generate the SQL for report query!” level=”Debug” />
 <!– Putting the RDL elements that are used for specifying or assembling the SQL script here –>
      <variable name=”action_result” value=”good” />
      <if condition=”${action_result==’bad’}”>
         <variable name=”var_action_1″ value=”done” />
      </if>
   </reportaction>
   <reportaction name=”check_sql” nextaction=”${var_action_1}”>
      <log message=”the SQL is ${action_result}, so next action is ${var_action_1}!” level=”Debug” />
   </reportaction>
   <reportaction name=”gather_data” nextaction=”${var_action_2}”>
      <log message=”gather the data for report, its next action is ${var_action_2}!” level=”Debug” />
 <!– Putting the RDL elements that are used for retrieving the data here –>
   </reportaction>
   <reportaction name=”format_report” nextaction=”done”>
      <log message=”format report!” level=”Debug” />
 <!– Putting the RDL elements that are used for specifying the output type and layout here–>
   </reportaction>
   <reportaction name=”done”>
      <log message=”Done!” level=”Debug” />
   </reportaction>
 </report>




And here is the log information produced by this test case.

               First action specified: prepare_query 
               prepare_query:
                     [log] generate the SQL for report query!


               check_sql:
                     [log] The SQL is good, so next action is gather_data!


               gather_data:
                    [log] gather the data for report, its next action is format_report!
 .
               format_report:
                     [log] format report!


               done:
                     [log] Done!


We could get some feels about the RDL element types from the sample above. There are five RDL element types inside this RDL snippet that are report, reportaction, variable, if, and log, every element type has respective attributes and functionality, such as reportaction and if are mainly used for controlling the procedural flow, variable is used for specifying the new macro variables and assigning the value to existed variables, log is used for writing the log