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

Open
opened 2026-02-28 21:29:18 -06:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/actualbudget/actual/pull/6414

State: open
Merged: No


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 27 14.85 MB → 14.85 MB (+1.04 kB) +0.01%
loot-core 1 5.82 MB → 5.82 MB (+1.68 kB) +0.03%
api 1 4.43 MB → 4.43 MB (+1.5 kB) +0.03%
View detailed bundle stats

desktop-client

Total

Files count Total bundle size % Changed
27 14.85 MB → 14.85 MB (+1.04 kB) +0.01%
Changeset
File Δ Size
src/components/rules/ActionExpression.tsx 📈 +236 B (+2.63%) 8.75 kB → 8.98 kB
home/runner/work/actual/actual/packages/loot-core/src/shared/rules.ts 📈 +97 B (+1.16%) 8.15 kB → 8.24 kB
src/components/formula/codeMirror-excelLanguage.tsx 📈 +228 B (+1.06%) 21.06 kB → 21.28 kB
src/components/rules/RuleEditor.tsx 📈 +505 B (+1.00%) 49.43 kB → 49.93 kB
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger

Asset File Size % Changed
static/js/index.js 9.54 MB → 9.54 MB (+838 B) +0.01%
static/js/FormulaEditor.js 1.04 MB → 1.04 MB (+228 B) +0.02%

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
static/js/indexeddb-main-thread-worker-e59fee74.js 12.94 kB 0%
static/js/workbox-window.prod.es5.js 5.64 kB 0%
static/js/ca.js 188.15 kB 0%
static/js/da.js 106.35 kB 0%
static/js/de.js 180.07 kB 0%
static/js/en-GB.js 7.18 kB 0%
static/js/en.js 170.37 kB 0%
static/js/es.js 174.55 kB 0%
static/js/fr.js 179.6 kB 0%
static/js/it.js 171.16 kB 0%
static/js/nb-NO.js 156.96 kB 0%
static/js/nl.js 106.37 kB 0%
static/js/pl.js 88.37 kB 0%
static/js/pt-BR.js 154.22 kB 0%
static/js/th.js 181.87 kB 0%
static/js/uk.js 214.74 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/BackgroundImage.js 120.54 kB 0%
static/js/ReportRouter.js 1.16 MB 0%
static/js/narrow.js 637.68 kB 0%
static/js/TransactionList.js 106.22 kB 0%
static/js/wide.js 164.15 kB 0%
static/js/AppliedFilters.js 9.71 kB 0%
static/js/usePayeeRuleCounts.js 10.04 kB 0%
static/js/useTransactionBatchActions.js 13.23 kB 0%

loot-core

Total

Files count Total bundle size % Changed
1 5.82 MB → 5.82 MB (+1.68 kB) +0.03%
Changeset
File Δ Size
home/runner/work/actual/actual/packages/loot-core/src/server/rules/action.ts 📈 +1.17 kB (+13.21%) 8.83 kB → 10 kB
home/runner/work/actual/actual/packages/loot-core/src/server/rules/rule.ts 📈 +161 B (+3.23%) 4.87 kB → 5.03 kB
home/runner/work/actual/actual/packages/loot-core/src/server/transactions/transaction-rules.ts 📈 +362 B (+1.40%) 25.25 kB → 25.6 kB
View detailed bundle breakdown

Added

Asset File Size % Changed
kcab.worker.BL-iLQeW.js 0 B → 5.82 MB (+5.82 MB) -

Removed

