Page 1 of 1

Field display from database function

Posted: Wed Jun 18, 2014 1:55 am
by Giblet535

I have an integer table field, Member_Of, that references a Groups table:
Groups:
_id int(11),
Group_Name varchar(255),
Member_Of int(11)

0 = '/', so rows:
'6557','Phosphates','0' would display as "/Phosphates"
'87888','Manganese','6557' would display as "/Phosphates/Manganese"
etc.

This structure is all that is needed to represent a hierarchical structure, but a defined database function is required to display the value.

Use of the function is as simple as 'SELECT Explode({Member_Of}) AS Group_Name ORDER BY Group_Name'

How can I replace a field with the results of that SELECT within PHPMaker?


Re: Field display from database function

Posted: Wed Jun 18, 2014 9:41 am
by danielc

Use Row_Rendered server event to change your display value:
$this-><yourfield>->ViewValue = yourfunction($this-><yourfield>->CurrentValue);

See Server event and Client script.


Re: Field display from database function

Posted: Wed Jun 18, 2014 5:10 pm
by Giblet535

I'll give that a try and post the result, thanks.