Setyenv · Docs
  • English
  • Español
  • 中文
  • 日本語
  • العربية
  • Deutsch
  • Français
  • हिन्दी
  • Bahasa Indonesia
  • Italiano
  • Nederlands
  • Português
  • Русский
  • Türkçe

EQL deep dive

Entity Query Language — PFM's query language for filtering records. EQL is parsed into an AST, compiled into parameterised SQL, and can also be evaluated in-memory for Business Rules.

EQL syntax

field=value^ORfield2!=value2^field3>=100^NQfield4ISEMPTY
SymbolMeaning
^AND — both conditions must match
^OROR within a group
^NQNew Query — opens a top-level OR group
^!NOT — negates the next condition

Maximum 20 conditions per query.

Operators reference

OperatorAliasesTypeExample
=:Comparisonstatus:open
!=Comparisonpriority!=low
>GTComparisonamount>100
>=GTEComparisontotal>=50
<LTComparisondays<30
<=LTEComparisonscore<=80
STARTSWITH~^TextnameSTARTSWITHJohn
ENDSWITH~$Text[email protected]
CONTAINS~=TextdescriptionCONTAINSurgent
ISEMPTYNullresolutionISEMPTY
ISNOTEMPTYNullassigned_toISNOTEMPTY
INListstatusINopen,pending
NOTINListtypeNOTINspam,trash
BETWEENRangeamountBETWEEN100,500
RELATIVE_GTDatecreated_atRELATIVE_GT-7d
RELATIVE_LTDatedue_dateRELATIVE_LT+1M
SAMEASFieldshipping_citySAMEASbilling_city

Business Rules operators

Only available inside Business Rule EQL filters:

OperatorDescription
CHANGESTrue if a field's value changed (pre-save vs post-save)
DIDNOTCHANGETrue if a field's value did NOT change

Special value tokens

TokenResolves to
CURRENT_USER / CURRENT.USER / current_user()Current WordPress user ID
TRUE / FALSE1 / 0
EMPTYEmpty string

Where EQL is evaluated

EQL is parsed once and then run in two modes:

  • Against the database — for list views and REST queries, EQL compiles to a parameterised SQL WHERE clause. SQL injection is impossible by construction; values are always parameter-bound.
  • In memory against a record — for Business Rules that need to look at CHANGES / DIDNOTCHANGE between pre-save and post-save values, EQL is evaluated against the in-flight record without touching the database.