instanceCount in schedxaction

John Ralls jralls at ceridwen.us
Wed Jul 17 20:57:00 EDT 2024



> On Jul 12, 2024, at 22:40, gnucash at 4forl1st5.slmail.me wrote:
> 
> First up: need to point out that I'm running a modified 2.6.21a,
> but few gnucash-devs would recognise the source tree its built
> from as being such, as it's been rolled forwards a few versions
> past the directory layout changes!
> 
> Secondly, the potential inconsistency I'm seeing doesn't affect
> the functionality of the application.
> 
> 
> Had been thinking about taking the XML stanzas for the schedxaction
> entries in my dot-xac GnuCash files and mangling them into generic
> calendar (VCal) entries that I could then use external to GnuCash.
> 
> For the schedxaction I have first looked at, I have noted 
> (some info replaced/truncated)
> 
> <gnc:schedxaction version="2.0.0">
>  <sx:id type="guid">e468...</sx:id>
>  <sx:name>SX Name</sx:name>
>  <sx:enabled>y</sx:enabled>
>  <sx:autoCreate>n</sx:autoCreate>
>  <sx:autoCreateNotify>n</sx:autoCreateNotify>
>  <sx:advanceCreateDays>0</sx:advanceCreateDays>
>  <sx:advanceRemindDays>0</sx:advanceRemindDays>
>  <sx:instanceCount>24</sx:instanceCount>
>  <sx:start>
>    <gdate>2023-08-30</gdate>
>  </sx:start>
>  <sx:last>
>    <gdate>2024-07-03</gdate>
>  </sx:last>
>  <sx:templ-acct type="guid">548e...</sx:templ-acct>
>  <sx:schedule>
>    <gnc:recurrence version="1.0.0">
>      <recurrence:mult>2</recurrence:mult>
>      <recurrence:period_type>week</recurrence:period_type>
>      <recurrence:start>
>        <gdate>2023-08-30</gdate>
>      </recurrence:start>
>    </gnc:recurrence>
>  </sx:schedule>
> </gnc:schedxaction>
> 
> 
> By my reckoning, the dates for that schedxaction
> (Every 2nd Week on a Weds since StartDate,
> with no End, Date nor Number) are
> 
> 1  2023-08-30    start
> 2  2023-09-13
> ...
> 22  2024-06-19
> 23  2024-07-03    last  But 23 not 24 as in the instanceCount above ?
> 24  2024-07-17
> ...
> 
> so I was wondering why the "instanceCount" was stored as 24 and not 23 ?
> 
> If it's correct, then I'm thinking it'd just be some logic within the
> code that would be what requires it to be stored as a "nextInstance", 
> but I just thought to ask about it, in case something I'd been doing
> had caused that potential inconsistency?
> 
> I could see that a schedxaction without an end could be computed
> from the last date, plus the recurrence data, so wouldn't need 
> to "know" the count, anyway, in which case you'ld only be storing
> an instanceCount so as to aid modifying the schedxaction via the
> dialog: so perhaps that's it?
> 
> I'm sure someone will know ?

The instance count is the number of the *next* instance. It’s set to 1 when an SX is created (gnucash/gnome/dialog-sx-editor.c line 1502) and incremented every time the SX creates a new transaction.

Regards,
John Ralls



More information about the gnucash-devel mailing list