[GNC] gncJobNextID in gncJob.c not in gncJob.h

Robert Simmons rsimmons0 at gmail.com
Sun Aug 7 16:13:11 EDT 2022


I have a workaround.

Here's the Python for anyone who needs it. This sets the Job ID counter to
3, but you would change that 3 to whatever the ID you want.

import pathlib
import sqlite3

target = pathlib.Path('test.gnucash')
con = sqlite3.connect(target)
cur = con.cursor()
cur.execute('UPDATE slots SET int64_val = int64_val + 1 WHERE name =
"counters/gncJob"')
con.commit()
con.close()

Alternatively, if you're creating many Jobs using Python bindings, just
keep a count and use this alternative update. This takes a integer variable
"count" that you calculate while using Python bindings.
cur.execute(f'UPDATE slots SET int64_val = int64_val + {count} WHERE name =
"counters/gncJob"')


More information about the gnucash-user mailing list