Answer the question
In order to leave comments, you need to log in
Why does an unknown field definition error occur when using a field from the runtime section in a filter?
Initially, there is an array of parameters to the filter and everything works.
$params = [
'filter' => [
'!=my_field_one_from_table' => 1,
]
];
$params = [
'filter' => [
'!=my_field_one_from_table' => 1,
'=my_field_expression' => 0,
],
'runtime' => [
new ExpressionField(
'my_field_expression',
'LENGTH(my_field_two_from_table)',
null,
[ 'data_type' => 'integer' ]
)
]
];
[Bitrix\Main\SystemException]
Unknown field definition `my_field_expression` (my_field_expression) for MyCustom Entity. (100)
.../bitrix/modules/main/lib/entity/querychain.php:334
Answer the question
In order to leave comments, you need to log in
Everything seems to correspond to the Bitrix docs
new Entity\ExpressionField('MAX_AGE', 'MAX(%s)', array('AGE_DAYS'))
new ExpressionField( 'my_field_expression', 'LENGTH(my_field_two_from_table)', null, [ 'data_type' => 'integer' ])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question