Asset File Size % Changed
kcab.worker.BwrdDDMW.js 5.82 MB → 0 B (-5.82 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
1 4.43 MB → 4.43 MB (+1.5 kB) +0.03%
Changeset
File Δ Size
src/server/rules/action.ts 📈 +1.05 kB (+13.45%) 7.83 kB → 8.88 kB
src/server/rules/rule.ts 📈 +153 B (+3.45%) 4.33 kB → 4.48 kB
src/server/transactions/transaction-rules.ts 📈 +310 B (+1.35%) 22.43 kB → 22.73 kB
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger

Asset File Size % Changed
bundle.api.js 4.43 MB → 4.43 MB (+1.5 kB) +0.03%

Smaller
No assets were smaller

Unchanged
No assets were unchanged

**Original Pull Request:** https://github.com/actualbudget/actual/pull/6414 **State:** open **Merged:** No --- 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 | 27 | 14.85 MB → 14.85 MB (+1.04 kB) | +0.01% loot-core | 1 | 5.82 MB → 5.82 MB (+1.68 kB) | +0.03% api | 1 | 4.43 MB → 4.43 MB (+1.5 kB) | +0.03% <details> <summary>View detailed bundle stats</summary> #### desktop-client **Total** Files count | Total bundle size | % Changed ----------- | ----------------- | --------- 27 | 14.85 MB → 14.85 MB (+1.04 kB) | +0.01% <details> <summary>Changeset</summary> File | Δ | Size ---- | - | ---- `src/components/rules/ActionExpression.tsx` | 📈 +236 B (+2.63%) | 8.75 kB → 8.98 kB `home/runner/work/actual/actual/packages/loot-core/src/shared/rules.ts` | 📈 +97 B (+1.16%) | 8.15 kB → 8.24 kB `src/components/formula/codeMirror-excelLanguage.tsx` | 📈 +228 B (+1.06%) | 21.06 kB → 21.28 kB `src/components/rules/RuleEditor.tsx` | 📈 +505 B (+1.00%) | 49.43 kB → 49.93 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/index.js | 9.54 MB → 9.54 MB (+838 B) | +0.01% static/js/FormulaEditor.js | 1.04 MB → 1.04 MB (+228 B) | +0.02% **Smaller** No assets were smaller **Unchanged** Asset | File Size | % Changed ----- | --------- | --------- static/js/indexeddb-main-thread-worker-e59fee74.js | 12.94 kB | 0% static/js/workbox-window.prod.es5.js | 5.64 kB | 0% static/js/ca.js | 188.15 kB | 0% static/js/da.js | 106.35 kB | 0% static/js/de.js | 180.07 kB | 0% static/js/en-GB.js | 7.18 kB | 0% static/js/en.js | 170.37 kB | 0% static/js/es.js | 174.55 kB | 0% static/js/fr.js | 179.6 kB | 0% static/js/it.js | 171.16 kB | 0% static/js/nb-NO.js | 156.96 kB | 0% static/js/nl.js | 106.37 kB | 0% static/js/pl.js | 88.37 kB | 0% static/js/pt-BR.js | 154.22 kB | 0% static/js/th.js | 181.87 kB | 0% static/js/uk.js | 214.74 kB | 0% static/js/resize-observer.js | 18.37 kB | 0% static/js/BackgroundImage.js | 120.54 kB | 0% static/js/ReportRouter.js | 1.16 MB | 0% static/js/narrow.js | 637.68 kB | 0% static/js/TransactionList.js | 106.22 kB | 0% static/js/wide.js | 164.15 kB | 0% static/js/AppliedFilters.js | 9.71 kB | 0% static/js/usePayeeRuleCounts.js | 10.04 kB | 0% static/js/useTransactionBatchActions.js | 13.23 kB | 0% </div> </details> --- #### loot-core **Total** Files count | Total bundle size | % Changed ----------- | ----------------- | --------- 1 | 5.82 MB → 5.82 MB (+1.68 kB) | +0.03% <details> <summary>Changeset</summary> File | Δ | Size ---- | - | ---- `home/runner/work/actual/actual/packages/loot-core/src/server/rules/action.ts` | 📈 +1.17 kB (+13.21%) | 8.83 kB → 10 kB `home/runner/work/actual/actual/packages/loot-core/src/server/rules/rule.ts` | 📈 +161 B (+3.23%) | 4.87 kB → 5.03 kB `home/runner/work/actual/actual/packages/loot-core/src/server/transactions/transaction-rules.ts` | 📈 +362 B (+1.40%) | 25.25 kB → 25.6 kB </details> <details> <summary>View detailed bundle breakdown</summary> <div> **Added** Asset | File Size | % Changed ----- | --------- | --------- kcab.worker.BL-iLQeW.js | 0 B → 5.82 MB (+5.82 MB) | - **Removed** Asset | File Size | % Changed ----- | --------- | --------- kcab.worker.BwrdDDMW.js | 5.82 MB → 0 B (-5.82 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 ----------- | ----------------- | --------- 1 | 4.43 MB → 4.43 MB (+1.5 kB) | +0.03% <details> <summary>Changeset</summary> File | Δ | Size ---- | - | ---- `src/server/rules/action.ts` | 📈 +1.05 kB (+13.45%) | 7.83 kB → 8.88 kB `src/server/rules/rule.ts` | 📈 +153 B (+3.45%) | 4.33 kB → 4.48 kB `src/server/transactions/transaction-rules.ts` | 📈 +310 B (+1.35%) | 22.43 kB → 22.73 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 ----- | --------- | --------- bundle.api.js | 4.43 MB → 4.43 MB (+1.5 kB) | +0.03% **Smaller** No assets were smaller **Unchanged** No assets were unchanged </div> </details> </details> <!--- bundlestats-action-comment key:combined end --->
GiteaMirror added the pull-request label 2026-02-28 21:29:18 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#6505