GetList
CDBResult CFormResult::GetList( int form_id, string &by = "s_timestamp", string &order = "desc", array filter = array(), bool &is_filtered, string check_rights = "Y", mixed limit = false )
Returns the list of results for web form as an CDBResult object instance. Non-static method.
Note
Returned list contains only result fields. Answer and fields values can be received by the CForm::GetResultAnswerArray or CFormResult::GetDataByID methods.
Parameters
Parameter | Description |
---|---|
FORM_ID | Web form ID. |
by | Allows to specify the name of the field
by which the sorting is to be performed. The following values allowed:
|
order | Sorting order. The following values apply:
|
arFilter | Array used as the values filter. The
following key names apply:
|
is_filtered | Contains true on return if the results has been filtered, or false otherwise. |
CHECK_RIGHTS | If set to "Y", user permissions will be checked when adding a result. If "N", no checks are performed. | For the result to be included into the resulting list, the following appropriate access permissions are required:limit | Maximum number of results to be included into the resulting list. Selection is limited to 5000 strings by default.
Optional parameter. |
See Also
Example
Sample PHP code used to define the array arFilter:
$arFilter = array( "ID" => "1 | 2" "STATUS_ID" => "9 | 10", "TIMESTAMP_1" => "10.10.2003", "TIMESTAMP_2" => "15.10.2003", "DATE_CREATE_1" => "10.10.2003", "DATE_CREATE_2" => "12.10.2003", "REGISTERED" => "Y", "USER_AUTH" => "N", "USER_ID" => "45 | 35", "USER_ID_EXACT_MATCH" => "Y", // match ID or login name exactly "GUEST_ID" => "4456 | 7768", "SESSION_ID" => "456456 | 778768", "FIELDS" => array( 0 => array( "CODE" => "GAME_ID", // code of the filtering field "FILTER_TYPE" => "integer", // filter by integer field "PARAMETER_NAME" => "USER", // filter by user text "VALUE" => $arGame["ID"], // value to filter by "PART" => 0 // exact match ), 1 => array( "CODE" => "GAME_NAME", // code of the filtering field "FILTER_TYPE" => "text", // filter by integer field "PARAMETER_NAME" => "USER", // filter by user text "VALUE" => "Tetris", // value to filter by "EXACT_MATCH" => "Y" // exact match ) 2 => array( "CODE" => "GENRE_ID", // code of the filtering field "FILTER_TYPE" => "integer", // filter by integer field "PARAMETER_NAME" => "ANSWER_VALUE", // filter by ANSWER_VALUE "VALUE" => "3", // value to filter by "PART" => 1 // from ), 3 => array( "CODE" => "GENRE_ID", // code of the filtering field "FILTER_TYPE" => "integer", // filter by integer field "PARAMETER_NAME" => "ANSWER_VALUE", // filter by ANSWER_VALUE "VALUE" => "6", // value to filter by "PART" => 2 // to ) ) );
Example
$arFilter = array( "STATUS_ID" => "9 | 10", // filter results with status 9 or 10 "FIELDS" => array( 0 => array( "CODE" => "GAME_ID", // code of the filtering field "FILTER_TYPE" => "integer", // filter as integer "PARAMETER_NAME" => "USER", // filter by user text "VALUE" => $arGame["ID"], // value to filter by "PART" => 0 // exact match ), ) ); $rsComments = CFormResult::GetList($arForm["ID"], ($by="s_timestamp"), ($order="desc"), $arFilter, $is_filtered);
© «Bitrix24», 2001-2024