Page 1 of 1

Selectable date range

Posted: Wed Feb 02, 2022 6:23 am
by dbolton
Any way to make a selectable date range for reports in the customizable General Reports Manager (similar to the built-in reports)?

Re: Selectable date range

Posted: Wed Feb 02, 2022 8:48 am
by whall3y
Use &from_date and &end_date in your SQL.

Not sure if any of the example reports use this, but the AccountBalances shows how to use a single date - so you will get help looking at that for what to do in SQL and template as neccessary
https://github.com/moneymanagerex/gener ... ntBalances

E.g.

Code: Select all

    select ACCOUNTID, STATUS
        , (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT
        , TRANSDATE
    from CHECKINGACCOUNT_V1    
    where STATUS <> 'V'
        and TRANSDATE >= '&from_date'
        and TRANSDATE <= '&end_date'

Re: Selectable date range

Posted: Fri Feb 04, 2022 5:52 am
by dbolton
Thank you for that! Here's what I found so far.
  • You must include the single quotes around '&from_date' and '&end_date' to avoid an SQL error (like your example showed, but I accidentally omitted them my first time).
  • You must add both the '&from_date' and '&end_date' to the SQL for the date menu to appear in Money Manager EX (I initially experimented with just the '&from_date' but that doesn't do anything).
I'm working with a variation of the Transation-Withdrawals report. If I add the following WHERE clause to the very bottom of the SQL, it seem to always show all withdrawals regardless of the date range I select.

Code: Select all

WHERE 
	wd_data.date >= '&from_date'
	AND wd_data.date <= '&end_date'
ORDER BY date ASC;
Any idea what I'm missing?

Re: Selectable date range

Posted: Fri Feb 04, 2022 10:55 am
by whall3y
My error, it should be begin_date and end_date

Re: Selectable date range

Posted: Fri Feb 04, 2022 12:51 pm
by Nikolay

Re: Selectable date range

Posted: Fri Feb 04, 2022 9:04 pm
by dbolton
That did the trick! Thank you!