<?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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SHpartners / myFMbutler Blog &#187; Conditional Formatting</title>
	<atom:link href="http://blog.myfmbutler.com/?feed=rss2&#038;cat=13" rel="self" type="application/rss+xml" />
	<link>http://blog.myfmbutler.com</link>
	<description>FileMaker Tips &#038; Tricks</description>
	<lastBuildDate>Mon, 30 Aug 2010 10:02:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Speed up your conditional formatting</title>
		<link>http://blog.myfmbutler.com/?p=208</link>
		<comments>http://blog.myfmbutler.com/?p=208#comments</comments>
		<pubDate>Tue, 29 Apr 2008 09:46:29 +0000</pubDate>
		<dc:creator>Koen Van Hulle</dc:creator>
				<category><![CDATA[Conditional Formatting]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Techniques]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.myfmbutler.com/?p=208</guid>
		<description><![CDATA[Conditional formatting is a great tool to enhance your layouts and add additional functionality to your solutions, e.g. for calendaring. But sometimes conditional formatting can slow down the display of your layouts, because FileMaker has to calculate all the conditions you have defined. Today we are going to look at a technique that allows you [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.myfmbutler.com/wp-content/uploads/2008/04/cache001.png" alt="" title="Speed up your conditional formatting" width="463" height="228" class="aligncenter size-full wp-image-197" /></p>
<p>Conditional formatting is a great tool to enhance your layouts and add additional functionality to your solutions, e.g. for calendaring. But sometimes conditional formatting can slow down the display of your layouts, because FileMaker has to calculate all the conditions you have defined. Today we are going to look at a technique that allows you to speed up your calculations by caching some results temporarily.</p>
<p><span id="more-208"></span></p>
<p><strong>Our example</strong><br />
Download the example files: <a href='http://blog.myfmbutler.com/wp-content/uploads/2008/04/caching_nocache.zip'>File 1</a> <a href='http://blog.myfmbutler.com/wp-content/uploads/2008/04/caching.zip'>File 2</a></p>
<p>We have built a small calendar, that shows Cynthia's appointments. The calendar is built with a repeating field with 42 repetitions.</p>
<p><img src="http://blog.myfmbutler.com/wp-content/uploads/2008/04/cache002.png" alt="" title="cache002" width="195" height="191" class="aligncenter size-full wp-image-198" /><br />
￼<br />
<strong>Conditional formatting</strong><br />
The calendar is built with a couple of custom functions, but that is not important for this exercise. To display the appointments we are using conditional formatting.<br />
￼<br />
<img src="http://blog.myfmbutler.com/wp-content/uploads/2008/04/cache003-300x232.png" alt="" title="cache003" width="300" height="232" class="aligncenter size-medium wp-image-199" /></p>
<p>We have defined two conditional formatting rules: one for displaying the weekends in blue and one for displaying the appointments in pink. FileMaker will always calculate both rules starting from top to bottom and merging the format of all rules that are true. If we have an appointment in the weekend, the field will be pink. If we had switched both rules, it would have been blue.<br />
Let’s look into the detail of the conditional formatting rule of “Highlite Days”.<br />
￼<br />
<img src="http://blog.myfmbutler.com/wp-content/uploads/2008/04/cache004.png" alt="" title="cache004" width="369" height="191" class="aligncenter size-full wp-image-200" /></p>
<p>In the conditional formatting rule, we check if the date displayed in one repetition belongs to the related appointments. We are using the List function. The list function will get all related dates and give it back as a value list.<br />
Since we have 42 repetitions in, FileMaker will calculate this list function 42 times, which will result in 42 times the same list. Imagine we would display the calendar of a whole year, then FileMaker would have to calculate the same list 504 times (12 x 42).</p>
<p><strong>Caching</strong><br />
Instead of calculating the list 42 times (or 504 in case of the year view), we can calculate the list once and put it in a global script variable. Then we can use the global script variable in our conditional formatting and at the end we will clear the global script variable, to be sure we don’t have any mistakes when creating new appointments or switching to other layouts.<br />
To create and clear the global script variable, we will not use any script or plug-in. The only tool we will be using is the conditional formating. In order to understand what we will do, we need to have a closer look at how FileMaker is calculating the conditional formatting.<br />
FileMaker evaluates the objects one by one. Starting with the objects in the back and ending with the frontmost objects. We can take advantage of this behavior, by creating an object that will create the cache in the back and a second object on the top layer that will clear the cache.<br />
￼<br />
<img src="http://blog.myfmbutler.com/wp-content/uploads/2008/04/cache006.png" alt="" title="cache006" width="353" height="179" class="aligncenter size-full wp-image-202" /><br />
<img src="http://blog.myfmbutler.com/wp-content/uploads/2008/04/cache005.png" alt="" title="cache005" width="500" height="257" class="aligncenter size-full wp-image-201" /></p>
<p><strong>Creating the cache</strong><br />
On the bottom layer object, we have added conditional formatting.  We check first to see whether there is already a cache, and fill the global script variables “$$DateList”  with the list.</p>
<p><img src="http://blog.myfmbutler.com/wp-content/uploads/2008/04/cache007.png" alt="" title="cache007" width="370" height="233" class="aligncenter size-full wp-image-203" /></p>
<p><strong>Displaying the calendar</strong><br />
The formula is almost the same as our first example. We have only replaced the list function by the global script variable “$$DateList”.<br />
￼<br />
<img src="http://blog.myfmbutler.com/wp-content/uploads/2008/04/cache008.png" alt="" title="cache008" width="374" height="196" class="aligncenter size-full wp-image-204" /></p>
<p><strong>Clearing the cache</strong><br />
The object on top also gets conditional formatting.<br />
￼We check whether there is a cache and clear the $$DateList.<br />
<img src="http://blog.myfmbutler.com/wp-content/uploads/2008/04/cache009.png" alt="" title="cache009" width="348" height="205" class="aligncenter size-full wp-image-205" /></p>
<p><strong>Conclusion</strong><br />
By using this technique you can speed up your layouts that use a lot of recurring calculations. In a solution of one of our customers we could speed the time it takes for the layout to be drawn from 0,5 seconds to 0,02 seconds. We used the mFMb_DS_GetSeconds function from the <a href="http://myfmbutler.com/index.lasso?p=416" target="_blank">myFMbutler DoScript plug-in</a> to measure this.<br />
A little side effect, since we clear the global script variable immediately, the global script variable will never appear in the data viewer. To debug, you can disable the conditional formatting of the clear cache object.</p>
<p><a href='http://blog.myfmbutler.com/wp-content/uploads/2008/04/caching.zip'>Download the example</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.myfmbutler.com/?feed=rss2&amp;p=208</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Display a running clock using DoSQL &amp; conditional formatting</title>
		<link>http://blog.myfmbutler.com/?p=112</link>
		<comments>http://blog.myfmbutler.com/?p=112#comments</comments>
		<pubDate>Mon, 12 Nov 2007 10:50:56 +0000</pubDate>
		<dc:creator>Luk Dhondt</dc:creator>
				<category><![CDATA[Conditional Formatting]]></category>
		<category><![CDATA[DoSQL]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.myfmbutler.com/?p=112</guid>
		<description><![CDATA[This is a simple example that demonstrates how to use conditional formatting with the myFMbutler DoSQL plug-in in order to display a running clock in FileMaker. This example requires that the DoSQL plug-in be installed. You can download DoSQL here. Download the Clock example]]></description>
			<content:encoded><![CDATA[<p>This is a simple example that demonstrates how to use conditional formatting with the myFMbutler DoSQL plug-in in order to display a running clock in FileMaker.</p>
<p>This example requires that the <a href="http://myfmbutler.com/index.lasso?p=425">DoSQL plug-in</a> be installed. You can download DoSQL <a href="http://myfmbutler.com/index.lasso?p=359">here</a>.</p>
<p><a href='http://blog.myfmbutler.com/wp-content/uploads/2007/11/clock.zip' title='Download Clock.zip'>Download the Clock example</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.myfmbutler.com/?feed=rss2&amp;p=112</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Navigation with FileMaker Pro 9</title>
		<link>http://blog.myfmbutler.com/?p=38</link>
		<comments>http://blog.myfmbutler.com/?p=38#comments</comments>
		<pubDate>Tue, 28 Aug 2007 19:18:47 +0000</pubDate>
		<dc:creator>Koen Van Hulle</dc:creator>
				<category><![CDATA[Conditional Formatting]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.myfmbutler.com/?p=38</guid>
		<description><![CDATA[Ever wanted to create your own navigation system based on your layout names? With the introduction of conditional formatting, this has now become a piece of cake. This example shows you how you can implement a simple navigation system in your solution. Download the example file.]]></description>
			<content:encoded><![CDATA[<p><img src='http://blog.myfmbutler.com/wp-content/uploads/2007/08/simplenav_001.jpg' alt='Simple Navigation' /></p>
<p>Ever wanted to create your own navigation system based on your layout names? With the introduction of conditional formatting, this has now become a piece of cake.</p>
<p>This example shows you how you can implement a simple navigation system in your solution.</p>
<p><a href='http://blog.myfmbutler.com/?attachment_id=37' rel='attachment wp-att-37' title='SimpleNavigation.zip'>Download the example file.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.myfmbutler.com/?feed=rss2&amp;p=38</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Write your own progress bar with FileMaker Pro 9</title>
		<link>http://blog.myfmbutler.com/?p=26</link>
		<comments>http://blog.myfmbutler.com/?p=26#comments</comments>
		<pubDate>Mon, 27 Aug 2007 13:53:39 +0000</pubDate>
		<dc:creator>Koen Van Hulle</dc:creator>
				<category><![CDATA[Conditional Formatting]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.myfmbutler.com/?p=26</guid>
		<description><![CDATA[Sometimes a script running within your FileMaker solution may take a while to complete. A user-friendly application should provide some indication to the user that the script is running. Progress bars are a commonly used interface element to convey how far along a script is. This article will explain how you can easily implement a [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.myfmbutler.com/wp-content/uploads/2007/08/rep_001.jpg" alt="Progress bar" /><br />
<br/><br />
Sometimes a script running within your FileMaker solution may take a while to complete. A user-friendly application should provide some indication to the user that the script is running. Progress bars are a commonly used interface element to convey how far along a script is.<br />
This article will explain how you can easily implement a progress bar in your solution.<br/></p>
<p><span id="more-26"></span></p>
<p><strong>Step 1. Determine the completion status of your script.</strong><br/><br />
The completion of a script can be represented by a percentage. In FileMaker there are some functions that can be used to determine the completion of a script.<br />
If you for instance want to loop through all your records, you can use the Get(FoundCount) and the Get(RecordNumber) to calculate the completion.<br/></p>
<p><code>Let<br />
(<br />
[<br />
thecurrentStep = Get(RecordNumber)<br />
;<br />
theTotalNumberOfSteps = Get(FoundCount)<br />
;<br />
theCompletion = Truncate ( (thecurrentStep/theTotalNumberOfSteps) * 100 ; 0)<br />
]<br />
;<br />
theCompletion<br />
)<br />
</code><br/><br />
If your table has 300 records and you are currently on record 100, the formula will return 33. This means you have already accomplished 33 % of your script. The truncate function is used to be sure the formula will return an integer.<br/></p>
<p><strong>Step 2. Drawing a progress bar</strong><br/><br />
In the next step, we will create the progress bar.<br/><br />
- Go to "Manage &gt; Database" and create a new text field "progress bar".<br />
- Select the field and choose "Options...".<br />
- Click on the tab "Storage"<br />
- Make the field global and fill in the number of maximum of repetitions: 100<br/><br />
Now we have a repeating field with 100 repetitions. Every repetition will represent one percentage of the progress of the script.<br/><br />
Add the field to your layout and be sure all 100 repetitions are on the layout.<br/></p>
<p><img src="http://blog.myfmbutler.com/wp-content/uploads/2007/08/rep_002.jpg" alt="100 repetitions" /><br/><br/><br />
<strong>Step 3. Make the progress bar working</strong><br />
If your table has 300 records and you are currently on record 100, the first 33 repetitions must be blue.<br />
To establish this we will make use of the new conditional formatting feature in FileMaker 9.<br/><br/><img src="http://blog.myfmbutler.com/wp-content/uploads/2007/08/rep_003.jpg" alt="Conditional Formatting" /><br/><br />
- Go to layout mode and select the "progressbar" field.<br />
- Right-click and choose "Conditional Formatting"<br />
- Click on the "Add" button<br />
- Choose "Formula is" in the condition value list and click on "Specify ..."</p>
<p>Add the following formula:<br/><br />
<code>Let<br />
(<br />
[<br />
thecurrentStep = Get(RecordNumber)<br />
;<br />
theTotalNumberOfSteps = Get(FoundCount)<br />
;<br />
theCompletion = Truncate ( (thecurrentStep/theTotalNumberOfSteps) * 100 ; 0)<br />
]<br />
;<br />
theCompletion  â¥ Get ( CalculationRepetitionNumber )<br />
)</code></p>
<p>The function "Get(CalculationRepetitionNumber)" will return the number of the current repetition.<br />
For repetition 1, the result of the calculation will be true.<br />
For repetition 33, the result of the calculation will be true.<br />
But for repetition 34 or higher, the result of the calculation will be false. </p>
<p>The only thing you have to do now, is to choose the fill color and you are finished.<br/></p>
<p><a href="http://blog.myfmbutler.com/wp-content/uploads/2007/08/progressbar.zip" title="progressbar.zip">Download the example file</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.myfmbutler.com/?feed=rss2&amp;p=26</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PacMan, or fun with Conditional Formatting</title>
		<link>http://blog.myfmbutler.com/?p=18</link>
		<comments>http://blog.myfmbutler.com/?p=18#comments</comments>
		<pubDate>Tue, 21 Aug 2007 13:55:10 +0000</pubDate>
		<dc:creator>Koen Van Hulle</dc:creator>
				<category><![CDATA[Conditional Formatting]]></category>
		<category><![CDATA[Fun stuff]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.myfmbutler.com/?p=18</guid>
		<description><![CDATA[With the introduction of the conditional formatting feature in FileMaker 9, a whole bunch of new possibilities are available to the FileMaker developer. This example demonstrates the power of conditional formatting. Download PacMan]]></description>
			<content:encoded><![CDATA[<p>With the introduction of the conditional formatting feature in FileMaker 9, a whole bunch of new possibilities are available to the FileMaker developer. This example demonstrates the power of conditional formatting.<br/><br />
<img src="http://blog.myfmbutler.com/wp-content/uploads/2007/08/pacman_002.jpg" alt="PacMan" /><br/><br />
<a href="http://blog.myfmbutler.com/wp-content/uploads/2007/08/pacman.zip" title="Download PacMan">Download PacMan</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.myfmbutler.com/?feed=rss2&amp;p=18</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
