Documentation

SubQuery

object
CIBlockElement::SubQuery(
 string strField,
array arFilter
 );

The method allows using subqueries. Static method.

Note: applicable only to the ID field for a main query element.

Call parameters

Parameter Description
strField Field name used for filtration.
Possible values:
  • ID - by element ID
  • PROPERTY_<PROPERTY_CODE> - by property value, where PROPERTY_CODE - ID or symbolic code for boded property. The property must have the "binded to elements" type.
arFilterElement filter is the same as in the methodCIBlockElement::GetList with exception that the key IBLOCK_ID or =IBLOCK_ID is applied starting from version 23.0.0. Single value (single iblock ID).

Returned value

Subquery object.

See Also

Examples

<?
//Select authors who wrote books in 21st century.
if(CModule::IncludeModule('iblock'))
{
$rsBooks = CIBlockElement::GetList(
array("NAME" => "ASC"), //Sort by name
array(
"IBLOCK_ID" => $AUTHOR_IBLOCK,
"ACTIVE" => "Y",
"ID" => CIBlockElement::SubQuery("PROPERTY_AUTHOR", array(
"IBLOCK_ID" => $BOOK_IBLOCK,
">=PROPERTY_PRINT_DATE" => "2000-01-01 00:00:00",
)),
),
false, // Without grouping
false, //without page wise navigation
array("ID", "IBLOCK_ID", "NAME") // Select only the fields required for display
);
while($arBook = $rsBooks->GetNext())
echo "<li>", $arBook["NAME"],"\n";
}
?>

See Also



© «Bitrix24», 2001-2024
Up