If anybody is interested in connecting bank accounts in countries like the UK, 
the project
is now available at:
https://github.com/Dreamsorcerer/gnucash-gocardless-import

On Mon, 2025-04-14 at 22:53 +0100, Sam Bull wrote:
> On Mon, 2025-04-14 at 11:44 -0400, John Ralls wrote:
> > > A way to search for transactions (or splits maybe?) in the account.
> > 
> > See https://code.gnucash.org/docs/STABLE/group__Query.html
> 
> I've loaded all the splits into memory and searched directly in Python for 
> the moment.
> But, I'll try the Query API again later, when I have the motivation to figure 
> it out.

I tried it today, but that documentation seems no better than blindly guessing 
in an
interpreter. I tried to query an account for all transactions after a certain 
date, but
got nowhere close to achieving it.

My guess is that I need to create a Query instance (`q = gnucash.Query()`), 
probably need
to call `q.set_book(session.book)`, but anything after that I can't figure out.

I can't see anything to search a specific account at all. I also can't figure 
out the date
search. I've tried using q.date_predicate() or gnucash.QueryDatePredicate(), 
but can't
actually call them. The options parameter seems to expect a constant which only 
appears
under the C module, but even then still gives a TypeError:

   >>> q.date_predicate(gnucash.gnucash_core_c.QOF_DATE_MATCH_NORMAL, 
date(2025, 4, 12))
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "/usr/lib/python3/dist-packages/gnucash/function_class.py", line 108, 
in method_function
       return getattr(self._module, function_name)(
     File "/usr/lib/python3/dist-packages/gnucash/gnucash_core_c.py", line 
2288, in qof_query_date_predicate
       return _gnucash_core_c.qof_query_date_predicate(how, options, date)
   TypeError: in method 'qof_query_date_predicate', argument 1 of type 
'QofQueryCompare'

Even if I get that to work, I'm not clear how to make that predicate mean 
_after_ that
date. I'm also not clear if that is meant to modify the current query or I need 
to do
something else to combine etc.

Thanks,
Sam

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
gnucash-user mailing list
[email protected]
To update your subscription preferences or to unsubscribe:
https://lists.gnucash.org/mailman/listinfo/gnucash-user
-----
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.

Reply via email to