Page 1 of 1

manipulating $rs in Recordset_Selected Event

Posted: Wed Jan 10, 2018 2:12 am
by digitalphotoworld

I try to modify the data in Recordset_Selected Event BEFORE anything is happen to the data. For this, I use the following code:

// Recordset Selected event
function Recordset_Selected(&$rs) {

		while (!$rs->EOF) {  		
			if ($rs->fields['color'] == 1) 
				$rs->fields['name'] = "red";
			else  
				$rs->fields['name'] = "green";
			$rs->MoveNext();
		}

}

If I use var_dump($rs), I can see the raw data and that my changes are working well. But in Listpage the changes have no affect.

Is it not possible to change the data in this event? And if so, for what is this event good?


Re: manipulating $rs in Recordset_Selected Event

Posted: Wed Jan 10, 2018 11:41 am
by arbei

You should change the ViewValue of the field in Row_Rendered Server Event instead of changing the rs.

Read the example in help file topic: "Server Events and Client Scripts" -> "Row_Rendered" for more information.