ARADTech
Joined: 03 Oct 2004
Posts: 3
Posted: 2004-10-03 21:20
Back to top
Reply with quote
|
Ok here is what I want to do and I have no idea how it is best to achieve this.
In my table I have a enum field that has these 3 status's
AVAIL , PENDING , SOLD.
What I am trying to achieve is to have the page show a different color in the view for each of those status's so for instance the AVAIL would show up green , the PENDING yellow, and the SOLD red.
Any help would be much appreciated , please and thank you in advance :)
Peace and Creativity
Chris
|
ARADTech
Joined: 03 Oct 2004
Posts: 3
Posted: 2004-10-03 22:56
Back to top
Reply with quote
|
Code: |
$opts['fdd']['status'] = array(
'name' => 'Status',
'select' => 'T',
'escape' => false,
'maxlen' => 7,
'values' => array(
"avail",
"pending",
"sold"),
'default' => 'avail',
'sort' => true
);
$opts['fdd']['status']['sql|LF'] =
'if( status = "sold",
CONCAT("<span style=\"color:red\">",
status, "</span>"), status )'; |
This will color code the status to red, how do I make it do the rest ?
Any help is much appreciated :)
Peace and Creativity
Chris
|
ajh
Joined: 17 Dec 2003
Posts: 236
Posted: 2004-10-04 22:07
Back to top
Reply with quote
|
How about:
Code: |
$opts['fdd']['status']['sql|LF'] =
'CONCAT("<span style=\"color:",
CASE status
WHEN "sold" THEN "red"
WHEN "pending" THEN "yellow"
ELSE "green"
END,
"\">", status, "</span>")';
|
You need to check the exact syntax as I've probably introduced a typo...for your ref, this is the page in the MySQL manual:
http://dev.mysql.com/doc/mysql/en/Control_flow_functions.html
|
ARADTech
Joined: 03 Oct 2004
Posts: 3
Posted: 2004-10-05 00:18
Back to top
Reply with quote
|
Thanks bro that worked perfect, much appreciated!
Peace and Creativity
Chris
|
bentuinstra
Joined: 12 Sep 2004
Posts: 29
Posted: 2005-02-16 10:41
Back to top
Reply with quote
|
Hi,
I would like to do something with background color of a date field. I use this code:
Code: |
$opts['fdd']['DUEDATE'] = array(
'name' => 'DUEDATE',
'escape' => false,
'select' => 'T',
'calendar' => true,
'maxlen' => 10,
'sort' => true,
'sql|LF' => 'CONCAT("<span style=\"background-color:",
CASE PMEtable0.DUEDATE
WHEN PMEtable0.DUEDATE<CURDATE() THEN "ffaa00"
ELSE "#aaff00"
END,
"\">", PMEtable0.DUEDATE, "</span>")'
); |
The color always goes for the "ELSE" option, what do I do wrong?
Kind regards,
Ben
|
ajh
Joined: 17 Dec 2003
Posts: 236
Posted: 2005-02-16 10:54
Back to top
Reply with quote
|
Try this:
Code: |
$opts['fdd']['DUEDATE'] = array(
'name' => 'DUEDATE',
'escape' => false,
'select' => 'T',
'calendar' => true,
'maxlen' => 10,
'sort' => true,
'sql|LF' => 'CONCAT("<span style=\"background-color:",
IF(PMEtable0.DUEDATE<CURDATE(),"#ffaa00","#aaff00"),
"\">", PMEtable0.DUEDATE, "</span>")'
); |
Again - check the syntax in the MySQL manual
|
bentuinstra
Joined: 12 Sep 2004
Posts: 29
Posted: 2005-02-16 12:51
Back to top
Reply with quote
|
Hi AJH,
This works fine. (Syntax oke ;-)
But it has a strange side effect. Since I sort on the dued[img]ate I now see that the records who are overdue (duedate<curdate) are sorted below the other records.
Do you have any idea what is happening here?
kind regards,
Ben
|
bentuinstra
Joined: 12 Sep 2004
Posts: 29
Posted: 2005-02-16 12:55
Back to top
Reply with quote
|
Found the solution.
It seems that the sorting is done on the whole field (including colorcode). Since the colorcode is earlier in the field....
So I have to change colors ;-)
Cheers Ben
|
ajh
Joined: 17 Dec 2003
Posts: 236
Posted: 2005-02-16 14:47
Back to top
Reply with quote
|
If you want the correct sort sequence, why don't you put an HTML comment just before the SPAN with the field data in it. That should fool PME:
Code: |
'sql|LF' => 'CONCAT("<!-- ",PMEtable0.DUEDATE,"--><span style=\"background-color:", IF(PMEtable0.DUEDATE<CURDATE(),"#ffaa00","#aaff00"),
"\">", PMEtable0.DUEDATE, "</span>")' |
PME will sort on whatever is in the comment, but will display whatever is in the SPAN.
|
bentuinstra
Joined: 12 Sep 2004
Posts: 29
Posted: 2005-02-18 09:53
Back to top
Reply with quote
|
I will test this next monday,
Kind regards Ben
|
bentuinstra
Joined: 12 Sep 2004
Posts: 29
Posted: 2005-02-24 13:07
Back to top
Reply with quote
|
Hi AJH,
Yhis code works fine, exactly like I wanted it to do,
Thanks a lot for your time and support,
Ben
|
westdesign
Joined: 20 Nov 2006
Posts: 2
Posted: 2007-09-19 13:28
Back to top
Reply with quote
|
bentuinstra wrote: |
Hi AJH,
Yhis code works fine, exactly like I wanted it to do,
Thanks a lot for your time and support,
Ben |
At the actualy version is something changed ? I try in all the ways using the codes above, but I can't coloring in different way some value.
The <span.... code are displayed like text in the page... and is not change the style...
I think something if filtering the html codes....
Any help ?!
Thanx in advance...
|
bentuinstra
Joined: 12 Sep 2004
Posts: 29
Posted: 2007-09-19 14:20
Back to top
Reply with quote
|
Hi Westdesign,
This is the code I use:
Code: |
$opts['fdd']['DATUMGEREED'] = array(
'name' => 'GEREED',
'select' => 'T',
'calendar' => true,
'nowrap' => true,
'maxlen' => 10,
'escape' => false,
'sql|LF' => 'CONCAT("<span style=\"background-color:",
IF(PMEtable0.DATUMGEREED<=CURDATE(),"yellow","white"),
"\">", PMEtable0.DATUMGEREED, "</span>")',
'sort' => true
);
|
Hope this example helps.
The escape line is important.
Kind regards,
Ben
|
franciscohm
Joined: 08 May 2008
Posts: 33
Posted: 2008-05-09 12:33
Back to top
Reply with quote
|
Hi all,
I do not know why (maybe because I am using MySQL 5.1)
The expression
CASE
does not work for me like in:
Code: |
$opts['fdd']['provider']['sql|LF'] = 'CONCAT("<span style=color:", SELECT CASE WHEN provider="Ferrari" THEN "red" ELSE "green" END CASE,">", provider, "</span>")'; |
However the expression
IF
works fine, like in:
Code: |
$opts['fdd']['provider']['sql|LF'] = 'if( provider= "Ferrari", CONCAT("<span style=\"color:red\"><b>", provider, "</b></span>"), if( provider= "BMW", CONCAT("<span style=\"color:blue\"><b>", provider, "</b></span>"),provider))'; |
Maybe this is of interest for anyboy else... :-)
|
collegefootball
Joined: 09 Mar 2024
Posts: 173
Posted: 2024-04-04 04:33
Back to top
Reply with quote
|
https://www.osubuckeyesjerseyspro.com/shop-by-players-archie-griffin-jersey-c-5_62.html Archie Griffin Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-austin-mack-jersey-c-5_37.html Austin Mack Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-baron-browning-jersey-c-5_25.html Baron Browning Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-bradley-roby-jersey-c-5_12.html Bradley Roby Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-bryson-rodgers-jersey-c-5_83.html Bryson Rodgers Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-calvin-simpsonhunt-jersey-c-5_46.html C.J. Stroud Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-cameron-heyward-jersey-c-5_89.html Calvin Simpson-Hunt Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-cameron-johnston-jersey-c-5_86.html Cameron Heyward Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-chase-young-jersey-c-5_17.html Cameron Johnston Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-chip-trayanum-jersey-c-5_50.html Chase Young Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-chris-olave-jersey-c-5_16.html Chip Trayanum Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-cj-stroud-jersey-c-5_31.html Chris Olave Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-corey-linsley-jersey-c-5_72.html Corey Linsley Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-curtis-samuel-jersey-c-5_22.html Curtis Samuel Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-dallan-hayden-jersey-c-5_28.html Dallan Hayden Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-davison-igbinosun-jersey-c-5_13.html Davison Igbinosun Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-davon-hamilton-jersey-c-5_67.html DaVon Hamilton Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-dawand-jones-jersey-c-5_78.html Dawand Jones Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-denzel-ward-jersey-c-5_41.html Denzel Ward Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-dremont-jones-jersey-c-5_82.html Dre'Mont Jones Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-dwayne-haskins-jr-jersey-c-5_32.html Dwayne Haskins Jr. Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-eddie-george-jersey-c-5_57.html Eddie George Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-eli-apple-jersey-c-5_42.html Eli Apple Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-emeka-egbuka-jersey-c-5_18.html Emeka Egbuka Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-ezekiel-elliott-jersey-c-5_45.html Ezekiel Elliott Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-garrett-wilson-jersey-c-5_27.html Garrett Wilson Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-howard-cassady-jersey-c-5_61.html Howard Cassady Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-jake-mcquaide-jersey-c-5_87.html J.K. Dobbins Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-jalyn-holmes-jersey-c-5_39.html Jake McQuaide Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-jaxon-smithnjigba-jersey-c-5_40.html Jalyn Holmes Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-jeff-okudah-jersey-c-5_10.html Jaxon Smith-Njigba Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-jeremy-ruckert-jersey-c-5_84.html Jeff Okudah Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-jermaine-mathews-jr-jersey-c-5_56.html Jeremy Ruckert Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-jerome-baker-jersey-c-5_47.html Jermaine Mathews Jr. Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-jk-dobbins-jersey-c-5_14.html Jerome Baker Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-joey-bosa-jersey-c-5_88.html Joey Bosa Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-johnathan-hankins-jersey-c-5_64.html Johnathan Hankins Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-jonah-jackson-jersey-c-5_74.html Jonah Jackson Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-jonathon-cooper-jersey-c-5_6.html Jonathon Cooper Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-jordan-fuller-jersey-c-5_21.html Jordan Fuller Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-josh-myers-jersey-c-5_71.html Josh Myers Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-julian-fleming-jersey-c-5_23.html Julian Fleming Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-justin-fields-jersey-c-5_11.html Justin Fields Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-jyaire-brown-jersey-c-5_49.html Jyaire Brown Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-kamryn-babb-jersey-c-5_8.html Kamryn Babb Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-kyle-mccord-jersey-c-5_30.html Kyle McCord Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-les-horvath-jersey-c-5_53.html Les Horvath Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-liam-mccullough-jersey-c-5_63.html Liam McCullough Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-lorenzo-styles-jr-jersey-c-5_24.html Lorenzo Styles Jr. Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-luke-farrell-jersey-c-5_85.html Luke Farrell Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-luke-wypler-jersey-c-5_66.html Luke Wypler Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-malik-harrison-jersey-c-5_60.html Malik Harrison Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-malik-hooker-jersey-c-5_54.html Malik Hooker Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-marshon-lattimore-jersey-c-5_15.html Marshon Lattimore Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-marvin-harrison-jr-jersey-c-5_48.html Marvin Harrison Jr. Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-michael-jordan-jersey-c-5_75.html Michael Jordan Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-michael-thomas-jersey-c-5_19.html Michael Thomas Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-miyan-williams-jersey-c-5_20.html Miyan Williams Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-nicholas-petitfrere-jersey-c-5_77.html Nicholas Petit-Frere Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-nick-bosa-jersey-c-5_90.html Nick Bosa Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-nick-vannett-jersey-c-5_80.html Nick Vannett Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-noah-brown-jersey-c-5_79.html Noah Brown Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-paris-johnson-jr-jersey-c-5_76.html Paris Johnson Jr. Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-parris-campbell-jersey-c-5_52.html Parris Campbell Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-pat-elflein-jersey-c-5_69.html Pat Elflein Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-pete-werner-jersey-c-5_51.html Pete Werner Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-raekwon-mcmillan-jersey-c-5_26.html Raekwon McMillan Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-ronnie-hickman-jersey-c-5_43.html Ronnie Hickman Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-sam-hubbard-jersey-c-5_29.html Sam Hubbard Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-shaun-wade-jersey-c-5_55.html Shaun Wade Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-tanner-mccalister-jersey-c-5_44.html Tanner McCalister Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-taylor-decker-jersey-c-5_70.html Taylor Decker Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-terry-mclaurin-jersey-c-5_81.html Terry McLaurin Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-thayer-munford-jr-jersey-c-5_7.html Thayer Munford Jr. Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-tommy-togiai-jersey-c-5_73.html Tommy Togiai Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-treveyon-henderson-jersey-c-5_59.html TreVeyon Henderson Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-trey-sermon-jersey-c-5_33.html Trey Sermon Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-troy-smith-jersey-c-5_35.html Troy Smith Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-tyquan-lewis-jersey-c-5_68.html Tyquan Lewis Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-tyreke-smith-jersey-c-5_36.html Tyreke Smith Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-vic-janowicz-jersey-c-5_58.html Vic Janowicz Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-vonn-bell-jersey-c-5_38.html Vonn Bell Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-wyatt-davis-jersey-c-5_65.html Wyatt Davis Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-xavier-johnson-jersey-c-5_9.html Xavier Johnson Ohio State Buckeyes Jerseys
https://www.osubuckeyesjerseyspro.com/shop-by-players-zach-harrison-jersey-c-5_34.html Zach Harrison Ohio State Buckeyes Jerseys
|
Post new topic
Reply to topic
|