This topic is locked
[SOLVED]

 Cannot apply conditional change to Cells

4/3/2014 7:37:49 AM
PHPRunner General questions
A
Anapolis author

I have been through the tutorials and the docs with PHPRunner 7.1 and I can't make the magic happen after hours of trying different things.
Here is the LIST page that I want to change --


I want to compare the value of one column with another column and either change the number font to a different color or the complete cell background (or both) depending on the difference.
If "LieracAppointments" (say the value is 2) is compared with the value of "LieracRequests" (say the value is 4)
then if "LieracAppointments" is LESS than "LieracRequests" I want by that condition to highlight the Number in the LieracAppointments columns.
I have tried the Custom Code examples, I have tried the Events examples at Conditional formatting
Following are examples where I simplified my test to just a static number comparison to see if I could get ANY change to happen, I have failed at all of these tests. NO changes ever show up after builds and uploads.
These are two different examples I tried in the After Record Processed for this List page as a test to which most records would produce a visible result:

if ($data["LieracAppointments"] < 4)

$record["LieracAppointments"]="<span style=\"color:red\">".$record["LieracAppointments"]."</span>";
if ($data["LieracAppointments"]<4)

$record["LieracAppointments_style"].='style="background:yellow"';


NOTHING changes.
I tried this as a test in Custom Code for one of these Fields

if ($record["LieracAppointments"] < 3) {

$value='<span style=\"color:red\">'.$record["LieracAppointments"].'</span>';

}

else {

$value='<span style=\"color:yellow\">'.$record["LieracAppointments"].'</span>';

}

$value='<span style=\"color:yellow\">'.$record["LieracAppointments"].'</span>';


Still no change.
[size="3"]How can I compare the value of one field with the value of another field (less than or greater than) and Visually change the font or cell background or both according to the operand applied ( < or > )?[/size]
I am stumped. The examples are not working for me.

Sergey Kornilov admin 4/3/2014

Unfortunately there is not enough info. If you have a valid support contract post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.

A
Anapolis author 4/6/2014



Unfortunately there is not enough info. If you have a valid support contract post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.


Well, it was my stupid mistake. I had forgotten that the actual fields I wanted to evaluate were Alias re-named fields.
Once I started using the revised field names from my query instead of the actual table field names then things started working correctly.
On the list page for this View ... After Record Processed I dropped this in --

if ($data["Lierac_Appointments"] < ($data["LieracRequest"])){

$record["Lierac_Appointments_value"]="<span style=\"width:55px;font-size:19px;background:yellow;color:red\">".$record["Lierac_Appointments_value"]."</span>";

$record["LieracRequest_value"]="<span style=\"width:55px;font-size:16px;background:yellow;color:black\">".$record["LieracRequest_value"]."</span>";

}

if ($data["Phyt_Appointments"] < ($data["PhytoRequest"])) {

$record["Phyt_Appointments_value"]="<span style=\"width:55px;font-size:19px;background:yellow;color:red\">".$record["Phyt_Appointments_value"]."</span>";

$record["PhytoRequest_value"]="<span style=\"width:55px;font-size:16px;background:yellow;color:black\">".$record["PhytoRequest_value"]."</span>";

}


And the list view columns now highlighted the numbers that did not match between the "before" and "after" fields.
Hopefully, this teaches me to look more closely at what I thought was my query!