Feeding the report data from an XML file

Report data can come from an XML file.

To feed the report data from an XML file, use the runFromXML method. You can use this method for objects created from the DataConsumer, FourRpLayouter, FourRpProcessor or RemoteConnection class.

To use any of these classes, you must import the com.fourjs.report.runtime package:
import com.fourjs.report.runtime.*;
Once you create an instance of a report object, you can feed the report data using the runFromXML method:
//Create the report object
FourRpLayouter report = new FourRpLayouter(designFile, renderer);

//Run report from XML file:
report.runFromXML("my_data_file.xml");

Format of the incoming XML file

The XML file should be organized with Report, Group and OnEveryRow elements. For example:
<Report>
  <Group>
    <Group>
      <Group>
        <OnEveryRow>
          <orderline.orders.orderid>5</orderline.orders.orderid>
          <orderline.orders.userid>bloggs</orderline.orders.userid>
          <orderline.orders.orderdate>2014-06-24</orderline.orders.orderdate>
          ...
          <lineitemprice>122.0</lineitemprice>
          <overalltotal>122.0</overalltotal>
          <usertotal>122.0</usertotal>
          <ordertotal>122.0</ordertotal>
        </OnEveryRow>
      </Group>
      ...