This topic is locked

Change cell background depending on value from Custom code in "View as"

11/9/2016 4:35:00 AM
PHPRunner General questions
S
snuffi01 author

I have an listpage where i have different cells displaying values thats comes from code in Visual Editor (View As, Custom).

My datasource for the listpage just fetches ID for each record multiple times like this:



SELECT

g_name,

group_id,

group_id AS samtal_i_q,

group_id AS agenter,

group_id AS agenter_inloggade,

group_id AS agenter_paus,

group_id AS samtal_idag,

group_id AS missade

FROM grps

GROUP BY g_number



What i want to show isnt possible to achive right inside the sql query for all fields so i do this in Visual Editor, Custom code instead.

As example with code below i get how many records exist in an comlicated way and display it with value=$data["q"]



$sql = "SELECT COUNT(DISTINCT seventeens.prim_cid) as q, seventeens.srv_id

FROM `events` AS seventeens

LEFT JOIN `events` AS laters ON (seventeens.`prim_cid` = laters.`prim_cid` AND laters.`g_event_id` > seventeens.`g_event_id`)

WHERE seventeens.`event_id` = 9 AND DATE(seventeens.event_time) = CURDATE() AND seventeens.prim_cid != 0 AND seventeens.srv_id = $value

AND ISNULL(laters.`prim_cid`)";
$rs = CustomQuery($sql);

$data = db_fetch_array($rs);

$value=$data["q"];


I get my values as supposed on the generated page, and now i want to change the record background with ccs.

Ii haven manipulated the values in Visual Editor this code will works on Events and "List page: After record processed":



// If samtal_i_q is 0 show record background as green

if ($data["samtal_i_q"] ==0){

$record["samtal_i_q_css"]='background:#09CF94;';

}

// If samtal_i_q is 1 show record background as yeallow

else if ($data["samtal_i_q"] ==1){

$record["samtal_i_q_css"]='background:#FFD500;';

}


But my problem is that this doesnt seem to work after i have manipulated the values in Custom.
How can i solve this?

I'm using PHPrunner Enterprise 9.0 Build 27104x64
/ Kristian

S
snuffi01 author 11/15/2016



I have an listpage where i have different cells displaying values thats comes from code in Visual Editor (View As, Custom).

My datasource for the listpage just fetches ID for each record multiple times like this:



SELECT

g_name,

group_id,

group_id AS samtal_i_q,

group_id AS agenter,

group_id AS agenter_inloggade,

group_id AS agenter_paus,

group_id AS samtal_idag,

group_id AS missade

FROM grps

GROUP BY g_number



What i want to show isnt possible to achive right inside the sql query for all fields so i do this in Visual Editor, Custom code instead.

As example with code below i get how many records exist in an comlicated way and display it with value=$data["q"]



$sql = "SELECT COUNT(DISTINCT seventeens.prim_cid) as q, seventeens.srv_id

FROM `events` AS seventeens

LEFT JOIN `events` AS laters ON (seventeens.`prim_cid` = laters.`prim_cid` AND laters.`g_event_id` > seventeens.`g_event_id`)

WHERE seventeens.`event_id` = 9 AND DATE(seventeens.event_time) = CURDATE() AND seventeens.prim_cid != 0 AND seventeens.srv_id = $value

AND ISNULL(laters.`prim_cid`)";
$rs = CustomQuery($sql);

$data = db_fetch_array($rs);

$value=$data["q"];


I get my values as supposed on the generated page, and now i want to change the record background with ccs.

Ii haven manipulated the values in Visual Editor this code will works on Events and "List page: After record processed":



// If samtal_i_q is 0 show record background as green

if ($data["samtal_i_q"] ==0){

$record["samtal_i_q_css"]='background:#09CF94;';

}

// If samtal_i_q is 1 show record background as yeallow

else if ($data["samtal_i_q"] ==1){

$record["samtal_i_q_css"]='background:#FFD500;';

}


But my problem is that this doesnt seem to work after i have manipulated the values in Custom.
How can i solve this?

I'm using PHPrunner Enterprise 9.0 Build 27104x64
/ Kristian


Now i'm using PHPrunner Enterprise 9.6 Build 27464x64

Anyone got any hints on this?