<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>

<channel>
	<title>Tucker Watson</title>
	<atom:link href="http://tuckwat.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://tuckwat.com/blog</link>
	<description>Software development - Flex, Niagara AX, oBIX, and more</description>
	<pubDate>Fri, 06 Mar 2009 01:51:03 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Arrow ToolTips in Flex with Customized Color and Position</title>
		<link>http://tuckwat.com/blog/flex/arrow-tooltips-flex-customized-color-position/</link>
		<comments>http://tuckwat.com/blog/flex/arrow-tooltips-flex-customized-color-position/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 01:51:03 +0000</pubDate>
		<dc:creator>Tucker</dc:creator>
		
		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Component]]></category>

		<category><![CDATA[ToolTips]]></category>

		<guid isPermaLink="false">http://tuckwat.com/blog/?p=267</guid>
		<description><![CDATA[Flex doesn&#8217;t make it easy to customize your ToolTip&#8217;s positioning or look.  You can write your own ToolTip style and draw your own borders or you can use the &#8220;error tips&#8221; that already have arrows built in.
Manually creating and destroying tooltips
Rather than use the &#8216;toolTip&#8217; property of a component, we&#8217;re going to use the [...]]]></description>
			<content:encoded><![CDATA[<p>Flex doesn&#8217;t make it easy to customize your ToolTip&#8217;s positioning or look.  You can write your own <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=tooltips_6.html">ToolTip style and draw your own borders</a> or you can use the &#8220;error tips&#8221; that already have arrows built in.</p>
<h5 style="padding-top:5px;">Manually creating and destroying tooltips</h5>
<p>Rather than use the &#8216;toolTip&#8217; property of a component, we&#8217;re going to use the <a href="http://livedocs.adobe.com/flex/2/langref/mx/managers/ToolTipManager.html">ToolTipManager</a> to create and remove tooltips.  This method allows us to position tooltips anywhere on the stage, apply animations, and provide dynamic text.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> myToolTip<span style="color: #000000; font-weight: bold;">:</span>ToolTip;
&nbsp;
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> showToolTip<span style="color: #000000;">&#40;</span>evt<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span>, <span style="color: #004993;">text</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
   <span style="color: #009900;">// Create a simple tooltip that appears at the mouse x and y position</span>
   myToolTip = ToolTipManager.createToolTip<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Tooltip&quot;</span>, evt.<span style="color: #004993;">x</span>, evt.<span style="color: #004993;">y</span><span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> ToolTip;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #009900;">// Remove the tooltip</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> killToolTip<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
   ToolTipManager.destroyToolTip<span style="color: #000000;">&#40;</span>myToolTip<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>To use the above functions, we need to assign them to a components <i>mouseOver</i> and <i>mouseOut</i> events:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> label=<span style="color: #ff0000;">&quot;Button&quot;</span> mouseOver=<span style="color: #ff0000;">&quot;showToolTip(event)&quot;</span> mouseOut=<span style="color: #ff0000;">&quot;killToolTip()&quot;</span><span style="color: #7400FF;">/&gt;</span></span></pre></div></div>

<h5 style="padding-top:5px;">Adding arrows by using Flex&#8217;s &#8220;error tips&#8221;</h5>
<p>When creating tooltips by using &#8220;ToolTipManager.createToolTip(&#8230;)&#8221; you can pass in a 4th parameter as a string that specifices which error tip to use.  The available options are:</p>
<ul>
<li>&#8220;errorTipAbove&#8221;</li>
<li>&#8220;errorTipBelow&#8221;</li>
<li>&#8220;errorTipRight&#8221;</li>
</ul>
<p>Error tips default to a red background color and black text but you can easily change this through styles:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">myToolTip.<span style="color: #004993;">setStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;borderColor&quot;</span>, <span style="color: #990000;">&quot;#ff6600&quot;</span><span style="color: #000000;">&#41;</span>;
myToolTip.<span style="color: #004993;">setStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;color&quot;</span>, <span style="color: #990000;">&quot;white&quot;</span><span style="color: #000000;">&#41;</span>;</pre></div></div>

<h5 style="padding-top:5px;">Positioning tooltips above, below, and to the right</h5>
<p>Another pitfall when creating tooltips manually is specifying the position of the tooltip.  The &#8220;createToolTip&#8221; method requires the x and y coordinates passed in are &#8220;global&#8221; coordinates, rather than the local x and y coordinates within a container.  This makes it a little more tricky to place a tooltip directly below or to the right of a component.  The easiest way to fix this is using the method &#8220;contentToGlobal(point)&#8221;.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> pt<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Point</span><span style="color: #000000;">&#40;</span>evt.<span style="color: #004993;">currentTarget</span>.<span style="color: #004993;">x</span>, evt.<span style="color: #004993;">currentTarget</span>.<span style="color: #004993;">y</span><span style="color: #000000;">&#41;</span>;
pt = evt.<span style="color: #004993;">currentTarget</span>.<span style="color: #004993;">parent</span>.contentToGlobal<span style="color: #000000;">&#40;</span>pt<span style="color: #000000;">&#41;</span>;</pre></div></div>

<h5 style="padding-top:8px;">Putting it all together (right click for source):</h5>
<div class="other">
<iframe style="border-style:solid;" src="http://www.tuckwat.com/blog/files/CustomTooltips/CustomTooltips.html" width="584" height="200"></iframe>
</div>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?&amp;linkurl=http%3A%2F%2Ftuckwat.com%2Fblog%2Fflex%2Farrow-tooltips-flex-customized-color-position%2F&amp;linkname=Arrow%20ToolTips%20in%20Flex%20with%20Customized%20Color%20and%20Position"><img src="http://tuckwat.com/blog/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Save/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://tuckwat.com/blog/flex/arrow-tooltips-flex-customized-color-position/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flex Custom Column Chart ItemRenderer</title>
		<link>http://tuckwat.com/blog/flex/flex-custom-column-chart-itemrenderer/</link>
		<comments>http://tuckwat.com/blog/flex/flex-custom-column-chart-itemrenderer/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 15:11:25 +0000</pubDate>
		<dc:creator>Tucker</dc:creator>
		
		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Chart]]></category>

		<category><![CDATA[Component]]></category>

		<category><![CDATA[Degrafa]]></category>

		<guid isPermaLink="false">http://tuckwat.com/blog/?p=206</guid>
		<description><![CDATA[I&#8217;ve spend a lot of time lately trying to figure out how to draw on chart components and how to use Degrafa (graphics framework for Flex).  I thought it&#8217;d be cool to have a column chart change colors programmatically based on its value.
This example demonstrates how to:

Createa custom ItemRenderer and apply it to a [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve spend a lot of time lately trying to figure out how to <a title="Ely Greenfield: How to draw on charts" href="http://www.quietlyscheming.com/blog/charts/easy-custom-charts/" target="_blank">draw on chart components</a> and how to use <a title="Degrafa.org" href="http://www.degrafa.org" target="_blank">Degrafa</a> (graphics framework for Flex).  I thought it&#8217;d be cool to have a column chart change colors programmatically based on its value.</p>
<h5>This example demonstrates how to:</h5>
<ul>
<li>Createa custom ItemRenderer and apply it to a series</li>
<li>Use Degrafa to convert numbers to a color in the spectrum</li>
<li>Convert pixel to chart coordinates to smoothly change column colors</li>
</ul>
<p>See the example below, more code and comments after the break (right click to view source):</p>
<div class="other">
<iframe style="border-style:solid;" src="http://www.tuckwat.com/blog/files/ThermalColumnChart/ThermalColumnChart.html" width="584" height="300"></iframe>
</div>
<p><span id="more-206"></span></p>
<h5>Creating a programmatic ItemRenderer</h5>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> util
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">GradientType</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">Graphics</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.geom</span>.<span style="color: #004993;">Point</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.geom</span>.<span style="color: #004993;">Rectangle</span>;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">import</span> mx.charts.ChartItem;
	<span style="color: #0033ff; font-weight: bold;">import</span> mx.charts.ColumnChart;
	<span style="color: #0033ff; font-weight: bold;">import</span> mx.charts.chartClasses.LegendData;
	<span style="color: #0033ff; font-weight: bold;">import</span> mx.core.Application;
	<span style="color: #0033ff; font-weight: bold;">import</span> mx.core.IDataRenderer;
	<span style="color: #0033ff; font-weight: bold;">import</span> mx.core.UIComponent;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> ThermalColumnChartRenderer extends UIComponent implements IDataRenderer
	<span style="color: #000000;">&#123;</span>
&nbsp;
	    <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> ThermalColumnChartRenderer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
	    <span style="color: #000000;">&#123;</span>
	        <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
	    <span style="color: #000000;">&#125;</span>
	    <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> chartItem<span style="color: #000000; font-weight: bold;">:</span>ChartItem;
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> <span style="color: #004993;">data</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Object</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
	    <span style="color: #000000;">&#123;</span>
	        <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>chartItem == <span style="color: #004993;">value</span><span style="color: #000000;">&#41;</span>
	            <span style="color: #0033ff; font-weight: bold;">return</span>;
&nbsp;
	        <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span> <span style="color: #0033ff; font-weight: bold;">is</span> LegendData<span style="color: #000000;">&#41;</span>
	        	<span style="color: #0033ff; font-weight: bold;">return</span>;
	        chartItem = ChartItem<span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000000;">&#41;</span>;
	    <span style="color: #000000;">&#125;</span>	
&nbsp;
	    <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> <span style="color: #004993;">data</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Object</span>
	    <span style="color: #000000;">&#123;</span>
	        <span style="color: #0033ff; font-weight: bold;">return</span> chartItem;
	    <span style="color: #000000;">&#125;</span>
&nbsp;
	    override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> updateDisplayList<span style="color: #000000;">&#40;</span>unscaledWidth<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>,unscaledHeight<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
	    <span style="color: #000000;">&#123;</span>
	        <span style="color: #0033ff; font-weight: bold;">super</span>.updateDisplayList<span style="color: #000000;">&#40;</span>unscaledWidth, unscaledHeight<span style="color: #000000;">&#41;</span>;
&nbsp;
	        <span style="color: #009900;">// Convert the pixel location into the chart location</span>
	        <span style="color: #6699cc; font-weight: bold;">var</span> curValue<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = convertDataToLocal<span style="color: #000000;">&#40;</span>chartItem.itemRenderer.<span style="color: #004993;">y</span><span style="color: #000000;">&#41;</span>;
&nbsp;
	        <span style="color: #6699cc; font-weight: bold;">var</span> rc<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Rectangle</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Rectangle</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span>, <span style="color: #000000; font-weight:bold;">0</span>, <span style="color: #004993;">width</span> , <span style="color: #004993;">height</span> <span style="color: #000000;">&#41;</span>;
	        <span style="color: #6699cc; font-weight: bold;">var</span> columnColor<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>;
	        <span style="color: #6699cc; font-weight: bold;">var</span> g<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Graphics</span> = <span style="color: #004993;">graphics</span>;
		g.<span style="color: #004993;">clear</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		g.<span style="color: #004993;">moveTo</span><span style="color: #000000;">&#40;</span>rc.<span style="color: #004993;">left</span>,rc.<span style="color: #004993;">top</span><span style="color: #000000;">&#41;</span>;
		g.<span style="color: #004993;">lineStyle</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
&nbsp;
		<span style="color: #009900;">// Use thermal class to convert our 0-100 value to a color</span>
		g.<span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>getThermalColor<span style="color: #000000;">&#40;</span>curValue<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;	  	
&nbsp;
	        g.<span style="color: #004993;">lineTo</span><span style="color: #000000;">&#40;</span>rc.<span style="color: #004993;">right</span>,rc.<span style="color: #004993;">top</span><span style="color: #000000;">&#41;</span>;
	        g.<span style="color: #004993;">lineTo</span><span style="color: #000000;">&#40;</span>rc.<span style="color: #004993;">right</span>,rc.<span style="color: #004993;">bottom</span><span style="color: #000000;">&#41;</span>;
	        g.<span style="color: #004993;">lineTo</span><span style="color: #000000;">&#40;</span>rc.<span style="color: #004993;">left</span>,rc.<span style="color: #004993;">bottom</span><span style="color: #000000;">&#41;</span>;
	        g.<span style="color: #004993;">lineTo</span><span style="color: #000000;">&#40;</span>rc.<span style="color: #004993;">left</span>,rc.<span style="color: #004993;">top</span><span style="color: #000000;">&#41;</span>;
	        g.<span style="color: #004993;">endFill</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
  		<span style="color: #000000;">&#125;</span>
&nbsp;
  		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> getThermalColor<span style="color: #000000;">&#40;</span>num<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>
  		<span style="color: #000000;">&#123;</span>
  			<span style="color: #0033ff; font-weight: bold;">return</span> Application.application.thermalColor.getColor<span style="color: #000000;">&#40;</span>num<span style="color: #000000;">&#41;</span>;
  		<span style="color: #000000;">&#125;</span>
&nbsp;
	    <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> convertDataToLocal<span style="color: #000000;">&#40;</span>yNum<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>
	    <span style="color: #000000;">&#123;</span>
	    	<span style="color: #6699cc; font-weight: bold;">var</span> chart<span style="color: #000000; font-weight: bold;">:</span>ColumnChart = ColumnChart<span style="color: #000000;">&#40;</span>parentApplication.columnChart<span style="color: #000000;">&#41;</span>;
	    	<span style="color: #6699cc; font-weight: bold;">var</span> oldPoint<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Point</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span>,yNum<span style="color: #000000;">&#41;</span>;
	    	<span style="color: #6699cc; font-weight: bold;">var</span> newPoint<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = chart.localToData<span style="color: #000000;">&#40;</span>oldPoint<span style="color: #000000;">&#41;</span>;
&nbsp;
			<span style="color: #009900;">// Not sure why but the data value is always slightly larger than the</span>
			<span style="color: #009900;">// actual value, so cap at 100</span>
			<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>newPoint<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #000000; font-weight:bold;">100</span>;
&nbsp;
	    	<span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #000000;">&#40;</span>newPoint<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>;
	    <span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<h5>Converting a number to a color with help from Degrafa</h5>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> util
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> com.degrafa.paint.palette.PaletteUtils;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> ThermalColor
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> hi<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> lo<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> colorMap<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span>;
&nbsp;
		<span style="color: #009900;">// Number of different colors in range</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">size</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">150</span>;
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> ThermalColor<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			colorMap = getColorMap<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> setHi<span style="color: #000000;">&#40;</span>hi<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">this</span>.hi = hi;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> setLo<span style="color: #000000;">&#40;</span>lo<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">this</span>.lo = lo;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> setSize<span style="color: #000000;">&#40;</span>newSize<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">size</span> = newSize;
			colorMap = getColorMap<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>		
&nbsp;
		<span style="color: #009900;">// Generates a thermal color map with [size] many colors</span>
        <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> getColorMap<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span>
        <span style="color: #000000;">&#123;</span>
        	<span style="color: #6699cc; font-weight: bold;">var</span> colorMap<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
            <span style="color: #6699cc; font-weight: bold;">var</span> h<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>;
            <span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>=<span style="color: #000000; font-weight:bold;">0</span>; i</pre></div></div>

<h5>References:</h5>
<p><a title="Using a programmatic renderer in your ColumnChart to set the color of your columnSeries based on your data " href="http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&amp;productId=2&amp;postId=2021" target="_blank">http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&amp;productId=2&amp;postId=2021</a><br />
<a title="A Simple Degrafa Color Picker" href="http://blog.sunild.com/2009/01/simple-degrafa-color-picker.html" target="_blank"> http://blog.sunild.com/2009/01/simple-degrafa-color-picker.html</a><br />
<a title="Skinning ChartItem objects " href="http://livedocs.adobe.com/flex/3/html/help.html?content=charts_formatting_12.html" target="_blank"> http://livedocs.adobe.com/flex/3/html/help.html?content=charts_formatting_12.html</a></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?&amp;linkurl=http%3A%2F%2Ftuckwat.com%2Fblog%2Fflex%2Fflex-custom-column-chart-itemrenderer%2F&amp;linkname=Flex%20Custom%20Column%20Chart%20ItemRenderer"><img src="http://tuckwat.com/blog/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Save/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://tuckwat.com/blog/flex/flex-custom-column-chart-itemrenderer/feed/</wfw:commentRss>
		</item>
		<item>
		<title>AX Program Object: Trend Analyzer</title>
		<link>http://tuckwat.com/blog/niagara-ax/ax-program-object-trend-analyzer/</link>
		<comments>http://tuckwat.com/blog/niagara-ax/ax-program-object-trend-analyzer/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 01:00:19 +0000</pubDate>
		<dc:creator>Tucker</dc:creator>
		
		<category><![CDATA[Niagara]]></category>

		<category><![CDATA[AX]]></category>

		<category><![CDATA[History]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[Program Objects]]></category>

		<guid isPermaLink="false">http://tuckwat.com/blog/?p=128</guid>
		<description><![CDATA[I&#8217;ll be posting various AX program objects and modules all fully commented and free to use how you wish.   This program object calculates the min, max, average, sum, and number of records for a selected history and time range.  The code shows how to run a BQL query programmatically and demonstrates a history rollup.

Code:

public [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll be posting various AX program objects and modules all fully commented and free to use how you wish.   This program object calculates the min, max, average, sum, and number of records for a selected history and time range.  The code shows how to run a BQL query programmatically and demonstrates a history rollup.</p>
<div id="attachment_131" class="wp-caption aligncenter" style="width: 588px"><img class="size-full wp-image-131" title="Trend Analyzer" src="http://tuckwat.com/blog/wp-content/uploads/2009/02/trendanalyzer.png" alt="Property sheet of Trend Analyzer" width="578" height="204" /><p class="wp-caption-text">Property sheet of Trend Analyzer</p></div>
<p><span id="more-128"></span></p>
<h2>Code:</h2>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onExecute<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #003399;">String</span> fiftyYearsInMS <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;1577846298735&quot;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Grab the ORD for the selected history</span>
  <span style="color: #003399;">String</span> hist <span style="color: #339933;">=</span> getHistory<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Grab the start and end dates, note 'encodeToString()' makes it ORD friendly</span>
  <span style="color: #003399;">String</span> startDate <span style="color: #339933;">=</span> getDateRange<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getStartTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">encodeToString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #003399;">String</span> endDate <span style="color: #339933;">=</span> getDateRange<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getEndTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">encodeToString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  BOrd bqlOrd <span style="color: #339933;">=</span> BOrd.<span style="color: #006633;">make</span><span style="color: #009900;">&#40;</span>hist <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;?period=timeRange;start=&quot;</span> <span style="color: #339933;">+</span> startDate <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;;end=&quot;</span> <span style="color: #339933;">+</span> endDate
     <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;|bql:historyFunc:HistoryRollup.rollup(select *, baja:RelTime '&quot;</span> <span style="color: #339933;">+</span> fiftyYearsInMS <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;')&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Run the BQL query</span>
  BITable result <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>BITable<span style="color: #009900;">&#41;</span> bqlOrd.<span style="color: #006633;">resolve</span><span style="color: #009900;">&#40;</span>Sys.<span style="color: #006633;">getStation</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  ColumnList columns <span style="color: #339933;">=</span> result.<span style="color: #006633;">getColumns</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  TableCursor c <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>TableCursor<span style="color: #009900;">&#41;</span> result.<span style="color: #006633;">cursor</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// We should only have one entry in the history since we're querying 50 years</span>
  c.<span style="color: #006633;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// Move to 1st (and only) record</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Grab the info from the corresponding rows</span>
  <span style="color: #000066; font-weight: bold;">double</span> count <span style="color: #339933;">=</span> <span style="color: #003399;">Double</span>.<span style="color: #006633;">parseDouble</span><span style="color: #009900;">&#40;</span>c.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>columns.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">double</span> min <span style="color: #339933;">=</span> <span style="color: #003399;">Double</span>.<span style="color: #006633;">parseDouble</span><span style="color: #009900;">&#40;</span>c.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>columns.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">double</span> max <span style="color: #339933;">=</span> <span style="color: #003399;">Double</span>.<span style="color: #006633;">parseDouble</span><span style="color: #009900;">&#40;</span>c.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>columns.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">double</span> avg <span style="color: #339933;">=</span> <span style="color: #003399;">Double</span>.<span style="color: #006633;">parseDouble</span><span style="color: #009900;">&#40;</span>c.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>columns.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">double</span> sum <span style="color: #339933;">=</span> <span style="color: #003399;">Double</span>.<span style="color: #006633;">parseDouble</span><span style="color: #009900;">&#40;</span>c.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>columns.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">6</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Set each value</span>
  getCount<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">setValue</span><span style="color: #009900;">&#40;</span>count<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  getMin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">setValue</span><span style="color: #009900;">&#40;</span>min<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  getMax<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">setValue</span><span style="color: #009900;">&#40;</span>max<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  getAverage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">setValue</span><span style="color: #009900;">&#40;</span>avg<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  getSum<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">setValue</span><span style="color: #009900;">&#40;</span>sum<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h2>Download:</h2>
<p><img src="http://tuckwat.com/blog/wp-content/uploads/2009/02/script.png" alt="Niagara AX Program Object Icon" title="script" width="16" height="16" class="size-full wp-image-166" /><a href="http://tuckwat.com/blog/wp-content/uploads/2009/02/trendanalyzer.bog"> trendanalyzer.bog</a></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?&amp;linkurl=http%3A%2F%2Ftuckwat.com%2Fblog%2Fniagara-ax%2Fax-program-object-trend-analyzer%2F&amp;linkname=AX%20Program%20Object%3A%20Trend%20Analyzer"><img src="http://tuckwat.com/blog/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Save/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://tuckwat.com/blog/niagara-ax/ax-program-object-trend-analyzer/feed/</wfw:commentRss>
		</item>
		<item>
		<title>BQL Query to array of BObjects</title>
		<link>http://tuckwat.com/blog/niagara-ax/bql-query-array-bobjects/</link>
		<comments>http://tuckwat.com/blog/niagara-ax/bql-query-array-bobjects/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 03:52:15 +0000</pubDate>
		<dc:creator>Tucker</dc:creator>
		
		<category><![CDATA[Niagara]]></category>

		<category><![CDATA[BQL]]></category>

		<guid isPermaLink="false">http://tuckwat.com/blog/?p=170</guid>
		<description><![CDATA[Sometimes the batch editor doesn&#8217;t cut it and I&#8217;m required to write a program to interact with a certain type of component.  I could write a robot to traverse through the nav tree but I usually use a BQL query to do the work.  The following is a method I often use to [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes the batch editor doesn&#8217;t cut it and I&#8217;m required to write a program to interact with a certain type of component.  I could write a robot to traverse through the nav tree but I usually use a BQL query to do the work.  The following is a method I often use to grab an Array of BObjects for a given BQL query.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> BObject<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> getObjectsFromBql<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> bqlString<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>   
   BOrd curOrd<span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #666666; font-style: italic;">// Grab reference to local station</span>
   BStation station <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>BStation<span style="color: #009900;">&#41;</span> BOrd.<span style="color: #006633;">make</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;station:|slot:/&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #666666; font-style: italic;">// Run the BQL query and get the resulting table</span>
   BITable result <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>BITable<span style="color: #009900;">&#41;</span> BOrd.<span style="color: #006633;">make</span><span style="color: #009900;">&#40;</span>bqlString<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>station<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   ColumnList columns <span style="color: #339933;">=</span> result.<span style="color: #006633;">getColumns</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #666666; font-style: italic;">// Note we're assuming column 0 is &quot;slotPath&quot;     </span>
   Column slotPathColumn <span style="color: #339933;">=</span> columns.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   TableCursor c <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>TableCursor<span style="color: #009900;">&#41;</span> result.<span style="color: #006633;">cursor</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #666666; font-style: italic;">// Create the Array of BObjects to return</span>
   BObject<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> objs <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> BObject<span style="color: #009900;">&#91;</span>result.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
   <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>c.<span style="color: #006633;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#123;</span>      
      curOrd <span style="color: #339933;">=</span> BOrd.<span style="color: #006633;">make</span><span style="color: #009900;">&#40;</span>c.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>slotPathColumn<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">// Resolve each ord to a BObject, store in our Array</span>
      objs<span style="color: #009900;">&#91;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>BObject<span style="color: #009900;">&#41;</span>curOrd.<span style="color: #006633;">resolve</span><span style="color: #009900;">&#40;</span>station<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">return</span> objs<span style="color: #339933;">;</span>   
<span style="color: #009900;">&#125;</span></pre></div></div>

<h3>Example to get an Array of all BStatusNumerics in &#8216;fault&#8217;: </h3>
<p><code><br />
getObjectsFromBql("select slotPath from baja:StatusNumeric where status.isFault")<br />
</code></p>
<p><em>Note: You must specify &#8217;slotPath&#8217; as the first column in the query</em></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?&amp;linkurl=http%3A%2F%2Ftuckwat.com%2Fblog%2Fniagara-ax%2Fbql-query-array-bobjects%2F&amp;linkname=BQL%20Query%20to%20array%20of%20BObjects"><img src="http://tuckwat.com/blog/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Save/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://tuckwat.com/blog/niagara-ax/bql-query-array-bobjects/feed/</wfw:commentRss>
		</item>
		<item>
		<title>BQL Demystified - Part II</title>
		<link>http://tuckwat.com/blog/niagara-ax/bql-demystified-part-ii/</link>
		<comments>http://tuckwat.com/blog/niagara-ax/bql-demystified-part-ii/#comments</comments>
		<pubDate>Sat, 07 Feb 2009 18:04:36 +0000</pubDate>
		<dc:creator>Tucker</dc:creator>
		
		<category><![CDATA[Niagara]]></category>

		<category><![CDATA[AX]]></category>

		<category><![CDATA[BQL]]></category>

		<guid isPermaLink="false">http://tuckwat.com/blog/?p=70</guid>
		<description><![CDATA[One of the most powerful but underutilized features of Niagara AX is BQL queries.  John Sublett wrote an excellent post on Niagara-Central called BQL Demystified - Part I that covers basic syntax and meaning.  This post will extend John&#8217;s post by demonstrating the Query Builder, running custom queries, and other examples.
The example we&#8217;re [...]]]></description>
			<content:encoded><![CDATA[<p>One of the most powerful but underutilized features of Niagara AX is BQL queries.  John Sublett wrote an excellent post on Niagara-Central called <a href="http://www.niagara-central.com/ord?portal:/blog/BlogEntry/103">BQL Demystified - Part I</a> that covers basic syntax and meaning.  This post will extend John&#8217;s post by demonstrating the Query Builder, running custom queries, and other examples.</p>
<p>The example we&#8217;re going to try is how to view the name of all Numeric Points whose name starts with &#8220;SpaceTemp&#8221;. Open the Query Builder (File&gt;Open&gt;Query Builder) and configure it as shown below.</p>
<div id="attachment_78" class="wp-caption aligncenter" style="width: 560px"><img class="size-full wp-image-78" title="Query Builder Example" src="http://tuckwat.com/blog/wp-content/uploads/2009/02/querybuilder1.png" alt="Example of input data for a Niagara AX BQL Query" width="550" height="217" /><p class="wp-caption-text">Example of input data for a Niagara AX BQL Query</p></div>
<p>After pressing <em>OK</em> you&#8217;ll get a table wtih the resulting query.  To view the generated query, hold CTRL and press L (this shows your current ORD).  You should see somethign similar to this:</p>
<p style="text-align: center;"><code>station:|slot:/|bql:select navOrd from control:NumericPoint where name = 'SpaceTemp'</code></p>
<p style="text-align: left;">The cool part is that you can write and run your own query by copying it into the <em>Open Ord</em> dialog (CTRL+L).</p>
<h3 style="text-align: left;">More Examples:</h3>
<div class="other">
<h5 style="text-align: left;">View all Numeric Points whose name contains the word &#8220;Outside&#8221;:</h5>
<p style="text-align: left;"><code>station:|slot:/|bql:select * from control:NumericPoint where name like '*Outside*'</code></p>
<h5 style="text-align: left;">View the ord of all Numeric Points that are &gt; 85:</h5>
<p style="text-align: left;"><code>station:|slot:/|bql:select slotPath from control:NumericPoint where out.value &gt; 85.0</code></p>
<h5 style="text-align: left;">View the name and ord of all Control Points whose status is not OK:</h5>
<p style="text-align: left;"><code>station:|slot:/|bql:select navName,ord from control:ControlPoint where !status.isOk </code></p>
</div>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?&amp;linkurl=http%3A%2F%2Ftuckwat.com%2Fblog%2Fniagara-ax%2Fbql-demystified-part-ii%2F&amp;linkname=BQL%20Demystified%20-%20Part%20II"><img src="http://tuckwat.com/blog/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Save/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://tuckwat.com/blog/niagara-ax/bql-demystified-part-ii/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Introducing Periscope</title>
		<link>http://tuckwat.com/blog/periscope/introducing-periscope/</link>
		<comments>http://tuckwat.com/blog/periscope/introducing-periscope/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 13:14:31 +0000</pubDate>
		<dc:creator>Tucker</dc:creator>
		
		<category><![CDATA[Periscope]]></category>

		<category><![CDATA[Activelogix]]></category>

		<guid isPermaLink="false">http://tuckwat.com/blog/?p=23</guid>
		<description><![CDATA[After many months and some long days, we&#8217;re pleased to announce the release of Periscope on 02/06/09.  For those who don&#8217;t know,
The Activelogix Periscope™ is a powerful, web-based dashboard application that provides rapid identification of real-time and historical trends in key attributes of multi-facility operation, including energy use, operational efficiencies and critical metrics.
Capable of [...]]]></description>
			<content:encoded><![CDATA[<p>After many months and some long days, we&#8217;re pleased to announce the release of Periscope on 02/06/09.  For those who don&#8217;t know,</p>
<blockquote><p>The Activelogix Periscope™ is a powerful, web-based dashboard application that provides rapid identification of real-time and historical trends in key attributes of multi-facility operation, including energy use, operational efficiencies and critical metrics.</p>
<p>Capable of reducing volumes of data from disparate systems into visual knowledge, the Activelogix Periscope™ gives the user the ability to quickly identify issues, assess relationships and take action in rapidly changing environments in order to optimize resource efficiencies and sustainability.</p></blockquote>
<p>In non-marketing speak, Periscope is a web-based dashboard that extends Niagara AX.  Many of the <em>Viewlets</em> can be replicated using Niagara&#8217;s default presentation medium, PX, but Periscope enables the end-user to fully configure what historical or real-time data to visualize.  It further builds on the charting abilities by bundling some energy specific trends (Demand Duration, Ranking, KPI) and allows real-time normalizations and conversions to stuff like CO2 or Dollars.</p>
<p>For more information, check out the product page <a href="http://www.activelogix.com/about_periscope.asp">here</a>.<br />
<div id="attachment_35" class="wp-caption aligncenter" style="width: 465px"><a href="http://www.activelogix.com/about_periscope.asp"><img class="size-full wp-image-35" title="Periscope" src="http://tuckwat.com/blog/wp-content/uploads/2009/02/samplepic.jpg" alt="Screenshot of a typical dashboard" width="455" height="264" /></a><p class="wp-caption-text">Screenshot of a typical dashboard</p></div></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?&amp;linkurl=http%3A%2F%2Ftuckwat.com%2Fblog%2Fperiscope%2Fintroducing-periscope%2F&amp;linkname=Introducing%20Periscope"><img src="http://tuckwat.com/blog/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Save/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://tuckwat.com/blog/periscope/introducing-periscope/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Hello world!</title>
		<link>http://tuckwat.com/blog/flex/hello-world/</link>
		<comments>http://tuckwat.com/blog/flex/hello-world/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 00:03:24 +0000</pubDate>
		<dc:creator>Tucker</dc:creator>
		
		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Niagara]]></category>

		<category><![CDATA[Periscope]]></category>

		<category><![CDATA[About]]></category>

		<category><![CDATA[AS3]]></category>

		<category><![CDATA[AX]]></category>

		<category><![CDATA[BAJA]]></category>

		<category><![CDATA[oBIX]]></category>

		<guid isPermaLink="false">http://tuckwat.com/blog/?p=1</guid>
		<description><![CDATA[My name is Tucker Watson and I&#8217;m a software developer for Activelogix located in Charlotte, NC.  I graduated from Clemson University in May 2008 with a degree in Computer Science and have since been working on a Flex project to allow end-users to manage and monitor their facilities.
I was introduced to the HVAC world in [...]]]></description>
			<content:encoded><![CDATA[<p>My name is Tucker Watson and I&#8217;m a software developer for Activelogix located in Charlotte, NC.  I graduated from Clemson University in May 2008 with a degree in Computer Science and have since been working on a Flex project to allow end-users to manage and monitor their facilities.</p>
<p>I was introduced to the HVAC world in 2005 while interning at Tridium.  I was a software tester for two summers and spent one as a software developer.  This blog will mostly revolve around Niagara AX and Flex development.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?&amp;linkurl=http%3A%2F%2Ftuckwat.com%2Fblog%2Fflex%2Fhello-world%2F&amp;linkname=Hello%20world%21"><img src="http://tuckwat.com/blog/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Save/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://tuckwat.com/blog/flex/hello-world/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
