Answer the question
In order to leave comments, you need to log in
How to filter by multiple fields?
I can not figure out how to correctly form a request for a filter. It is necessary to search for two conditions in one query:
UF_ROLE => 8 + UF_PROFILE => 'N'
and
UF_ROLE => 7 + UF_PROFILE => 'Y'
I do this:
$arFilter = array(
"ACTIVE" => 'Y',
array(
"LOGIC" => "OR",
array('UF_ROLE' => 8, 'UF_PROFILE' => 'N'),
array('UF_ROLE' => 7, 'UF_PROFILE' => 'Y'),
),
);
$result = \Bitrix\Main\UserTable::getList([
'select' => ['ID', 'EMAIL', 'DATE_REGISTER', 'UF_ROLE',],
//'order' => ['UF_ROLE' => 'DESC'],
'filter' => $arFilter,
//'limit' => 100
]);
while ($arUser = $result->fetch())
{
// вывод
}
Answer the question
In order to leave comments, you need to log in
UF_ROLE and UF_PROFILE are not \Bitrix\Main\UserTable fields. Most likely you should have displayed an error with a message about this.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question