scheduledTransaction.sinceLastRun
Propose the due instances of every enabled scheduled transaction: the Since Last Run proposal, held by ID. Changes nothing.
Proposes the transactions of every enabled scheduled transaction that have fallen due up to today (and its advance
days), as GnuCash's Since Last Run window does, and changes nothing. The proposal is held by id (slr-1, …) until you
apply or discard it, 16 newer proposals push
it out, or the book closes.
Each instance has a state (toCreate, reminder, postponed), a date and the values of its variables, and, when
all variables are set, the transactions that creating it would make. Instances that need a value for a variable
other than i have value: null; give them in apply. readOnlyByDate marks instances before the book's
auto read-only date, which apply refuses unless you choose them by name.
red-ale never runs Since Last Run when a book opens; GnuCash does. Where GnuCash re-proposes instances that were already created after a postponed one, red-ale proposes each postponed instance and then only the new ones.
Examples
Example: with a new, empty book open as book.gnucash.
JSON-RPC
Request:
{"jsonrpc":"2.0","id":1,"method":"account.create","params":{"name":"Checking","type":"BANK","commodity":"USD"}}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "…"
}
Request:
{"jsonrpc":"2.0","id":2,"method":"account.create","params":{"name":"Rent","type":"EXPENSE","commodity":"USD"}}
Response:
{
"jsonrpc": "2.0",
"id": 2,
"result": "…"
}
Request:
{"jsonrpc":"2.0","id":3,"method":"scheduledTransaction.create","params":{"name":"Monthly rent","startDate":"2024-05-01","schedule":[{"mult":1,"periodType":"month"}],"templateTransactions":[{"description":"Rent","splits":[{"account":"Rent","debitFormula":"750"},{"account":"Checking","creditFormula":"750"}]}]}}
Response:
{
"jsonrpc": "2.0",
"id": 3,
"result": "…"
}
Request:
{"jsonrpc":"2.0","id":4,"method":"scheduledTransaction.sinceLastRun","params":{}}
Response:
{
"jsonrpc": "2.0",
"id": 4,
"result": {
"id": "…",
"today": "2024-07-01",
"summary": {
"toCreate": 3,
"reminders": 0,
"postponed": 0,
"errors": 0,
"…": "…"
},
"schedules": [
{
"name": "Monthly rent",
"instances": [
{
"index": 0,
"date": "2024-05-01",
"state": "toCreate",
"instanceCount": 1,
"…": "…"
},
{
"index": 1,
"date": "2024-06-01",
"…": "…"
},
{
"index": 2,
"date": "2024-07-01",
"…": "…"
}
],
"…": "…"
}
],
"…": "…"
}
}
Command line
red-ale exec --book book.gnucash --script - <<'EOF'
account.create {"name":"Checking","type":"BANK","commodity":"USD"}
account.create {"name":"Rent","type":"EXPENSE","commodity":"USD"}
scheduledTransaction.create {"name":"Monthly rent","startDate":"2024-05-01","schedule":[{"mult":1,"periodType":"month"}],"templateTransactions":[{"description":"Rent","splits":[{"account":"Rent","debitFormula":"750"},{"account":"Checking","creditFormula":"750"}]}]}
scheduledTransaction.sinceLastRun {}
EOF
It prints:
[
"…",
"…",
"…",
{
"id": "…",
"today": "2024-07-01",
"summary": {
"toCreate": 3,
"reminders": 0,
"postponed": 0,
"errors": 0,
"…": "…"
},
"schedules": [
{
"name": "Monthly rent",
"instances": [
{
"index": 0,
"date": "2024-05-01",
"state": "toCreate",
"instanceCount": 1,
"…": "…"
},
{
"index": 1,
"date": "2024-06-01",
"…": "…"
},
{
"index": 2,
"date": "2024-07-01",
"…": "…"
}
],
"…": "…"
}
],
"…": "…"
}
]
MCP tool call
Tool call:
{"name":"account.create","arguments":{"name":"Checking","type":"BANK","commodity":"USD"}}
Result:
{
"content": [
{
"type": "text",
"text": "\"…\""
}
]
}
Tool call:
{"name":"account.create","arguments":{"name":"Rent","type":"EXPENSE","commodity":"USD"}}
Result:
{
"content": [
{
"type": "text",
"text": "\"…\""
}
]
}
Tool call:
{"name":"scheduledTransaction.create","arguments":{"name":"Monthly rent","startDate":"2024-05-01","schedule":[{"mult":1,"periodType":"month"}],"templateTransactions":[{"description":"Rent","splits":[{"account":"Rent","debitFormula":"750"},{"account":"Checking","creditFormula":"750"}]}]}}
Result:
{
"content": [
{
"type": "text",
"text": "\"…\""
}
]
}
Tool call:
{"name":"scheduledTransaction.sinceLastRun","arguments":{}}
Result:
{
"structuredContent": {
"id": "…",
"today": "2024-07-01",
"summary": {
"toCreate": 3,
"reminders": 0,
"postponed": 0,
"errors": 0,
"…": "…"
},
"schedules": [
{
"name": "Monthly rent",
"instances": [
{
"index": 0,
"date": "2024-05-01",
"state": "toCreate",
"instanceCount": 1,
"…": "…"
},
{
"index": 1,
"date": "2024-06-01",
"…": "…"
},
{
"index": 2,
"date": "2024-07-01",
"…": "…"
}
],
"…": "…"
}
],
"…": "…"
}
}
Effect: read.
Params
Params for methods that take none.
Type: NoParams.
Result
A Since Last Run proposal (the result of scheduledTransaction.sinceLastRun).
id(string, required): The proposal's ID, forscheduledTransaction.applyandscheduledTransaction.discard.bookRevision(integer (uint64), required): The Book revision it was made at.today(Date, required): The day it was made for: the local day of the session's clock.thresholdDate(Date or null): The auto read-only threshold date, or null with no threshold.summary(RunSummary, required): Counts of its instances.schedules(array of RunSchedule, required): One entry per enabled scheduled transaction with at least one instance, in book order.