{"id":47,"date":"2016-11-20T13:41:47","date_gmt":"2016-11-20T13:41:47","guid":{"rendered":"http:\/\/www.sqldashboards.com\/b\/?p=47"},"modified":"2016-11-20T13:41:47","modified_gmt":"2016-11-20T13:41:47","slug":"creating-highlighted-rows","status":"publish","type":"post","link":"https:\/\/www.sqldashboards.com\/b\/creating-highlighted-rows\/","title":{"rendered":"Creating Highlighted Rows"},"content":{"rendered":"<p>This is a quick video tutorial showing how to add highlighted rows to a dashboard as a few people had emailed asking this:<\/p>\n<p><!--raw--><\/p>\n<div class=\"media\" itemscope itemtype=\"http:\/\/schema.org\/VideoObject\">\n<h3 itemprop=\"name\">How to Highlight Rows in an sqlDashboard<\/h3>\n<p>\t\t\t<meta itemprop=\"thumbnailUrl\" content=\"\/videos\/sql-dashboards-highlighted-rows.png\" \/><br \/>\n\t\t\t<meta itemprop=\"embedURL\" content=\"\/videos\/sql-dashboards-highlighted-rows.mp4\" \/><\/p>\n<p>\t\t\t<video width=\"854\" height=\"480\" poster=\"\/videos\/sql-dashboards-highlighted-rows.png\" controls><source src=\"\/videos\/sql-dashboards-highlighted-rows.mp4\" type=\"video\/mp4\" \/><object id=\"csSWFb\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"  width=\"854\" height=\"480\"><param name=\"movie\" value=\"\/js\/video_controller.swf\" \/><param name=\"scale\" value=\"showall\" \/><param name=\"bgcolor\" value=\"#1a1a1a\" \/><param name=\"allowfullscreen\" value=\"true\" \/><param name=\"allowscriptaccess\" value=\"always\" \/><param name=\"flashvars\" value=\"tocdoc=left&amp;showsearch=false&amp;xmp=\/videos\/sql-dashboards-highlighted-rows.xml&amp;autostart=false&amp;autohide=true&amp;content=\/videos\/sql-dashboards-highlighted-rows.mp4&amp;thumb=\/videos\/sql-dashboards-highlighted-rows.png&amp;containerwidth=854&amp;containerheight=480&amp;smoothing=true&amp;enablejsapi=true&amp;fullscreen=true&amp;windowbox=false&amp;showbranding=false&amp;showstartscreen=true&amp;showendscreen=false&amp;basecolor=272727&amp;loop=false\" \/><!--[if !IE]>--><br \/>\n\t\t\t\t\t<object type=\"application\/x-shockwave-flash\" data=\"\/js\/video_controller.swf\"  width=\"854\" height=\"480\"><param name=\"scale\" value=\"showall\" \/><param name=\"bgcolor\" value=\"#1a1a1a\" \/><param name=\"allowfullscreen\" value=\"true\" \/><param name=\"allowscriptaccess\" value=\"always\" \/><param name=\"flashvars\" value=\"tocdoc=left&amp;showsearch=false&amp;xmp=\/videos\/sql-dashboards-highlighted-rows.xml&amp;autostart=false&amp;autohide=true&amp;content=\/videos\/sql-dashboards-highlighted-rows.mp4&amp;thumb=\/kdb-guides\/videos\/sql-dashboards-highlighted-rows.png&amp;containerwidth=854&amp;containerheight=480&amp;smoothing=true&amp;enablejsapi=true&amp;fullscreen=true&amp;windowbox=false&amp;showbranding=false&amp;showstartscreen=true&amp;showendscreen=false&amp;basecolor=272727&amp;loop=false\" \/><!--<![endif]--><\/p>\n<div>\n<p>The video content presented here requires JavaScript to be enabled and the latest version of the Adobe Flash Player. If you are using a browser with JavaScript disabled please enable it now. Otherwise, please update your version of the free Adobe Flash Player by <a href=\"http:\/\/www.adobe.com\/go\/getflashplayer\">downloading here<\/a>. <\/p>\n<\/p><\/div>\n<p>\t\t\t\t\t<!--[if !IE]>--><\/object><br \/>\n\t\t\t\t\t<!--<![endif]--><\/object><\/video>\n\t\t<\/div>\n<p><!\u2013\/raw\u2013><\/p>\n<p>To highlight a row we use specially named sqlDashboards columns SD_ that affect how the result is displayed but are not shown in the table<\/p>\n<ol>\n<li>Add a column called <strong>SD_BGCOLOR<\/strong> specifying a color to use for the background of that row e.g. &#8216;green&#8217; or using HTML <a href='https:\/\/en.wikipedia.org\/wiki\/Web_colors#Hex_triplet'>hex triplet<\/a> notation e.g. #224466<\/li>\n<li>Add a column called <strong>SD_FGCOLOR<\/strong> specifying the color to use for the foreground of that row<\/li>\n<\/ol>\n<p><a href='https:\/\/en.wikipedia.org\/wiki\/Web_colors#Hex_triplet'><strong>Hex triplet<\/strong><\/a> is a six-digit, three-byte hexadecimal number used in HTML, CSS, SVG, and other computing applications to represent colors. The bytes represent the red, green and blue components of the color. One byte represents a number in the range 00 to FF (in hexadecimal notation), or 0 to 255 in decimal notation. This represents the least (0) to the most (255) intensity of each of the color components. <\/p>\n<h3>Using Case When<\/h3>\n<p>Commonly you will probably want to use SQL&#8217;s CASE-WHEN to alternate colors depending on an existing column value. e.g.<\/p>\n<p>[raw]<br \/>\n<textarea rows=\"5\" cols=\"120\" class='code' id='mysql-row-highlighting-124'><br \/>\nSELECT *,<br \/>\n    CASE WHEN price>100 THEN &#8216;#DDFFDD&#8217; ELSE &#8216;white&#8217; END AS SD_BGCOLOR,<br \/>\n    CASE WHEN price>100 THEN &#8216;#225522&#8217; ELSE &#8216;red&#8217; END AS SD_FGCOLOR<br \/>\n FROM stock<br \/>\n<\/textarea><script type='text\/javascript'>var myCodeMirror = CodeMirror.fromTextArea(document.getElementById('mysql-row-highlighting-124'), {lineNumbers: true, matchBrackets: true, indentUnit: 4, tabMode: 'default', mode: 'text\/x-plsql', readOnly:true });<\/script><br \/>\n[\/raw]<br \/>\n<img src='\/videos\/sql-dashboards-highlighted-rows.png' width='852' height='480' alt='highlighting rows in an sql dashboard' \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a quick video tutorial showing how to add highlighted rows to a dashboard as a few people had emailed asking this: How to Highlight Rows in an sqlDashboard The video content presented here requires JavaScript to be enabled and the latest version of the Adobe Flash Player. If you are using a browser [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.sqldashboards.com\/b\/wp-json\/wp\/v2\/posts\/47"}],"collection":[{"href":"https:\/\/www.sqldashboards.com\/b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqldashboards.com\/b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqldashboards.com\/b\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqldashboards.com\/b\/wp-json\/wp\/v2\/comments?post=47"}],"version-history":[{"count":5,"href":"https:\/\/www.sqldashboards.com\/b\/wp-json\/wp\/v2\/posts\/47\/revisions"}],"predecessor-version":[{"id":52,"href":"https:\/\/www.sqldashboards.com\/b\/wp-json\/wp\/v2\/posts\/47\/revisions\/52"}],"wp:attachment":[{"href":"https:\/\/www.sqldashboards.com\/b\/wp-json\/wp\/v2\/media?parent=47"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqldashboards.com\/b\/wp-json\/wp\/v2\/categories?post=47"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqldashboards.com\/b\/wp-json\/wp\/v2\/tags?post=47"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}