Skip to main content

Smart Rules

Smart rules automatically fill in details on transactions during import. You organise them into rule groups under Settings > Smart Rules, then choose which groups to apply when you import.

Tutorial

Create a group and a first rule

  1. Open Settings, then Smart Rules.
  2. Choose Add Rule Group.
  3. Enter a Group name (for example utilities), then choose Add.
  4. Open the new group.
  5. Choose Add Rule.
  6. Enter a Rule name.
  7. Under When, add a condition: set the field to Description, the operator to Contains (case insensitive), and the value to text that appears on those imports (for example Electric).
  8. Under Then set, choose an Account (for example an electricity expense account).
  9. Choose Add.

The next time you import and select this rule group, matching transactions get that account on the still-unassigned side.

How-to

Add a rule group

  1. Open Settings > Smart Rules.
  2. Choose Add Rule Group.
  3. Enter a Group name.
  4. Choose Add.

Edit or delete a rule group

  1. On Smart Rules, open the menu on a group tile (or use the context menu).
  2. Choose Edit Group to rename it, or Delete Group to remove it.
  3. Confirm deletion if asked.

Deleting a group deletes every rule inside it.

Add a rule

  1. Open a rule group.
  2. Choose Add Rule.
  3. Enter a Rule name.
  4. Build a When condition (at least one valid condition is required).
  5. Fill in one or more Then set fields (at least one action is required).
  6. Choose Add.

Edit or delete a rule

  1. Open the rule group and select the rule row.
  2. In Edit Rule, change the name, conditions, or actions, then choose Save.
  3. To remove the rule, choose Delete and confirm.

Reorder rules

  1. Open a rule group (clear the search box if you are searching).
  2. Drag a rule by its drag handle to a new position in the list.

Earlier rules in the list win when more than one matching rule sets the same field. Reordering is unavailable while a search filter is active.

Use rule groups during import

  1. Start a batch import (for example from Transactions: Add transaction, then Batch import).
  2. On the import options step, choose one or more groups under Smart rule groups.
  3. Continue the import. Matching rules run on the imported transactions before you review them.

Rules apply only when you select their groups for that import. They do not change transactions you enter by hand on the Transactions page.

Reference

Smart Rules page

  • Smart Rules - Lists rule groups.
  • Add Rule Group - Creates a new group.
  • Search can also find smart rules.

Each group tile shows the group name and how many rules it contains. Opening a tile shows the rules in that group.

Rule groups

  • Group name - Label for the group.
  • Edit Group / Delete Group - Rename or remove the group.
  • Groups are a way to organise related rules (for example one group per bank, or one for utilities) and to choose a bundle of rules at import time.

Rules table

Inside a group:

  • Name - The rule name.
  • When - A readable form of the condition.
  • Then set
    • Account - Account the rule sets, or No account
    • Commodity - Commodity the rule sets, or No commodity
    • Tags - Count of transaction and posting tags the rule sets, or No tags
  • Row numbers show order. Drag to reorder when not searching.
  • Selecting a row opens Edit Rule.
  • Add Rule - Opens Add Rule.

Add Rule / Edit Rule dialog

  • Rule name - Name shown in the list.
  • When - Condition builder. The rule runs only when the imported transaction matches.
  • Then set - Values to apply when the condition matches.
  • Add / Save - Create or update the rule.
  • Delete - Remove the rule (edit mode).
  • At least one valid When condition and at least one Then set action are required.

When (condition fields)

You can match on:

FieldMeaning
DescriptionThe transaction description
AmountThe amount on the still-unassigned side of the import (compared as a positive number)
DateThe transaction date
CommodityThe commodity on that unassigned amount

Useful operators include Is equal, Is not equal, Contains (case insensitive), and Not contains (case insensitive). Number and date fields also support the usual comparisons (for example greater than or before).

You can combine conditions in the builder (for example description contains text and amount equals a value).

Then set (actions)

ActionWhat it does
AccountSets the account on the still-unassigned side of the imported transaction
CommoditySets the commodity on the transaction's postings
Transaction tagsAdds tags on the whole transaction (existing tags are kept; matching keys are not overwritten)
Posting tagsAdds tags on the still-unassigned posting only

Leave a field empty if that rule should not change it. Another matching rule can still set it.

Capabilities

  • Fill in account, commodity, and tags during import when you select the rule group.
  • Organise rules into named groups and pick groups per import.
  • Match on description, amount, date, and commodity.
  • Reorder rules so more specific rules can sit above broader ones.
  • Search within a group.

Smart rules do not create transactions by themselves, and they are not applied to manual entries on Transactions.

Explanation

Why smart rules exist

Imports often arrive with a bank account side filled in and the other side still unassigned. Smart rules watch for patterns you recognise (a payee in the description, a fixed subscription amount, a commodity) and fill in the missing account, commodity, or tags so you spend less time editing each row.

Relation to import

During import, after the source turns the file into candidate transactions, Lui Ledger applies the smart rule groups you selected. Matching rules update those candidates; you then review and finish the import. The same groups can be reused on later imports from that source.

Rule groups and order

A rule group is a named set of rules. Selecting several groups at import loads rules from each. Within the combined list, earlier rules win when more than one match sets the same field. Put more specific rules higher in the list than catch-all rules.

Account, commodity, and tags

Those fields mean the same as on a normal transaction. See Transactions for description, date, tags, and postings; Accounts for the account tree; and Commodities for units.

Examples

Electricity bill by description

  • When: Description Contains (case insensitive) Electric
  • Then set: Account = your electricity expense account

Fixed subscription amount

  • When: Description Contains (case insensitive) Streaming and Amount Is equal 9.99
  • Then set: Account = your subscriptions expense account