Skip to content

QRY_Condition.FieldCondition

Class

apex
global virtual class QRY_Condition.FieldCondition implements QRY_Condition.Evaluable, QRY_Condition.BindAware

Implements: QRY_Condition.Evaluable

Represents a condition in a SOQL WHERE clause based on a specific field, operator, and value.

Example

apex
QRY_Condition.FieldCondition condition = new QRY_Condition.FieldCondition(
    'Status__c', QRY_Condition.Operator.EQUALS, 'Active'
);

Methods

MethodDescription
global virtual QRY_Condition.FieldCondition contains(String compareValue)Sets the condition to a LIKE comparison that matches the value anywhere in the field (a contains match).

contains

apex
global virtual QRY_Condition.FieldCondition contains(String compareValue)

Sets the condition to a LIKE comparison that matches the value anywhere in the field (a contains match). This differs from the raw LIKE form (the Operator.LIKE_X constructor argument), which passes your pattern through verbatim and leaves every % and _ wildcard to you: contains owns the wildcards, wrapping the value in a leading and trailing % so callers never assemble '%' + value + '%' patterns by hand — the same contract as the query builder's contains().

Parameters

ParameterTypeDescription
compareValueStringThe text to match anywhere in the field.

Returns QRY_Condition.FieldCondition — The FieldCondition instance for method chaining.

Example

apex
QRY_Condition.OrCondition textMatch = new QRY_Condition.OrCondition();
textMatch.add(new QRY_Condition.FieldCondition(Account.Name).contains('Acme')); // Name LIKE '%Acme%'
textMatch.add(new QRY_Condition.FieldCondition(Account.Website).contains('acme'));

Constructors

ConstructorDescription
global FieldCondition(SObjectField objectField)Constructor for FieldCondition with a specified SObjectField.
global FieldCondition(SObjectField objectField, QRY_Condition.Operator fieldOperator, Object fieldValue)Constructor for FieldCondition with a specified field, operator, and value.
global FieldCondition(String fieldName)Constructor for FieldCondition with a specified field.
global FieldCondition(String fieldName, QRY_Condition.Operator fieldOperator, Object fieldValue)Constructor for FieldCondition with a specified field, operator, and value.

FieldCondition(SObjectField objectField)

apex
global FieldCondition(SObjectField objectField)

Constructor for FieldCondition with a specified SObjectField. Pair with contains() to complete the condition, or use the field-operator-value constructor for other comparisons.

Parameters

ParameterTypeDescription
objectFieldSObjectFieldThe ObjectField to apply the condition to.

Example

apex
QRY_Condition.Evaluable condition = new QRY_Condition.FieldCondition(Account.Name).contains('Acme');

FieldCondition(SObjectField objectField, QRY_Condition.Operator fieldOperator, Object fieldValue)

apex
global FieldCondition(SObjectField objectField, QRY_Condition.Operator fieldOperator, Object fieldValue)

Constructor for FieldCondition with a specified field, operator, and value.

Parameters

ParameterTypeDescription
objectFieldSObjectFieldThe field to apply the condition to.
fieldOperatorQRY_Condition.OperatorThe operator for the condition.
fieldValueObjectThe value to compare against the field.

Example

apex
QRY_Condition.FieldCondition instance = new QRY_Condition.FieldCondition(Account.Name, new Operator(), 'value');

FieldCondition(String fieldName)

apex
global FieldCondition(String fieldName)

Constructor for FieldCondition with a specified field. Pair with contains() to complete the condition, or use the field-operator-value constructor for other comparisons.

Parameters

ParameterTypeDescription
fieldNameStringThe field to apply the condition to.

Example

apex
QRY_Condition.Evaluable condition = new QRY_Condition.FieldCondition('Name').contains('Acme');

FieldCondition(String fieldName, QRY_Condition.Operator fieldOperator, Object fieldValue)

apex
global FieldCondition(String fieldName, QRY_Condition.Operator fieldOperator, Object fieldValue)

Constructor for FieldCondition with a specified field, operator, and value.

Parameters

ParameterTypeDescription
fieldNameStringThe field to apply the condition to.
fieldOperatorQRY_Condition.OperatorThe operator for the condition.
fieldValueObjectThe value to compare against the field.

Example

apex
QRY_Condition.FieldCondition instance = new QRY_Condition.FieldCondition('myName', new Operator(), 'value');