CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Search Grid if status = on, display green image - (RESOLVED)

Print topic Send  topic

Author Message
SecureCloud


Posts: 51
Posted: 10/26/2012, 10:24 AM

the problem i am having, (and i would like step by step please)...

is i want to replace a status field text in a grid, with an image
if status text = 'on' then show GREEN image
if status text = 'off' then show RED image

i want it to check the VALUE of STATUS and USE image based on TEXT
ON / OFF, or ACTIVE / INACTIVE

i have looked EVERYWHERE..

also when i create the GRID, should i check
ADD PANELS to each COLUMN
(does that break it down by ID ?)

Somebody, PLEASE HELP ME...

i am using PHP, (i think this can be accomplished with JavaScript)
and CodeCharge Studio 5

this is a mockup of what i would like to do...




i NEED help with this for Project ASAP Please...
TJ
_________________
-------------------------------------------------------------------------------------------------
If this helped You, Please Donate to SecureCloud Here, ANY amount Accepted.
http://securecloud.biz/donate/
Thank You, Your help Keeps us Going.

View profile  Send private message
bannedone


Posts: 273
Posted: 10/26/2012, 10:41 AM

Hi

I will try and explain how to do this.

On your grid's Status field, change it to an image control. Set it's data source to your DB Status Field.

Now in the BeforeShow event for the image add custom code like this.

$image = "path/to/image/yourGREENimagefile.jpg";

if($Container->your_status_control_name->GetValue()=="off") {

$image = "path/to/image/yourREDimagefile.jpg";

}

$Container->your_status_control_name->SetValue($image);

That should do it.

Have fun
8-)

_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2
View profile  Send private message
SecureCloud


Posts: 51
Posted: 10/26/2012, 10:43 AM

what if there are 3 values, can you show me an example of that.

i think alot of people will use this post in the future.
_________________
-------------------------------------------------------------------------------------------------
If this helped You, Please Donate to SecureCloud Here, ANY amount Accepted.
http://securecloud.biz/donate/
Thank You, Your help Keeps us Going.

View profile  Send private message
SecureCloud


Posts: 51
Posted: 10/26/2012, 10:50 AM

it worked, you are the MAN...

for future reference, can you show me code for 3 VALUES..
_________________
-------------------------------------------------------------------------------------------------
If this helped You, Please Donate to SecureCloud Here, ANY amount Accepted.
http://securecloud.biz/donate/
Thank You, Your help Keeps us Going.

View profile  Send private message
bannedone


Posts: 273
Posted: 10/26/2012, 10:59 AM

To do 3, 4, or 1 million different images, just do if statements and check the text and set the $image appropriately...

You could use a switch function also.





_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2
View profile  Send private message
SecureCloud


Posts: 51
Posted: 10/26/2012, 11:10 AM

**** UPDATE *****

this works like this, IF VALUES are ON or OFF display image, if OTHER TEXT then display NONE
(like ON, OFF, OFF1).. OFF1 shows NO IMAGE...

  
$image = "";  
  
if($Container->status->GetValue()=="off") {  
$image = "red.gif";  
}  
if($Container->status->GetValue()=="on") {  
$image = "green.gif";  
}  
  
$Container->status->SetValue($image);    

_________________
-------------------------------------------------------------------------------------------------
If this helped You, Please Donate to SecureCloud Here, ANY amount Accepted.
http://securecloud.biz/donate/
Thank You, Your help Keeps us Going.

View profile  Send private message
bannedone


Posts: 273
Posted: 10/26/2012, 11:16 AM

Here is an example if you use the switch function.....

  
switch ($Container->your_status_control_name->GetValue())  
{  
  
case "off":  
$image = "path/to/image/yourREDimagefile.jpg";  
break;  
  
case "on":  
$image = "path/to/image/yourGREENimagefile.jpg";  
break;  
  
case "somethingelse":  
$image = "path/to/image/yourSOMETHINGELSEimagefile.jpg";  
break;  
  
case "anothervalue":  
$image = "path/to/image/yourANOTHERVALUEimagefile.jpg";  
break;  
  
//So On To 1 Million of them if you like... LOL  
  
default:  
$image = "path/to/image/yourBLANKorDEFAULTimagefile.jpg";  
  
}  
  
$Container->your_status_control_name->SetValue($image);  
  
Does that help???

How long you been coding in PHP????

Have fun
8-)

_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2
View profile  Send private message
SecureCloud


Posts: 51
Posted: 10/26/2012, 11:36 AM

many many years...

but new to codecharge, tryin to take what i know and apply it here.

This had me stumped.. u made it REALLY easy for me.. Thanks again.
_________________
-------------------------------------------------------------------------------------------------
If this helped You, Please Donate to SecureCloud Here, ANY amount Accepted.
http://securecloud.biz/donate/
Thank You, Your help Keeps us Going.

View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.