[PR #6414] [MERGED] Add Formula Rule function to set-split-amount #20868

Closed
opened 2026-04-14 21:47:51 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/6414
Author: @sjones512
Created: 12/15/2025
Status: Merged
Merged: 3/17/2026
Merged by: @youngcw

Base: masterHead: formula-rules-set-split-amount


📝 Commits (10+)

  • a9d399c Add Formula Rule function to set-split-amount fixed-amount and fixed-percent actions.
  • 837c615 Hide formula UI for remainder splits and simplify icon logic
  • b276c1b Guard against undefined options in set-split-amount else‑branch
  • f91532a Merge branch 'master' into formula-rules-set-split-amount
  • 9cdb83d Show split amount formula in rules list
  • b74641f Update tests based on changes introduced in 7fa1ff230e
  • b190736 Merge branch 'master' into formula-rules-set-split-amount
  • 2f485c4 Merge branch 'master' into formula-rules-set-split-amount
  • 96b0ea2 Change set-split-amount formula feature to work as a separate allocation method.
  • ef7387a [autofix.ci] apply automated fixes

📊 Changes

10 files changed (+225 additions, -37 deletions)

View changed files

📝 packages/desktop-client/src/components/formula/codeMirror-excelLanguage.tsx (+9 -0)
📝 packages/desktop-client/src/components/rules/ActionExpression.tsx (+10 -3)
📝 packages/desktop-client/src/components/rules/RuleEditor.tsx (+45 -30)
📝 packages/loot-core/src/server/rules/action.ts (+33 -0)
📝 packages/loot-core/src/server/rules/index.test.ts (+96 -0)
📝 packages/loot-core/src/server/rules/rule.ts (+4 -1)
📝 packages/loot-core/src/server/transactions/transaction-rules.ts (+17 -0)
📝 packages/loot-core/src/shared/rules.ts (+2 -1)
📝 packages/loot-core/src/types/models/rule.ts (+3 -2)
upcoming-release-notes/6414.md (+6 -0)

📄 Description

This pull request looks to add the ability to leverage the Formula Rule feature to set the transaction amount for split transactions.

The use case this in mind with this was when importing a Mortgage Payment transaction, you can use the Formula feature to calculate the Principal and Interest portions of the payment.

I didn't handle any validation that the rule output should be less than the transaction amount, or that percentages should be between 0 and 100. I wasn't sure if those were necessary.

Formula Rules Feedback in issue 5949

image image

Bundle Stats

Bundle Files count Total bundle size % Changed
desktop-client 26 11.81 MB → 11.81 MB (+1023 B) +0.01%
loot-core 1 4.83 MB → 4.83 MB (+1.13 kB) +0.02%
api 4 4.05 MB → 4.05 MB (+1.11 kB) +0.03%
View detailed bundle stats

desktop-client

Total

Files count Total bundle size % Changed
26 11.81 MB → 11.81 MB (+1023 B) +0.01%
Changeset
File Δ Size
src/components/rules/ActionExpression.tsx 📈 +212 B (+2.69%) 7.69 kB → 7.9 kB
src/components/formula/codeMirror-excelLanguage.tsx 📈 +230 B (+1.24%) 18.1 kB → 18.33 kB
home/runner/work/actual/actual/packages/loot-core/src/shared/rules.ts 📈 +85 B (+1.17%) 7.08 kB → 7.17 kB
src/components/rules/RuleEditor.tsx 📈 +496 B (+1.09%) 44.39 kB → 44.87 kB
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger

Asset File Size % Changed
static/js/useTransactionBatchActions.js 4.27 MB → 4.27 MB (+581 B) +0.01%
static/js/FormulaEditor.js 716.38 kB → 716.6 kB (+230 B) +0.03%
static/js/index.js 3.21 MB → 3.21 MB (+212 B) +0.01%

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
static/js/BackgroundImage.js 119.98 kB 0%
static/js/ReportRouter.js 1002.19 kB 0%
static/js/TransactionList.js 81.29 kB 0%
static/js/ca.js 185.62 kB 0%
static/js/da.js 104.66 kB 0%
static/js/de.js 177.63 kB 0%
static/js/en-GB.js 7.16 kB 0%
static/js/en.js 169.27 kB 0%
static/js/es.js 172.13 kB 0%
static/js/fr.js 177.63 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 13.46 kB 0%
static/js/it.js 168.97 kB 0%
static/js/narrow.js 353.32 kB 0%
static/js/nb-NO.js 154.72 kB 0%
static/js/nl.js 111.58 kB 0%
static/js/pl.js 88.31 kB 0%
static/js/pt-BR.js 180.55 kB 0%
static/js/resize-observer.js 18.03 kB 0%
static/js/th.js 179.94 kB 0%
static/js/theme.js 30.68 kB 0%
static/js/uk.js 213.14 kB 0%
static/js/wide.js 418 B 0%
static/js/workbox-window.prod.es5.js 7.28 kB 0%

loot-core

Total

Files count Total bundle size % Changed
1 4.83 MB → 4.83 MB (+1.13 kB) +0.02%
Changeset
File Δ Size
home/runner/work/actual/actual/packages/loot-core/src/server/rules/action.ts 📈 +765 B (+10.68%) 6.99 kB → 7.74 kB
home/runner/work/actual/actual/packages/loot-core/src/server/rules/rule.ts 📈 +151 B (+3.50%) 4.21 kB → 4.36 kB
home/runner/work/actual/actual/packages/loot-core/src/server/transactions/transaction-rules.ts 📈 +246 B (+1.25%) 19.21 kB → 19.45 kB
View detailed bundle breakdown

Added

Asset File Size % Changed
kcab.worker.BODu7HEa.js 0 B → 4.83 MB (+4.83 MB) -

Removed

Asset File Size % Changed
kcab.worker.Bu63xj1l.js 4.83 MB → 0 B (-4.83 MB) -100%

Bigger
No assets were bigger

Smaller
No assets were smaller

Unchanged
No assets were unchanged


api

Total

Files count Total bundle size % Changed
4 4.05 MB → 4.05 MB (+1.11 kB) +0.03%
Changeset
File Δ Size
home/runner/work/actual/actual/packages/loot-core/src/server/rules/action.ts 📈 +750 B (+11.13%) 6.58 kB → 7.31 kB
home/runner/work/actual/actual/packages/loot-core/src/server/rules/rule.ts 📈 +149 B (+3.67%) 3.96 kB → 4.11 kB
home/runner/work/actual/actual/packages/loot-core/src/server/transactions/transaction-rules.ts 📈 +241 B (+1.25%) 18.8 kB → 19.04 kB
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger

Asset File Size % Changed
index.js 3.83 MB → 3.84 MB (+1.11 kB) +0.03%

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
from-Bl-Hslp4.js 167.73 kB 0%
multipart-parser-BnDysoMr.js 8.1 kB 0%
src-iMkUmuwR.js 43.64 kB 0%

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/6414 **Author:** [@sjones512](https://github.com/sjones512) **Created:** 12/15/2025 **Status:** ✅ Merged **Merged:** 3/17/2026 **Merged by:** [@youngcw](https://github.com/youngcw) **Base:** `master` ← **Head:** `formula-rules-set-split-amount` --- ### 📝 Commits (10+) - [`a9d399c`](https://github.com/actualbudget/actual/commit/a9d399c03b34f7408287ed5cf954bd9981ffd8ef) Add Formula Rule function to set-split-amount fixed-amount and fixed-percent actions. - [`837c615`](https://github.com/actualbudget/actual/commit/837c61561767bb7357f90764afbb0af2a2584d55) Hide formula UI for remainder splits and simplify icon logic - [`b276c1b`](https://github.com/actualbudget/actual/commit/b276c1b536396c0aeb1db869555dea211a9751c5) Guard against undefined options in set-split-amount else‑branch - [`f91532a`](https://github.com/actualbudget/actual/commit/f91532a9d4689d1d384f39743be8774a6f3b7776) Merge branch 'master' into formula-rules-set-split-amount - [`9cdb83d`](https://github.com/actualbudget/actual/commit/9cdb83df101aaad617276ce18e71db3ae403594e) Show split amount formula in rules list - [`b74641f`](https://github.com/actualbudget/actual/commit/b74641f83de2f24b9f94396455cd335fd14fc6ac) Update tests based on changes introduced in 7fa1ff230e7988001b336b7c5bd066c23f3d4e45 - [`b190736`](https://github.com/actualbudget/actual/commit/b190736ba88846c295696df3b84f6ec9a83710e7) Merge branch 'master' into formula-rules-set-split-amount - [`2f485c4`](https://github.com/actualbudget/actual/commit/2f485c42f53cbe2a12fedefc01e72fb0ab12f9ff) Merge branch 'master' into formula-rules-set-split-amount - [`96b0ea2`](https://github.com/actualbudget/actual/commit/96b0ea2b25d37421edd06403c943f2b29eee59f5) Change set-split-amount formula feature to work as a separate allocation method. - [`ef7387a`](https://github.com/actualbudget/actual/commit/ef7387ad65ef2340c8da48ace51516fcd90c2da1) [autofix.ci] apply automated fixes ### 📊 Changes **10 files changed** (+225 additions, -37 deletions) <details> <summary>View changed files</summary> 📝 `packages/desktop-client/src/components/formula/codeMirror-excelLanguage.tsx` (+9 -0) 📝 `packages/desktop-client/src/components/rules/ActionExpression.tsx` (+10 -3) 📝 `packages/desktop-client/src/components/rules/RuleEditor.tsx` (+45 -30) 📝 `packages/loot-core/src/server/rules/action.ts` (+33 -0) 📝 `packages/loot-core/src/server/rules/index.test.ts` (+96 -0) 📝 `packages/loot-core/src/server/rules/rule.ts` (+4 -1) 📝 `packages/loot-core/src/server/transactions/transaction-rules.ts` (+17 -0) 📝 `packages/loot-core/src/shared/rules.ts` (+2 -1) 📝 `packages/loot-core/src/types/models/rule.ts` (+3 -2) ➕ `upcoming-release-notes/6414.md` (+6 -0) </details> ### 📄 Description This pull request looks to add the ability to leverage the Formula Rule feature to set the transaction amount for split transactions. The use case this in mind with this was when importing a Mortgage Payment transaction, you can use the Formula feature to calculate the Principal and Interest portions of the payment. I didn't handle any validation that the rule output should be less than the transaction amount, or that percentages should be between 0 and 100. I wasn't sure if those were necessary. Formula Rules Feedback in issue [5949](https://github.com/actualbudget/actual/issues/5949#issuecomment-3520203400) <img width="856" height="425" alt="image" src="https://github.com/user-attachments/assets/c06d9b91-be9d-4981-a6cd-1a605cdeb2a4" /> <img width="1628" height="167" alt="image" src="https://github.com/user-attachments/assets/cdbfda51-ba51-4dd4-b5e2-3f374368d7f2" /> <!-- Thank you for submitting a pull request! Make sure to follow the instructions to write release notes for your PR — it should only take a minute or two: https://github.com/actualbudget/docs#writing-good-release-notes. Try running yarn generate:release-notes *before* pushing your PR for an interactive experience. --> <!--- actual-bot-sections ---> <hr /> <!--- bundlestats-action-comment key:combined start ---> ### Bundle Stats Bundle | Files count | Total bundle size | % Changed ------ | ----------- | ----------------- | --------- desktop-client | 26 | 11.81 MB → 11.81 MB (+1023 B) | +0.01% loot-core | 1 | 4.83 MB → 4.83 MB (+1.13 kB) | +0.02% api | 4 | 4.05 MB → 4.05 MB (+1.11 kB) | +0.03% <details> <summary>View detailed bundle stats</summary> #### desktop-client **Total** Files count | Total bundle size | % Changed ----------- | ----------------- | --------- 26 | 11.81 MB → 11.81 MB (+1023 B) | +0.01% <details> <summary>Changeset</summary> File | Δ | Size ---- | - | ---- `src/components/rules/ActionExpression.tsx` | 📈 +212 B (+2.69%) | 7.69 kB → 7.9 kB `src/components/formula/codeMirror-excelLanguage.tsx` | 📈 +230 B (+1.24%) | 18.1 kB → 18.33 kB `home/runner/work/actual/actual/packages/loot-core/src/shared/rules.ts` | 📈 +85 B (+1.17%) | 7.08 kB → 7.17 kB `src/components/rules/RuleEditor.tsx` | 📈 +496 B (+1.09%) | 44.39 kB → 44.87 kB </details> <details> <summary>View detailed bundle breakdown</summary> <div> **Added** No assets were added **Removed** No assets were removed **Bigger** Asset | File Size | % Changed ----- | --------- | --------- static/js/useTransactionBatchActions.js | 4.27 MB → 4.27 MB (+581 B) | +0.01% static/js/FormulaEditor.js | 716.38 kB → 716.6 kB (+230 B) | +0.03% static/js/index.js | 3.21 MB → 3.21 MB (+212 B) | +0.01% **Smaller** No assets were smaller **Unchanged** Asset | File Size | % Changed ----- | --------- | --------- static/js/BackgroundImage.js | 119.98 kB | 0% static/js/ReportRouter.js | 1002.19 kB | 0% static/js/TransactionList.js | 81.29 kB | 0% static/js/ca.js | 185.62 kB | 0% static/js/da.js | 104.66 kB | 0% static/js/de.js | 177.63 kB | 0% static/js/en-GB.js | 7.16 kB | 0% static/js/en.js | 169.27 kB | 0% static/js/es.js | 172.13 kB | 0% static/js/fr.js | 177.63 kB | 0% static/js/indexeddb-main-thread-worker-e59fee74.js | 13.46 kB | 0% static/js/it.js | 168.97 kB | 0% static/js/narrow.js | 353.32 kB | 0% static/js/nb-NO.js | 154.72 kB | 0% static/js/nl.js | 111.58 kB | 0% static/js/pl.js | 88.31 kB | 0% static/js/pt-BR.js | 180.55 kB | 0% static/js/resize-observer.js | 18.03 kB | 0% static/js/th.js | 179.94 kB | 0% static/js/theme.js | 30.68 kB | 0% static/js/uk.js | 213.14 kB | 0% static/js/wide.js | 418 B | 0% static/js/workbox-window.prod.es5.js | 7.28 kB | 0% </div> </details> --- #### loot-core **Total** Files count | Total bundle size | % Changed ----------- | ----------------- | --------- 1 | 4.83 MB → 4.83 MB (+1.13 kB) | +0.02% <details> <summary>Changeset</summary> File | Δ | Size ---- | - | ---- `home/runner/work/actual/actual/packages/loot-core/src/server/rules/action.ts` | 📈 +765 B (+10.68%) | 6.99 kB → 7.74 kB `home/runner/work/actual/actual/packages/loot-core/src/server/rules/rule.ts` | 📈 +151 B (+3.50%) | 4.21 kB → 4.36 kB `home/runner/work/actual/actual/packages/loot-core/src/server/transactions/transaction-rules.ts` | 📈 +246 B (+1.25%) | 19.21 kB → 19.45 kB </details> <details> <summary>View detailed bundle breakdown</summary> <div> **Added** Asset | File Size | % Changed ----- | --------- | --------- kcab.worker.BODu7HEa.js | 0 B → 4.83 MB (+4.83 MB) | - **Removed** Asset | File Size | % Changed ----- | --------- | --------- kcab.worker.Bu63xj1l.js | 4.83 MB → 0 B (-4.83 MB) | -100% **Bigger** No assets were bigger **Smaller** No assets were smaller **Unchanged** No assets were unchanged </div> </details> --- #### api **Total** Files count | Total bundle size | % Changed ----------- | ----------------- | --------- 4 | 4.05 MB → 4.05 MB (+1.11 kB) | +0.03% <details> <summary>Changeset</summary> File | Δ | Size ---- | - | ---- `home/runner/work/actual/actual/packages/loot-core/src/server/rules/action.ts` | 📈 +750 B (+11.13%) | 6.58 kB → 7.31 kB `home/runner/work/actual/actual/packages/loot-core/src/server/rules/rule.ts` | 📈 +149 B (+3.67%) | 3.96 kB → 4.11 kB `home/runner/work/actual/actual/packages/loot-core/src/server/transactions/transaction-rules.ts` | 📈 +241 B (+1.25%) | 18.8 kB → 19.04 kB </details> <details> <summary>View detailed bundle breakdown</summary> <div> **Added** No assets were added **Removed** No assets were removed **Bigger** Asset | File Size | % Changed ----- | --------- | --------- index.js | 3.83 MB → 3.84 MB (+1.11 kB) | +0.03% **Smaller** No assets were smaller **Unchanged** Asset | File Size | % Changed ----- | --------- | --------- from-Bl-Hslp4.js | 167.73 kB | 0% multipart-parser-BnDysoMr.js | 8.1 kB | 0% src-iMkUmuwR.js | 43.64 kB | 0% </div> </details> </details> <!--- bundlestats-action-comment key:combined end ---> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-14 21:47:51 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#20868