GetList
CDBResult CFormAnswer::GetList( int question_id, string &by = "s_sort", string &order = "asc", array filter = array(), bool &is_filtered )
The method GetList returns a list of answers as a CDBResult class object.
Parameters
Parameter | Description |
---|---|
question_id | The question ID |
by | Reference to the variable containing the field used to sort the result.
The following values are possible:
|
order | Reference to the variable containing the sort order. The following values are possible:
|
filter | An array used to filter values. The following keys are possible:
|
is_filtered | Reference to the variable containing true if the returned list is filtered, or false if the returned list is not filtered. |
See Also
Example
<? $QUESTION_ID = 143; // the question ID // form the filter array $arFilter = Array( // the answer ID is 589 or 590 "ID" => "589 | 590", // we need the ID to match exactly "ID_EXACT_MATCH" => "Y", // active state flag "ACTIVE" => "Y", // the value of the ANSWER_TEXT parameter is "yes" or "no" "MESSAGE" => "yes | no", // we need the MESSAGE to match exactly "MESSAGE_EXACT_MATCH" => "Y", // type of the answer field is radio-button "FIELD_TYPE" => "radio", // we need the FIELD_TYPE to match exactly "FIELD_TYPE_EXACT_MATCH" => "Y", // parameter includes the string "checked" "FIELD_PARAM" => "checked", // we need just an entry in FIELD_PARAM "FIELD_PARAM_EXACT_MATCH" => "N" ); // obtain the list of all answers to the question #143 $rsAnswers = CFormAnswer::GetList( $QUESTION_ID, $by="s_id", $order="desc", $arFilter, $is_filtered ); while ($arAnswer = $rsAnswers->Fetch()) { echo "<pre>"; print_r($arAnswer); echo "</pre>"; } ?>
© «Bitrix24», 2001-2024