scheduledTransaction.occurrences
The next occurrence dates of a scheduled transaction, or of a Schedule not yet saved.
Lists the next count dates (default 10) a scheduled transaction will occur on, from its current state, or those of a
Schedule you have not saved yet (schedule, with startDate and end): the calendar GnuCash's editor shows while you
set one up. Each date comes with the instance number i it would have. Use it to check a Schedule before creating it.
Occurrences already due and not yet acted on are included; deferred (postponed) instances are not, they appear in Since
Last Run. A start on a weekend with a back adjustment skips the first occurrence, as in GnuCash.
Examples
Example: with a copy of the synthetic/rich example book open as book.gnucash.
JSON-RPC
Request:
{"jsonrpc":"2.0","id":1,"method":"scheduledTransaction.occurrences","params":{"scheduledTransaction":"52f96837087e9670c933f9421b0ac626","count":3}}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"occurrences": [
{
"date": "2024-10-01",
"instanceCount": 2
},
{
"date": "2024-11-01",
"instanceCount": 3
},
{
"date": "2024-11-29",
"instanceCount": 4
}
]
}
}
Request:
{"jsonrpc":"2.0","id":2,"method":"scheduledTransaction.occurrences","params":{"schedule":[{"mult":1,"periodType":"endOfMonth"}],"startDate":"2024-01-31","count":4}}
Response:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"occurrences": [
{
"date": "2024-01-31",
"instanceCount": 1
},
{
"date": "2024-02-29",
"instanceCount": 2
},
{
"date": "2024-03-31",
"instanceCount": 3
},
{
"date": "2024-04-30",
"instanceCount": 4
}
]
}
}
Command line
red-ale exec --book book.gnucash --script - <<'EOF'
scheduledTransaction.occurrences {"scheduledTransaction":"52f96837087e9670c933f9421b0ac626","count":3}
scheduledTransaction.occurrences {"schedule":[{"mult":1,"periodType":"endOfMonth"}],"startDate":"2024-01-31","count":4}
EOF
It prints:
[
{
"occurrences": [
{
"date": "2024-10-01",
"instanceCount": 2
},
{
"date": "2024-11-01",
"instanceCount": 3
},
{
"date": "2024-11-29",
"instanceCount": 4
}
]
},
{
"occurrences": [
{
"date": "2024-01-31",
"instanceCount": 1
},
{
"date": "2024-02-29",
"instanceCount": 2
},
{
"date": "2024-03-31",
"instanceCount": 3
},
{
"date": "2024-04-30",
"instanceCount": 4
}
]
}
]
MCP tool call
Tool call:
{"name":"scheduledTransaction.occurrences","arguments":{"scheduledTransaction":"52f96837087e9670c933f9421b0ac626","count":3}}
Result:
{
"structuredContent": {
"occurrences": [
{
"date": "2024-10-01",
"instanceCount": 2
},
{
"date": "2024-11-01",
"instanceCount": 3
},
{
"date": "2024-11-29",
"instanceCount": 4
}
]
}
}
Tool call:
{"name":"scheduledTransaction.occurrences","arguments":{"schedule":[{"mult":1,"periodType":"endOfMonth"}],"startDate":"2024-01-31","count":4}}
Result:
{
"structuredContent": {
"occurrences": [
{
"date": "2024-01-31",
"instanceCount": 1
},
{
"date": "2024-02-29",
"instanceCount": 2
},
{
"date": "2024-03-31",
"instanceCount": 3
},
{
"date": "2024-04-30",
"instanceCount": 4
}
]
}
}
Effect: read.
Params
Params of scheduledTransaction.occurrences: a scheduled transaction, or a Schedule not yet saved.
scheduledTransaction(Guid or null): Its occurrences from its current state.schedule(array of RecurrenceParam or null): Or a Schedule not yet saved, as never run.startDate(Date or null): The unsaved Schedule's start date; default today.end(End or null): The unsaved Schedule's end; default never.count(integer (uint)): How many, 1 to 1000.after(Date or null): Only occurrences after this date.
Result
The result of scheduledTransaction.occurrences.
occurrences(array of OccurrenceInfo, required): Ascending.