<aside> 👉 Links (Property base class)

ButtonProperty

CheckboxProperty

CreatedByProperty

CreatedTimeProperty

DateProperty

EmailProperty

FilesProperty

FormulaProperty

MultiSelectProperty

LastEditedByProperty

LastEditedTimeProperty

NumberProperty

PeopleProperty

PhoneNumberProperty

Property

RelationProperty

RichTextProperty

RollupProperty

SelectProperty

StatusProperty

TitleProperty

UniqueIdProperty

UrlProperty

VerificationProperty

Notion Ruby Mapping Public API Reference

</aside>

<aside> 💡

[P] means methods for Page Property, [DB/DS] means methods for Database or DataSource Property.

</aside>

1. Instance methods

FormulaProperty filters

Filter methods build a Query; they do not execute a request or change the formula expression. Use query.filter to inspect the generated filter Hash, or pass the Query to ds.query_data_source to execute it.

Specify another_type: to match the formula result: "string" for text, "number" for numbers, or "date" for dates. Formula text filters use "string", not "rich_text". The library does not infer or validate this choice. The inherited condition: keyword is for rollup arrays; leave it as nil for the formula filters described here.

Each example assumes that ds is a retrieved DataSource and that its FormulaTitle property has the result type used in that example. The examples illustrate different formula configurations, not one formula returning all of these types.

formula = ds.properties["FormulaTitle"]

For date filters, date accepts Date, Time, DateTime, or an ISO 8601 String. Time and DateTime values retain their offsets; Strings pass through unchanged. Date values use the process's current local UTC offset when expanded to a start or end of day. Date examples that display +09:00 below assume that local offset.

filter_after(date, condition: nil, another_type: nil) → Query

Builds a condition for a date formula result strictly after date. Set another_type: "date". A Date is expanded to 23:59:59 on that day using the process's current local UTC offset.

formula.filter_after(Time.new(2022, 2, 12, 12, 0, 0, "+09:00"), another_type: "date").filter
# => {"property"=>"FormulaTitle", "formula"=>{"date"=>{"after"=>"2022-02-12T12:00:00+09:00"}}}

filter_before(date, condition: nil, another_type: nil) → Query

Builds a condition for a date formula result strictly before date. Set another_type: "date". A Date is expanded to 00:00:00 on that day using the process's current local UTC offset.

formula.filter_before(Time.new(2022, 2, 12, 12, 0, 0, "+09:00"), another_type: "date").filter
# => {"property"=>"FormulaTitle", "formula"=>{"date"=>{"before"=>"2022-02-12T12:00:00+09:00"}}}

filter_contains(value, condition: nil, another_type: nil) → Query

Builds a condition for a text formula result that contains the String value. Set another_type: "string".

formula.filter_contains("abc", another_type: "string").filter
# => {"property"=>"FormulaTitle", "formula"=>{"string"=>{"contains"=>"abc"}}}

filter_does_not_contain(value, condition: nil, another_type: nil) → Query

Builds a condition for a text formula result that does not contain the String value. Set another_type: "string".