Re-run BQL in HTML/javascript?
Closed this issue · 2 comments
brush701 commented
Is it possible to access the bql query in our HTML scrips? I'd like to be able to have the user input a date and re-run the query as of that date. I think that you can do something like this by using the fava search parameters, but I want to be able to display different queries side by side (e.g., current year balance sheet vs last year). Any way to accomplish this? Thanks!
andreasgerstmayr commented
The queries[].bql
field can be a Jinja template, so you can write something like
SELECT payee, position WHERE year = {{ request.args.get('year') }}
and put the year in the query string:
http://localhost:5000/beancount/extension/FavaDashboards/?dashboard=1&year=2024
Probably you could also create a HTML panel with a <form>
and an input field for the year, iirc the values of the <input>
fields of the <form>
will be appended to the query string.
brush701 commented
This works great, thanks!