<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://communitytest.tessitura.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Conditionally format the color of text</title><link>https://communitytest.tessitura.com/topical_groups/analytics-coffee/w/wiki/766/conditionally-format-the-color-of-text</link><description /><dc:language>en-US</dc:language><generator>Telligent Community 12 Non-Production</generator><item><title>Conditionally format the color of text</title><link>https://communitytest.tessitura.com/topical_groups/analytics-coffee/w/wiki/766/conditionally-format-the-color-of-text</link><pubDate>Fri, 10 Nov 2023 04:30:06 GMT</pubDate><guid isPermaLink="false">fd08b0f2-65fa-4b2b-916a-cce3e88b61d0:a5ea30e4-5bc7-4d96-ae80-e1cb5816103f</guid><dc:creator>Heath Wilder</dc:creator><comments>https://communitytest.tessitura.com/topical_groups/analytics-coffee/w/wiki/766/conditionally-format-the-color-of-text#comments</comments><description>Current Revision posted to Wiki by Heath Wilder on 11/10/2023 4:30:06 AM&lt;br /&gt;
&lt;p&gt;&lt;span style="font-size:75%;"&gt;&lt;em&gt;NB/ To&amp;nbsp;make these modifications below you&amp;#39;ll need to edit your widgets script and add&amp;nbsp;these special scripts in.&amp;nbsp;&lt;/em&gt;&lt;em&gt;That&amp;nbsp;guide is&amp;nbsp;&lt;a href="/topical_groups/analytics-coffee/w/wiki/807/analytics-scripts-not-saving"&gt;HERE&lt;/a&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1herjp6al0"&gt;Conditionally format the color of text within a Pivot Table column based on value (JQuery/JavaScript)&lt;/h2&gt;
&lt;p&gt;From Daniel Gomez&amp;nbsp;&lt;a href="/tessitura_software_forums/f/tessitura_shared_reports-9/24079/analytics-date-time-functions"&gt;https://community.tessituranetwork.com/tessitura_software_forums/f/tessitura_shared_reports-9/24079/analytics-date-time-functions&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span&gt;Here are&amp;nbsp;some examples of using these functions that I threw together quickly.&amp;nbsp; The secret to using these functions is that you must have a&amp;nbsp;date/time column included in the&amp;nbsp;widget, otherwise,&amp;nbsp;SiSense has nothing to evaluate the functions against. Lots of much fancier ways to present the data you&amp;#39;re interested in depending on the visualization that&amp;nbsp;best tells the&amp;nbsp;narrative you are trying to present.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve also included below a pretty simple script you can use to&amp;nbsp;conditionally format the color of&amp;nbsp;text within a Pivot Table column based on value.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p style="padding-left:30px;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;code&gt;&lt;span style="color:#808080;"&gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="javascript"&gt;//Text column formatting
widget.on(&amp;#39;ready&amp;#39;, function(se, ev){

    var evalCol = 4; //fidx val of column to evaluate
    var formatCol = $(&amp;#39;td[fidx=&amp;#39;+evalCol+&amp;#39;]&amp;#39;); //jQuery pull entire eval column into array

    $.each(formatCol, function(a, b){ //function to loop through array
        if($(this).attr(&amp;#39;val&amp;#39;) &amp;gt; 0) { //evaluate text content of each cell in column&amp;#39;s array. note: need to use JavaScript this instead of jQuery $(this), since textContent is a JavaScript attribute.
            $(this).css(&amp;#39;color&amp;#39;,&amp;#39;green&amp;#39;); //set conditional styling
        }
        else if ($(this).attr(&amp;#39;val&amp;#39;) &amp;lt; 0) {
            $(this).css(&amp;#39;color&amp;#39;,&amp;#39;red&amp;#39;);
        }
    });
});&lt;/pre&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;Heath&amp;#39;s notes&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;font-size:inherit;"&gt;line 3&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; evaluate column #4 - This is the one to be recolored&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;font-size:inherit;"&gt;line 7-9&amp;nbsp; &amp;nbsp; if the data is more than 0 make it green&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;font-size:inherit;"&gt;line 11-12&amp;nbsp;&amp;nbsp;if the data is&amp;nbsp;less than 0 make it&amp;nbsp;red&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;img alt=" " src="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-01-14/6521.Arsht-_2D00_-SiSsense-Analytics-Date-and-Time-Functions-_2D00_-01.jpg" /&gt;&lt;img alt=" " src="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-01-14/2783.Arsht-_2D00_-SiSsense-Analytics-Date-and-Time-Functions-_2D00_-02-_2D00_-DiffPastPeriod.jpg" /&gt;&lt;img alt=" " src="/resized-image/__size/1040x988/__key/communityserver-wikis-components-files/00-00-00-01-14/2437.Arsht-_2D00_-SiSsense-Analytics-Date-and-Time-Functions-_2D00_-03-_2D00_-GrowthPastWeek.jpg" /&gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://communitytest.tessitura.com/cfs-file/__key/communityserver-wikis-components-files/00-00-00-01-14/7608.ArshtCenter_5F00_SiSenseDateTimeFunctionExamples_5F00_2019_2D00_12_2D00_17.dash"&gt;communitytest.tessitura.com/.../7608.ArshtCenter_5F00_SiSenseDateTimeFunctionExamples_5F00_2019_2D00_12_2D00_17.dash&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: Tessitura Analytics, Javascript, jquery, conditional format&lt;/div&gt;
</description></item><item><title>Conditionally format the color of text</title><link>https://communitytest.tessitura.com/topical_groups/analytics-coffee/w/wiki/766/conditionally-format-the-color-of-text/revision/3</link><pubDate>Fri, 10 Nov 2023 04:18:47 GMT</pubDate><guid isPermaLink="false">fd08b0f2-65fa-4b2b-916a-cce3e88b61d0:a5ea30e4-5bc7-4d96-ae80-e1cb5816103f</guid><dc:creator>Heath Wilder</dc:creator><comments>https://communitytest.tessitura.com/topical_groups/analytics-coffee/w/wiki/766/conditionally-format-the-color-of-text#comments</comments><description>Revision 3 posted to Wiki by Heath Wilder on 11/10/2023 4:18:47 AM&lt;br /&gt;
&lt;p&gt;&lt;span style="font-size:75%;"&gt;&lt;em&gt;NB/ To&amp;nbsp;make these modifications below you&amp;#39;ll need to edit your widgets script and add&amp;nbsp;these special scripts in.&amp;nbsp;&lt;/em&gt;&lt;em&gt;That&amp;nbsp;guide is&amp;nbsp;&lt;a href="/topical_groups/analytics-coffee/w/wiki/807/analytics-scripts-not-saving"&gt;HERE&lt;/a&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1herjp6al0"&gt;Conditionally format the color of text within a Pivot Table column based on value (JQuery/JavaScript)&lt;/h2&gt;
&lt;p&gt;From Daniel Gomez&amp;nbsp;&lt;a href="/tessitura_software_forums/f/tessitura_shared_reports-9/24079/analytics-date-time-functions"&gt;https://community.tessituranetwork.com/tessitura_software_forums/f/tessitura_shared_reports-9/24079/analytics-date-time-functions&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span&gt;Here are&amp;nbsp;some examples of using these functions that I threw together quickly.&amp;nbsp; The secret to using these functions is that you must have a&amp;nbsp;date/time column included in the&amp;nbsp;widget, otherwise,&amp;nbsp;SiSense has nothing to evaluate the functions against. Lots of much fancier ways to present the data you&amp;#39;re interested in depending on the visualization that&amp;nbsp;best tells the&amp;nbsp;narrative you are trying to present.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve also included below a pretty simple script you can use to&amp;nbsp;conditionally format the color of&amp;nbsp;text within a Pivot Table column based on value.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p style="padding-left:30px;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;code&gt;&lt;span style="color:#808080;"&gt;//Text column formatting&lt;/span&gt;&lt;br /&gt;widget.on(&amp;#39;ready&amp;#39;, function(se, ev){&lt;br /&gt;&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div style="padding-left:60px;"&gt;&lt;code&gt;&lt;span style="color:#0000ff;"&gt;var evalCol = 4;&lt;span style="color:#808080;"&gt; //&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;fidx val of column to evaluate&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;span style="color:#0000ff;"&gt;var formatCol = $(&amp;#39;td[fidx='+evalCol+']&amp;#39;); &lt;span style="color:#808080;"&gt;//&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;jQuery pull entire eval column into array&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;span style="color:#0000ff;"&gt;$.each(formatCol, function(a, b){ &lt;span style="color:#808080;"&gt;//function to loop through array&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style="padding-left:30px;"&gt;&lt;code&gt;&lt;span style="color:#0000ff;"&gt;if($(this).attr(&amp;#39;val&amp;#39;) &amp;gt; 0) { &lt;span style="color:#808080;"&gt;//evaluate text content of each cell in column&amp;#39;s array. note: need to use JavaScript this instead of jQuery $(this), since textContent is a JavaScript attribute.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style="padding-left:30px;"&gt;&lt;code&gt;&lt;span style="color:#0000ff;"&gt;$(this).css(&amp;#39;color&amp;#39;,&amp;#39;green&amp;#39;); &lt;span style="color:#808080;"&gt;//set conditional styling&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;code&gt;&lt;span style="color:#0000ff;"&gt;}&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;span style="color:#0000ff;"&gt;else if ($(this).attr(&amp;#39;val&amp;#39;) &amp;lt; 0) {&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style="padding-left:30px;"&gt;&lt;code&gt;&lt;span style="color:#0000ff;"&gt;$(this).css(&amp;#39;color&amp;#39;,&amp;#39;red&amp;#39;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;span style="color:#0000ff;"&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;span style="color:#0000ff;"&gt;});&lt;/span&gt;&lt;/div&gt;
&lt;p style="padding-left:30px;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;code&gt;});&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;img src="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-01-14/6521.Arsht-_2D00_-SiSsense-Analytics-Date-and-Time-Functions-_2D00_-01.jpg" alt=" " /&gt;&lt;img src="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-01-14/2783.Arsht-_2D00_-SiSsense-Analytics-Date-and-Time-Functions-_2D00_-02-_2D00_-DiffPastPeriod.jpg" alt=" " /&gt;&lt;img alt=" " src="/resized-image/__size/1040x988/__key/communityserver-wikis-components-files/00-00-00-01-14/2437.Arsht-_2D00_-SiSsense-Analytics-Date-and-Time-Functions-_2D00_-03-_2D00_-GrowthPastWeek.jpg" /&gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://communitytest.tessitura.com/cfs-file/__key/communityserver-wikis-components-files/00-00-00-01-14/7608.ArshtCenter_5F00_SiSenseDateTimeFunctionExamples_5F00_2019_2D00_12_2D00_17.dash"&gt;communitytest.tessitura.com/.../7608.ArshtCenter_5F00_SiSenseDateTimeFunctionExamples_5F00_2019_2D00_12_2D00_17.dash&lt;/a&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: Tessitura Analytics, Javascript, jquery, conditional format&lt;/div&gt;
</description></item><item><title>Conditionally format the color of text</title><link>https://communitytest.tessitura.com/topical_groups/analytics-coffee/w/wiki/766/conditionally-format-the-color-of-text/revision/2</link><pubDate>Wed, 08 Nov 2023 05:14:20 GMT</pubDate><guid isPermaLink="false">fd08b0f2-65fa-4b2b-916a-cce3e88b61d0:a5ea30e4-5bc7-4d96-ae80-e1cb5816103f</guid><dc:creator>Heath Wilder</dc:creator><comments>https://communitytest.tessitura.com/topical_groups/analytics-coffee/w/wiki/766/conditionally-format-the-color-of-text#comments</comments><description>Revision 2 posted to Wiki by Heath Wilder on 11/8/2023 5:14:20 AM&lt;br /&gt;
&lt;h2&gt;Conditionally format the color of text within a Pivot Table column based on value (JQuery/JavaScript)&lt;/h2&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;From Daniel Gomez&amp;nbsp;&lt;a href="/tessitura_software_forums/f/tessitura_shared_reports-9/24079/analytics-date-time-functions"&gt;https://community.tessituranetwork.com/tessitura_software_forums/f/tessitura_shared_reports-9/24079/analytics-date-time-functions&lt;/a&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;br /&gt;I&amp;#39;ve also included below a pretty simple script you can use to&amp;nbsp;conditionally format the color of&amp;nbsp;text within a Pivot Table column based on value.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;code&gt;//Text column formatting&lt;br /&gt;widget.on(&amp;#39;ready&amp;#39;, function(se, ev){&lt;br /&gt;&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;span style="color:#0000ff;"&gt;var evalCol = 4; //fidx val of column to evaluate&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;var formatCol = $(&amp;#39;td[fidx='+evalCol+']&amp;#39;); //jquery pull entire eval column into array&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;$.each(formatCol, function(a, b){ //function to loop through array&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color:#0000ff;"&gt;if($(this).attr(&amp;#39;val&amp;#39;) &amp;gt; 0) { //evaluate text conent of each cell in column&amp;#39;s array. note: need to use JavaScript this instead of JQuery $(this), since textContent is a JavaScript attribute.&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color:#0000ff;"&gt;$(this).css(&amp;#39;color&amp;#39;,&amp;#39;green&amp;#39;); //set conditional styling&lt;/span&gt;&lt;/div&gt;
&lt;span style="color:#0000ff;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;else if ($(this).attr(&amp;#39;val&amp;#39;) &amp;lt; 0) {&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color:#0000ff;"&gt;$(this).css(&amp;#39;color&amp;#39;,&amp;#39;red&amp;#39;);&lt;/span&gt;&lt;/div&gt;
&lt;span style="color:#0000ff;"&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;span style="color:#0000ff;"&gt;});&lt;/span&gt;&lt;/div&gt;
&lt;p style="padding-left:30px;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;code&gt;});&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: Tessitura Analytics, Javascript, jquery, conditional format&lt;/div&gt;
</description></item><item><title>Conditionally format the color of text within a Pivot Table column based on value (JQuery/JavaScript)</title><link>https://communitytest.tessitura.com/topical_groups/analytics-coffee/w/wiki/766/conditionally-format-the-color-of-text/revision/1</link><pubDate>Thu, 02 Jan 2020 22:53:42 GMT</pubDate><guid isPermaLink="false">fd08b0f2-65fa-4b2b-916a-cce3e88b61d0:a5ea30e4-5bc7-4d96-ae80-e1cb5816103f</guid><dc:creator>Heath Wilder</dc:creator><comments>https://communitytest.tessitura.com/topical_groups/analytics-coffee/w/wiki/766/conditionally-format-the-color-of-text#comments</comments><description>Revision 1 posted to Wiki by Heath Wilder on 1/2/2020 10:53:42 PM&lt;br /&gt;
&lt;p&gt;From Daniel Gomez&amp;nbsp;&lt;a href="/tessitura_software_forums/f/tessitura_shared_reports-9/24079/analytics-date-time-functions"&gt;https://community.tessituranetwork.com/tessitura_software_forums/f/tessitura_shared_reports-9/24079/analytics-date-time-functions&lt;/a&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;br /&gt;I&amp;#39;ve also included below a pretty simple script you can use to&amp;nbsp;conditionally format the color of&amp;nbsp;text within a Pivot Table column based on value.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;code&gt;//Text column formatting&lt;br /&gt;widget.on(&amp;#39;ready&amp;#39;, function(se, ev){&lt;br /&gt;&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;span style="color:#0000ff;"&gt;var evalCol = 4; //fidx val of column to evaluate&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;var formatCol = $(&amp;#39;td[fidx='+evalCol+']&amp;#39;); //jquery pull entire eval column into array&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;$.each(formatCol, function(a, b){ //function to loop through array&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color:#0000ff;"&gt;if($(this).attr(&amp;#39;val&amp;#39;) &amp;gt; 0) { //evaluate text conent of each cell in column&amp;#39;s array. note: need to use JavaScript this instead of JQuery $(this), since textContent is a JavaScript attribute.&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color:#0000ff;"&gt;$(this).css(&amp;#39;color&amp;#39;,&amp;#39;green&amp;#39;); //set conditional styling&lt;/span&gt;&lt;/div&gt;
&lt;span style="color:#0000ff;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;else if ($(this).attr(&amp;#39;val&amp;#39;) &amp;lt; 0) {&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="color:#0000ff;"&gt;$(this).css(&amp;#39;color&amp;#39;,&amp;#39;red&amp;#39;);&lt;/span&gt;&lt;/div&gt;
&lt;span style="color:#0000ff;"&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;span style="color:#0000ff;"&gt;});&lt;/span&gt;&lt;/div&gt;
&lt;p style="padding-left:30px;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;code&gt;});&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item></channel></rss>