how to access to another attribute value else current value?

hi,

my aim is to colorize the background of a cell depending of the value of a lookup table.

i have this main table PERSONS :

id_person
name_person
category_person

and i have also this lookup table CATEGORIES:

id_category
name_category
color_category (contenaing a rgb color value)

in my function ListOptions_Rendered , i already access to the value of category_person with with code :
$this->category_person->CurrentValue
but i need the color associated with this id !

but how can i have the (color_category ->CurrentValue ) without doing a sql query ? does phpmaker already load in memory the content of the lookup table in an object ?
maybe phpmaker have a way to do something like :
mycolor=$object_categories (filter on id= $this->category_person->CurrentValue ) ->color_category>getvalue ?
maybe the lookup table is in a array ? with keyaccess from code ?

As my view display 50 items or more, i can’t afford to make 50 sql query !

Thank you for your tips again !

There are many ways, e.g.

  1. You may create a view to join the 2 tables first. To update the view in Add/Edit pages you may use Page_Load server event to set this->UpdateTable = “PERSONS”, or
  2. Get all colors first and lookup yourself from the array in Row_Rendered, e.g.
    $colors = ExecuteRows(“SELECT id_category, color_category FROM CATEGORIES”);