Creating a report with dummy data

If your report does not contain data, you receive an error message. You can use a workaround to ensure your report always has at least one line of data and therefore avoid this error.

To add dummy data to SimpleReport.4gl, change the code as follows:

  • Replace all calls to OUTPUT TO REPORT report_all_orders(orderline.*) with OUTPUT TO REPORT report_all_orders(1,orderline.*). In other words, pass the INTEGER constant "1" in all calls.

  • Modify the REPORT function report_all_orders to include an additional INTEGER parameter called "root", and place this parameter at the first position in the ORDER EXTERNAL BY function.

The code will now look like this:

REPORT report_all_orders(root,orderline )
        root INTEGER,
        orderline OrderType,
        lineitemprice LIKE lineitem.unitprice,
        overalltotal LIKE orders.totalprice,
        usertotal LIKE orders.totalprice,
        ordertotal LIKE orders.totalprice

    ORDER EXTERNAL BY root,orderline.orders.userid, orderline.orders.orderid, orderline.lineitem.linenum

In the Data view, the root trigger is displayed as Group root. If the layout nodes for the page root are placed inside this trigger, it is safe to run the report even if OUTPUT TO REPORT is never called.