Use this page as a reference for the expression syntax and relative-date options confirmed for the Rhythm Console. You will also find examples you can adapt. For an overview of rules and expressions, including where you use each one, see Rules and Expressions Explained.
Note
This page does not yet include a full catalog of expression functions. For now, build formulas from the elements below, and contact Rhythm Support if you need a function you have seen mentioned elsewhere.
One confirmed function beyond those basics is arrayIncludesPropertyValue(array, 'property_name', 'value'). It checks whether any item in an array has a specific property with a specific value. For example, arrayIncludesPropertyValue(past_section_memberships, 'section_id', "12345") is true when at least one entry in past_section_memberships has that section_id.
Expression Syntax
Write an expression as one line of text. Rhythm evaluates it against a record, and you refer to that record's fields with field paths.
| Element | How to write it | Example | Notes |
|---|---|---|---|
| Field of a record | Write the record, a dot, and then the field name | contact.first_name | Use the chooser below to find the field name |
| Text value | Put the value in double quotes | "Maria" | A quoted value by itself is a valid expression |
| Equality test | Place == between two values | contact.first_name == "Maria" | True when the two values match |
| Field names from the chooser | Copy the field from Merge Fields, then paste it | — | In the calculated field dialog, choosing a field copies its name and shows Copied field to the clipboard. Custom field names are copied with - replaced by _ |
| Current date | Choose Current Date (full) or Current Date (formatted) | — | Find these options in the merge-field chooser under System/Other |
On screens where the editor checks expressions, test test test fails because the editor cannot read it as an expression. "test" passes because quoted text is a valid expression.
Use straight double quotes ("), not curly or “smart” quotes. Text pasted from a word processor or another document can include smart quotes without you noticing, and Rhythm cannot read expressions that use them. Retype the quotation marks as straight quotes to fix the expression.
Rhythm's date fields generally hold only a date, with no time of day. Do not rely on a date field, or a report built from one, to tell you what time something happened.
Editor Messages
The expression editor shows one message under the code box.
| Message | When it appears | What to do |
|---|---|---|
| This expression is valid. (green, with a check icon) | The box contains text, and on screens that check expressions, the editor found no error | Leave it as is unless you are in the calculated field dialog. In that dialog, this appears for any text, so test the rule on a record |
| Invalid expression provided for label | A required box is empty | Enter an expression |
| Invalid expression provided for label: reason | The editor could not read the expression or run it against the sample record | Correct the expression. If it names a field the sample record does not have, it may still work on a real record |
| Click here for help with writing this expression. | On screens that link to help, above the editor | Opens the help article in a new tab |
The check confirms whether the editor can read or run the formula. It does not confirm whether the formula returns the type of value the screen expects, so a formula that returns text still passes where yes or no is expected.
If Rhythm has just added a new expression function, the editor can still show Invalid expression provided for label for a short time before that function is available everywhere. If an expression uses a function you know is supported but still shows invalid, wait and try again before assuming the syntax is wrong.
Relative Dates
A relative date is a four-part phrase you read from left to right, such as 10 weeks before the billing run date. Rhythm saves the phrase instead of a calendar date, then works out the actual date each time the setting is used.
| Part | Options confirmed | Default | Rules |
|---|---|---|---|
| Number | Any number 1 or greater | 1 | Enter a number unless the position is on. If the value is below 1 or empty, Rhythm shows Invalid input. |
| Unit of time | days, weeks | days | The list may show other units |
| Position | before, after, on | on | Choosing on hides the number and unit and leaves them out of the saved value. Some screens do not offer every position |
| Relative to | The screen's reference date; the beginning of the month | The screen's reference date | The list is searchable. It may show other references |
A new relative date starts as “on the reference date.” If you switch to on and then switch back, your earlier number and unit return.
Reference Date by Place
Each screen uses its own name for the reference date.
| Where | Reference date is called |
|---|---|
| Query criteria | query execution date |
| Directory downstream-member rule | current date |
| Membership billing templates (range start and range end, and each reminder) | billing run date |
| Customization settings of the relative date type | the reference date |
In billing templates, Rhythm does not check whether the range start comes before the range end.
How the Phrase Reads
| Reference chosen | Position labels | Example |
|---|---|---|
| The screen's reference date, when the screen names it (for example billing run date) | on the, before the, after the | 10 days before the billing run date |
| The screen's reference date, when it is named today or left as the reference date | on, before, after | 30 days before today |
| Any other reference, such as the beginning of the month | at the, before, after | 10 weeks before the beginning of the month |
After you save a rule, Rhythm shows the relative date the same way, for example 10 weeks before the beginning of the month.
Relative Dates in Rules
When you edit a rule condition, click the clock icon titled Toggle relative date next to a date value to switch between a fixed date and a relative date. Rhythm keeps both values, but saves only the one shown. The icon appears only for fields treated as dates, and only on screens that allow relative dates. Query criteria and directory rules allow relative dates. The Matching conditions: section of a membership application's order generation rule does not. A Date custom field is treated as text in rules, so it has no clock icon.
If a date-shaped field you expect to filter as a date has no clock icon, do not assume the criteria are wrong first. In observed cases, the rules editor was simply not treating the field as a date field. Confirm the field's type before spending time on the condition itself.
Worked Examples
"Joined in the last 30 days", in query criteria. Choose the join date field and the is greater than operator. Toggle the relative date, then set it to 30 days before and query execution date. The condition reads Join Date is greater than 30 days before the query execution date. Because Rhythm saves the phrase, the query looks back 30 days from whenever it runs.
"From the start of this month." Set the position to on, and set the reference to the beginning of the month. The number and unit disappear.
A billing reminder window. In a billing template, set the range start to 60 days after the billing run date. Set the range end to a later offset, and check the order yourself.
A calculated field that runs only for some records. Select Use an expression to determine when this field calculation should be performed. Then enter a Conditional Evaluation Expression: such as:
contact.first_name == "Maria"The calculation runs only for records where the test is true. The editor accepts any text in this dialog, so save a test record and confirm the result.
Show a form question only when an earlier answer needs it. In a form's page or field logic, write the condition as an expression instead of choosing options from the rules editor when the built-in choices cannot express what you need, such as combining several earlier answers. Copy the earlier field's name from the merge-field chooser so you reference it exactly.
Eligibility criteria that depend on a contact's address. The criteria picker does not offer address components, such as country, directly. Write an expression instead, or ask Rhythm about custom logic, to test the value you need.