Hi All,
I am trying to display some specific data in a template and I couldn't get the new ORM to query the data with out erroring out, bug report has been sent on that but when using a custom query it still errors out when converting to some form of ViewableData such as ArrayList or ArrayData. No matter what I do it won't work.
Code is below - any ideas on why this won't work.
public function GetStates() {
$results = DB::query('SELECT s.ID AS ID, s.Name AS Name, s.HasSpecial AS HasSpecial FROM State AS s JOIN Program AS P ON P.StateID = s.ID GROUP BY s.ID ORDER BY s.Name ASC;');
$states = array();
for ($i = 0; $i < $results->numRecords(); $i++) {
$record = $results->nextRecord();
$states[] = $record;
}
$data = new ArrayData($states);
return $data;
}
template has -
<% control GetStates %>
<option value="$ID" data-special="$HasSpecial">$Name</option>
<% end_control %>