Example Wizard code

This is the code that was generated by the example covered in Using the Report Data Wizard

 SCHEMA officestore 

 TYPE officestore_data RECORD
    account RECORD
        userid LIKE account.userid,
        email LIKE account.email 
    END RECORD,
    orders RECORD
        orderid LIKE orders.orderid,
        orderdate LIKE orders.orderdate,
        shipaddr1 LIKE orders.shipaddr1,
        shipaddr2 LIKE orders.shipaddr2,
        shipcity LIKE orders.shipcity,
        shipstate LIKE orders.shipstate,
        shipzip LIKE orders.shipzip 
    END RECORD
 END RECORD

 FUNCTION run_officestore_to_handler(handler)
    DEFINE
        data officestore_data,
        handler om.SaxDocumentHandler 
    DECLARE cur CURSOR FOR
        SELECT 
            account.userid,
            account.email,
            orders.orderid,
            orders.orderdate,
            orders.shipaddr1,
            orders.shipaddr2,
            orders.shipcity,
            orders.shipstate,
            orders.shipzip 
        FROM 
            account,
            orders 
        WHERE 
            orders.userid = account.userid 
        ORDER BY
            account.userid 

    START REPORT officestore_report TO XML HANDLER handler 
    FOREACH cur INTO data.*
       OUTPUT TO REPORT officestore_report(data.*)
    END FOREACH
    FINISH REPORT officestore_report 
    CLOSE cur 
 END FUNCTION

 REPORT officestore_report(data)
    DEFINE
        data officestore_data 
    ORDER EXTERNAL BY 
        data.account.userid 

    FORMAT
        ON EVERY ROW
            PRINT data.*
 END REPORT
Note:

See The BDL File for additional information about the BDL functions and statements used in conjunction with reports.