D
D
demnagel2019-11-06 16:01:17
1C-Bitrix
demnagel, 2019-11-06 16:01:17

How should a filter by a custom list type field look like?

I don't understand how it is necessary to specify fields like 'list' and 'binding to element' in the filter.

use Bitrix\Main\Loader; 

Loader::includeModule("highloadblock"); 

use Bitrix\Highloadblock as HL; 
use Bitrix\Main\Entity;

$hlbl = 1; // Указываем ID нашего highloadblock блока к которому будет делать запросы.
$hlblock = HL\HighloadBlockTable::getById($hlbl)->fetch(); 

$entity = HL\HighloadBlockTable::compileEntity($hlblock); 
$entity_data_class = $entity->getDataClass(); 

$rsData = $entity_data_class::getList(array(
   "select" => array("*"),
   "order" => array("ID" => "ASC"),
   "filter" => array("UF_PRODUCT_ID"=>"77")  // Для поля типа 'строка' работает
));

If a property of type 'string' ("UF_PRODUCT_ID"=>"77") everything works, but if the property is of a different type (list, binding to an element), I don't get a selection. I did not find manuals, please suggest or give a link to an example / manual.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
demnagel, 2019-11-06
@demnagel

The value ID must be specified.

G
Georgy Baruchyan, 2019-11-06
@Snatch87

Everything seems to be correct, only if this is a number, pass the value without quotes (the same number)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question