Good day!

There is such an array (I give part of it):

[4] => Array ( [ID] => 33 [UF_NAME] => 29 [UF_XML_ID] => 6ea9ab1baa0efb9e19094440c317e21b [PROP_KEY] => PROP_44 ) [5] => Array ( [ID] => 35 [UF_NAME] => 31 [UF_XML_ID] => c16a5320fa475530d9583c34fd356ef5 [PROP_KEY] => PROP_44 ) [6] => Array ( [ID] => 34 [UF_NAME] => 30 [UF_XML_ID] => 34173cb38f07f89ddbebc2ac9128303f [PROP_KEY] => PROP_44 ) 

The result of sampling from the HL information block 1C Bitrix (this is a list of clothing sizes):

  /*Работа со справочниками*/ $hlblock = HL\HighloadBlockTable::getById($HL_blockID)->fetch(); $entity = HL\HighloadBlockTable::compileEntity($hlblock); $entity_data_class = $entity->getDataClass(); $rsProdInDB = $entity_data_class::getList(array( "order"=> Array('UF_NAME'=>'ASC'), "select"=> Array('ID','UF_NAME','UF_XML_ID'), "filter"=> Array('=ID' =>$treeElement), )); 

The size (i.e., what the user sees) here is the UF_NAME field. As you can see, they are not in order. Sorting them at the receiving stage (i.e. while it works ::GetList() ) does not work, there a lot of other properties are chosen, in general, to explain for a long time. So I'm trying to sort it out after receipt.

Update

There, at the beginning there is a search of sales offers, I get IDs of the HL information block elements from the sales offers, then I pull out "filter"=> Array('=ID' =>$treeElement) , from the HL information block the remaining data of the 'UF_NAME' and 'UF_XML_ID' . In general, it is possible that you are right about the Bitrix manual. ))

  • What prevents usort from using? - iksuy
  • Probably a guide to 1c-bitrix. ) - Ale_x
  • Sort them at the receiving stage - and why is that? What can be easier to sort at the time of sampling from the database? - Ale_x
  • Updated the question. @iksuy, and more specifically? - maler1988
  • Look here - as I understand it, work through the query builder. - Ale_x

1 answer 1

Keys are made from UF_NAME, into which everything else is thrown (and UF_NAME is also possible), and everything will automatically be sorted.

  • Did something like that, thanks! - maler1988