acapp
Posts: 31
|
Posted: 05/13/2004, 1:56 PM |
|
I have the followng custom code which is supposed to grab the value of
a integer in my database called "approval_status_id", the table is "absence", the index of the table is absence_id.
What I am hoping to do is to change the color of the text based upon the value of the aprroval_status_id. What am I doing wrong here?
TIA
Andrew
$status = CCDLookUp("approval_status_id", "absence", "absence_id=" . $DBTrainingDB->ToSQL($absence->approval_status_id->GetValue(), ccsInteger), $DBTrainingDB);
if ($status) {
switch ($status)
{
case 1:
$absence->approval_status_id->SetValue("<font color=BLUE>".$absence->approval_status_id->GetValue()."</font>");
break;
case 2:
$absence->approval_status_id->SetValue("<font color=YELLOW>".$absence->approval_status_id->GetValue()."</font>");
break;
case 3:
$absence->approval_status_id->SetValue("<font color=GREEN>".$absence->approval_status_id->GetValue()."</font>");
break;
case 4:
$absence->approval_status_id->SetValue("<font color=RED>".$absence->approval_status_id->GetValue()."</font>");
break;
}
}
|
|
|
acapp
Posts: 31
|
Posted: 05/15/2004, 2:11 PM |
|
Hmmm, no takers yet?
What I ment to put as topic is "Doesn't Get Variable"
Anyone?
|
|
|
Last Hero
|
Posted: 05/17/2004, 4:34 AM |
|
global $absence ?
|
|
|
Last Hero
|
Posted: 05/17/2004, 5:26 AM |
|
And what type is for approval_status_id?
If integer then change to Text
|
|
|
DaveRexel
Posts: 50
|
Posted: 05/17/2004, 12:35 PM |
|
::
Here's some debugging advice
try to display
$absence->approval_status_id->GetValue()
try your query with absence_id=1 (or 2, as long as the value exists in your database)
check as well for the two lines that are required in the Custom Code
global $DBTrainingDB
global $absence
and most important would be the scope of the Event in which the call to GetValue() is made
assuming a CCS Grid your best bet for colouring rows woiuld be the Event "Before Show Row" which if executed at the Grid level would have sufficient scope to get and set your variables, use the IDE to insert the Event and try moving your code there.
_________________
/Dave
RexDesign CodeCharge Studio Tutorials
http://rexdesign.com/ccs/ |
|
|
|