General Report Manager

## Opening General Report Manager

Call General Report Manager (GRM) tool or use main menu ``Tools` → `General Report Manager…`` .

## Adding a new report

There are 2 options available.

### Creating the report from scratch

1. Using the Navigator, mouse right-click on the ``Reports`` label.
2. Choose the menu item: ``New Empty Report``.
3. Enter the name for the new report group and the new name.
4. Rename reports, if required, by right-clicking on the menu item: ``Rename Report``.
5. Five tabs will be displayed: Output, SQL, Lua, Template and Description.
6. Choose the tab: SQL, insert the SQL script into the editor window, check that the SQL script finishes with a semicolon, then press the ``Save`` button.
7. Press the ``Test`` button to execute the SQL script.
8. If the test is passed the ``Create Template`` button will become available. Press it to generate an HTML template for the report.
9. Press the ``Run`` button to get the HTML report in the Output window.

#### Report Parameters

For MMEX version 1.3.4 there is a possibility to transfer dates into a report’s SQL script. There are three options available: &single_date, &begin_date, &end_date. In case if a SQL contains one of the parameter above it will be replaced with a date from a calendar widget. For example, this SQL script returns all accounts balances for the specified date:

    with b as  (
        select ACCOUNTID, STATUS
            , (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT
            , TRANSDATE
        from CHECKINGACCOUNT_V1
        where STATUS <> 'V'
            and TRANSDATE <= '&single_date'
        union all
        select TOACCOUNTID, STATUS
            , TOTRANSAMOUNT ,TRANSDATE
        from CHECKINGACCOUNT_V1
        where TRANSCODE = 'Transfer'
            and STATUS <> 'V'
            and TRANSDATE <= '&single_date'
        )
    select a.ACCOUNTNAME, a.ACCOUNTTYPE,
    total(TRANSAMOUNT) + a.INITIALBAL as Balance
    from ACCOUNTLIST_V1 as a
    left join b on a.ACCOUNTID=b.ACCOUNTID
    where a.STATUS = 'Open'  and a.ACCOUNTTYPE !='Investment'
    group by a.ACCOUNTNAME order by a.ACCOUNTNAME asc;

### Importing report

There are a lot of reports provided by users or developers on GitHub.

## Exporting report definition

If you have created any helpful report it may be exported into ZIP file.