<?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>The FileMaker Collective &#187; Design Patterns</title>
	<atom:link href="http://fmcollective.com/category/design-patterns/feed/" rel="self" type="application/rss+xml" />
	<link>http://fmcollective.com</link>
	<description>Syndicating the best FileMaker blogs</description>
	<lastBuildDate>Tue, 27 Jul 2010 15:42:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Brain Teaser &#8211; Solution</title>
		<link>http://fmcollective.com/2008/04/17/brain-teaser-solution/</link>
		<comments>http://fmcollective.com/2008/04/17/brain-teaser-solution/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 21:11:02 +0000</pubDate>
		<dc:creator>Peter Vinogradov</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[FM9]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://fmcollective.com/2008/04/17/brain-teaser-solution/</guid>
		<description><![CDATA[Alright, so nobody solved this brain teaser. I&#8217;m sure this had nothing to do with people having clients and lives, and everything to do with the original post getting hosed and the challenge being too darn hard anyway  
So here, at long last, is the solution:
mebeliLet (
[
NewSubSummary  =(  GetNthRecord (  MyTable::MyKeyField [...]]]></description>
			<content:encoded><![CDATA[<p>Alright, so nobody solved this <a title="Brain Teaser" href="http://fmcollective.com/2008/01/29/brain-teaser/">brain teaser</a>. I&#8217;m sure this had nothing to do with people having clients and lives, and everything to do with the original post getting hosed and the challenge being too darn hard anyway <img src='http://fmcollective.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>So here, at long last, is the solution:</p>
<blockquote><p><span style="color: #0000ff;"><span style="position: absolute; overflow: hidden; height: 0; width: 0;"><a href="http://www.videnov.com/">mebeli</a></span>Let (<br />
[<br />
NewSubSummary  =(  GetNthRecord (  MyTable::MyKeyField ;  Get(RecordNumber)-1) &lt;&gt; </span><span style="color: #0000ff;"> MyTable::MyKeyField</span><span style="color: #0000ff;"> );  //Test if record is the start of a new subsummary. MyKeyField is the sort field for my subsummary part. </span></p>
<p><span style="color: #0000ff;">$on = $val; // $on will always be whatever $val was last<br />
$val = If (NewSubSummary; If ( $val = 1;"" ; 1) ) // switch the value of val<br />
];<br />
$on  // if $on=1, then apply the conditional format</span></p>
<p><span style="color: #0000ff;">)<em> </em></span></p></blockquote>
<p>[edit:] Or, in much simpler terms:</p>
<blockquote><p><span style="color: #0000ff;">Let (<br />
[</span><br />
<span style="color: #0000ff;">$b = If ($b ;"" ;1 )</span><br />
<span style="color: #0000ff;">];</span><br />
<span style="color: #0000ff;">$b</span><br />
<span style="color: #0000ff;">)</span></p></blockquote>
<p>To me, the interesting thing here is the way that these variable expressions are handled by FileMaker. First of all, the conditional formatting seems to get evaluated, as one might expect, from top to bottom of the page, allowing you to use variables to keep track of formatting decisions that were made earlier on the page, or even on previous pages. It seems there should be some much cooler implications of this, like multiple title headers and pseudo-headers (don&#8217;t know what I mean by that? Neither do I&#8230;). The other interesting thing is that the variables here are local variables, but they&#8217;re kept active while the whole page is rendered by preview mode, which is what allows me to make reference to the last evaluation of $val and produce the alternating effect (yeah, I know I could just as easily use global variables, but it&#8217;s handy to know I don&#8217;t have to)</p>
<p>The reason that this gave me a checkerboard on the first try:</p>
<p><img src="http://fmcollective.com/wp-content/uploads/2008/01/croppercapture12.Png" alt="Checkers anyone?" /></p>
<p>was because I had placed the formula on a repeating field, meaning that each conditional format formula was evaluated for each repetition, left-to-right. Once I placed the calc on a regular field, the checkerboard was gone and I had nice alternating rows.</p>
<p><img src="http://fmcollective.com/wp-content/uploads/2008/04/croppercapture16.Png" alt="Eureka" /></p>
]]></content:encoded>
			<wfw:commentRss>http://fmcollective.com/2008/04/17/brain-teaser-solution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Brain Teaser</title>
		<link>http://fmcollective.com/2008/01/29/brain-teaser/</link>
		<comments>http://fmcollective.com/2008/01/29/brain-teaser/#comments</comments>
		<pubDate>Tue, 29 Jan 2008 11:53:26 +0000</pubDate>
		<dc:creator>Peter Vinogradov</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[FM9]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://fmcollective.com/2008/01/29/brain-teaser/</guid>
		<description><![CDATA[I was working on a crosstab report to show grade distributions and I wanted alternating highlights. I was using Mikhai Edoshin&#8217;s snazzy technique (http://edoshin.skeletonkey.com/2006/12/crosstab_report.html), which meant that each row was a subsummary part, which, at least in my copy of FileMaker, doesn&#8217;t support alternating fill. Like an idiot, I threw in a conditional format
&#8212;&#8212;&#8212;&#8212;-
EDIT: This [...]]]></description>
			<content:encoded><![CDATA[<p>I was working on a crosstab report to show grade distributions and I wanted alternating highlights. I was using Mikhai Edoshin&#8217;s snazzy technique (<a href="http://edoshin.skeletonkey.com/2006/12/crosstab_report.html">http://edoshin.skeletonkey.com/2006/12/crosstab_report.html</a>), which meant that each row was a subsummary part, which, at least in my copy of FileMaker, doesn&#8217;t support alternating fill. Like an idiot, I threw in a conditional format</p>
<p>&#8212;&#8212;&#8212;&#8212;-</p>
<p>EDIT: This post got hosed somehow, and everything beyond the part where I refer to myself as an idiot was erased. I can&#8217;t remember what was idiotic about my original conditional formatting in this case (if I weren&#8217;t such an idiot, I&#8217;d probably remember). In any case, below is a reprise of the brain teaser:</p>
<p>&#8212;&#8212;&#8212;&#8211;</p>
<p>Each line in Edoshin&#8217;s crosstab technique is basically a repeating summary field based on a repeating summary calc. My goal was to get each one of these repeating fields to alternate its background fill. Using any kind of Mod-based calculation based on record number was going to fail, since these fields are on a subsummary, and there&#8217;s no way to predict how many records correspond to each subsummary part.</p>
<p>Taking a purely throw-rocks-at-it-until-it-stops-moving approach, I opened up the conditional formatting dialog on that repeating summary field, and hammered out a calculation. I was astounded, when I went back to preview mode, to see this:</p>
<p><img src="http://fmcollective.com/wp-content/uploads/2008/01/croppercapture12.Png" alt="Checkers anyone?" /></p>
<p>My conditional formatting calc had inadvertently produced a checkerboard pattern. I realized, shortly thereafter, that by placing the same calc on a <em>regular </em>field, rather than a <em>repeating </em>field, I could get the alternating pattern as I desired:</p>
<p><img src="http://fmcollective.com/wp-content/uploads/2008/04/croppercapture16.Png" alt="Eureka" /></p>
<p>The brain teaser challenge, before it got erased, was to figure out what sort of calculation could yield this effect on a subsummary part. The reward, if I recall correctly, was a signed copy of my memoir.</p>
]]></content:encoded>
			<wfw:commentRss>http://fmcollective.com/2008/01/29/brain-teaser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pseudoportals with Alternating Fill</title>
		<link>http://fmcollective.com/2007/08/29/pseudoportals-with-alternating-fill/</link>
		<comments>http://fmcollective.com/2007/08/29/pseudoportals-with-alternating-fill/#comments</comments>
		<pubDate>Thu, 30 Aug 2007 00:33:12 +0000</pubDate>
		<dc:creator>Peter Vinogradov</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[FM9]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://fmcollective.com/2007/08/29/pseudoportals-with-alternating-fill/</guid>
		<description><![CDATA[Among my longest-standing feature requests for FileMaker are portal rows that slide individually to accommodate their content. Although I can usually get by with constructing my layouts in the related table, that&#8217;s an approach that usually leaves something to be desired. My favorite workaround, to date, has been what I call a &#8220;pseudoportal&#8221; (though I&#8217;m sure there&#8217;re other names [...]]]></description>
			<content:encoded><![CDATA[<p align="left">Among my longest-standing feature requests for FileMaker are portal rows that slide individually to accommodate their content. Although I can usually get by with constructing my layouts in the related table, that&#8217;s an approach that usually leaves something to be desired. My favorite workaround, to date, has been what I call a &#8220;pseudoportal&#8221; (though I&#8217;m sure there&#8217;re other names for the technique).<span id="more-84"></span></p>
<p><a href="http://fmcollective.com/wp-content/uploads/2007/08/croppercapture3.Png" title="A Pseudoportal Invoice"><img align="left" src="http://fmcollective.com/wp-content/uploads/2007/08/croppercapture3thumbnail.Png" alt="A Pseudoportal Invoice" /></a></p>
<p>To the left is an example of what I mean. This effect can&#8217;t be achieved with portals (as far as I know). In this example, the canonical approach would be to construct a layout based on the invoice line items. However, doing so would make it impossible for me to put in the text element down the right side, or to incorporate related data from multiple tables.</p>
<p>To solve the problem, I create repeating calc fields in the invoice table and define them to refer to specific related records, depending on the repetition. For example:<br />
 </p>
<hr />Let (<br />
[<br />
f =  Extend ( PO_LineItems::Item );<br />
g = GetNthRecord ( f ; Get (CalculationRepetitionNumber ))<br />
];<br />
If (g&lt;&gt;&#8221;?&#8221; ; g; &#8220;&#8221;))</p>
<hr /><a href="http://fmcollective.com/wp-content/uploads/2007/08/croppercapture4.Png" title="Pseudoportal in Layout mode"><img align="right" src="http://fmcollective.com/wp-content/uploads/2007/08/croppercapture4.thumbnail.Png" alt="Pseudoportal in Layout mode" /></a> The technique requires one such calc for each field in the pseudoportal. In layout mode, each repeating field has to overlap another, and each needs to be set to slide up based on &#8220;directly above&#8221;.</p>
<p>Now, although FM 9 didn&#8217;t fulfill my wish of making this technique obsolete, it did offer a fix for one of the shortcomings of the technique &#8211; alternate row shading. To achieve this, make sure one of your pseudoportal fields extends the width of the whole set (usually, I just use the first field). Set conditional formatting on it for the color you want using this formula:</p>
<hr />mod ( get (calculationRepetitionNumber);2) = 0</p>
<hr /><a href="http://fmcollective.com/wp-content/uploads/2007/08/croppercapture4.Png" title="Pseudoportal in Layout mode"></a>Here is a link to a technique file that illustrates what I&#8217;m talking about (it doesn&#8217;t have the shading, since I built it before 9):</p>
<p><a href="http://www.petervinogradov.com/TechniqueFiles/PV_PseudoPortals.zip">http://www.petervinogradov.com/TechniqueFiles/PV_PseudoPortals.zip</a> </p>
<p>The file also includes some fun CFs and examples for automatically balancing multi-column pseudoportals.</p>
]]></content:encoded>
			<wfw:commentRss>http://fmcollective.com/2007/08/29/pseudoportals-with-alternating-fill/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Conditional Formatting Tips</title>
		<link>http://fmcollective.com/2007/08/17/conditional-formatting-tips/</link>
		<comments>http://fmcollective.com/2007/08/17/conditional-formatting-tips/#comments</comments>
		<pubDate>Fri, 17 Aug 2007 20:22:13 +0000</pubDate>
		<dc:creator>Ernest Koe</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[FM9]]></category>

		<guid isPermaLink="false">http://fmcollective.com/2007/08/17/conditional-formatting-tips/</guid>
		<description><![CDATA[Conditional Formatting is currently my favorite FileMaker 9 feature. It used to be that we had to add all these extra barnacles to our database in the form of  fields, calculations or relationships to highlight a simple portal row. Conditional Formatting goes a long way towards eliminating all that nonsense. CF is a big [...]]]></description>
			<content:encoded><![CDATA[<p>Conditional Formatting is currently my favorite FileMaker 9 feature. It used to be that we had to add all these extra barnacles to our database in the form of  fields, calculations or relationships to highlight a simple portal row. Conditional Formatting goes a long way towards eliminating all that nonsense. CF is a big deal because for the first time in FileMaker&#8217;s product history, you can actually apply an expression (a formula) to layout objects&#8211;you can now program field objects&#8230;at least&#8230;sort of.</p>
<p>Yes, it isn&#8217;t exactly the feature I had in mind. I would have preferred to have full-blown access to all object properties and a way to program them using the calculation engine. But, Conditional Formatting gets me very close.</p>
<p>Here are a couple of basic highlighting patterns solved using CF.</p>
<p><strong>1. Highlighting a Focused Field</strong></p>
<p>There was quite a bit of buzz about Andy Lecates&#8217; DevCon 2007 session where he showed off this active-field highlighting in his demo app. Andy noted that he was almost embarrassed to tell people that the formula behind this technique was literally a &#8220;1&#8243;. This puzzled me a bit so I decided to reproduce the technique. I have been told the credit for discovering this should properly be attributed to Chad Novotony of The Support Group. Kudos, Chad; it is really quite brilliant in its simplicity.</p>
<p><span id="more-75"></span></p>
<p>You can download the example file below and check out the conditional format properties of the fields shown.</p>
<p><a href="http://fmcollective.com/2007/08/17/conditional-formatting-tips/highlight-focused-field/" rel="attachment wp-att-76" title="highlight focused field"><img src="http://fmcollective.com/wp-content/uploads/2007/08/highlight_focused_field.png" alt="highlight focused field" /></a></p>
<p>The secret sauce behind this technique is to fill the fields with your highlight color of choice <strong>before</strong> you even open up the conditional formatting dialog box. I know this sounds completely backwards but the technique is based on the principle that a field object&#8217;s conditional formating expression isn&#8217;t evaluated when your cursor is sitting in it. So, when we enter the field, its CF stops working and the field defaults to its default fill color. So, the only thing left to do now is to make CF turn the fields white when I am not in it, which is to say, always make it white <strong>all the time.</strong> The formula for that? You guess it, &#8220;1&#8243;.</p>
<p><a href="http://fmcollective.com/wp-content/uploads/2007/08/the_secret_formula.png" title="The secret formula"><img src="http://fmcollective.com/wp-content/uploads/2007/08/the_secret_formula.png" alt="The secret formula" height="374" width="482" /></a></p>
<p>I know, I know&#8230;who would have thunk it? Kudos to Chad for this gem and to Andy Lecates for making it public.</p>
<p><strong>2. Portal Row Highlighting</strong></p>
<p><a href="http://fmcollective.com/wp-content/uploads/2007/08/portal_row_highlight1.png" title="portal row highlight"><img src="http://fmcollective.com/wp-content/uploads/2007/08/portal_row_highlight1.png" alt="portal row highlight" /></a></p>
<p>This next example is a bit more straightforward. We want to select a portal row and highlight it. Do accomplish this, you need two basic components, (i) an object to serve as the base CF highlight element, and ii) a script to trip the highlight. Here&#8217;s picture of the pieces before assembly&#8230;</p>
<p><a href="http://fmcollective.com/2007/08/17/conditional-formatting-tips/portal-row-cf-breakdown/" rel="attachment wp-att-79" title="portal row cf breakdown"><img src="http://fmcollective.com/wp-content/uploads/2007/08/pr_-cf_breakdown.png" alt="portal row cf breakdown" /></a></p>
<p>The conditionally formatted object in this case is just a regular button set to turn blue if the value in a global variable, <code>$$selected</code> matches its row id. Next, make a script to set the <code>$$selected</code> global variable with the portal row&#8217;s record id. After that, bind that script to a &#8220;select&#8221; button inside the portal row and presto, portal row highlight without adding even one extra field!</p>
<p><a href="http://fmcollective.com/2007/08/17/conditional-formatting-tips/portal-row-highlight-formula/" rel="attachment wp-att-80" title="portal row highlight formula"><img src="http://fmcollective.com/wp-content/uploads/2007/08/highlight_pr_formula.png" alt="portal row highlight formula" height="347" width="448" /></a></p>
<p>Get the example file, <a href="http://fmcollective.com/wp-content/uploads/2007/08/fm9_cf_tips_1fp7.zip" title="conditional formatting example 1">conditional formatting example 1</a> to check this out yourself.</p>
<p>Cheers,</p>
<p>Ernest Koe<br />
The Proof Group LLC</p>
]]></content:encoded>
			<wfw:commentRss>http://fmcollective.com/2007/08/17/conditional-formatting-tips/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Sailing the boundless RG &#8211; &#8220;Here there be dragons&#8221;</title>
		<link>http://fmcollective.com/2007/07/20/sailing-the-boundless-rg-here-there-be-dragons/</link>
		<comments>http://fmcollective.com/2007/07/20/sailing-the-boundless-rg-here-there-be-dragons/#comments</comments>
		<pubDate>Fri, 20 Jul 2007 15:24:29 +0000</pubDate>
		<dc:creator>Peter Vinogradov</dc:creator>
				<category><![CDATA[Design Patterns]]></category>

		<guid isPermaLink="false">http://fmcollective.com/?p=68</guid>
		<description><![CDATA[If you use Anchor Buoy design methods and find yourself building endless TOs just because you like the way they look, then you&#8217;ve probably already devised a number of tricks and rulesSome people prefer the &#60;a href=&#8221;http://www.snjpc.com&#8221;&#62;online casinos&#60;/a&#62; because it is much more calm.  to keep your sanity and productivity alive any time you [...]]]></description>
			<content:encoded><![CDATA[<p>If you use Anchor Buoy design methods and find yourself building endless TOs just because you like the way they look, then you&#8217;ve probably already devised a number of tricks and rules<noscript>Some people prefer the &lt;a href=&#8221;http://www.snjpc.com&#8221;&gt;online casinos&lt;/a&gt; because it is much more calm. </noscript> to keep your sanity and productivity alive any time you need to venture into the unknown reaches of your relationship graph.<br />
<span id="more-68"></span></p>
<p>My own tactics for getting to my destination on the RG have traditionally resembled those of the early explorers:</p>
<ul>
<li>Stay near land and in sight of known landmarks.</li>
<li>Make sure you know which way is north</li>
<li>Have an up-to-date map</li>
<li>bring plenty of oranges.</li>
<li>Beware the twisted squid (a prehistoric throwback to ancient times known to trap sailors and drive them mad)</li>
</ul>
<p>Of course, most developers understand that you can just key ahead to the right table. The only problem is that if, like me, you tend to prefix the daylights out of your TOs (AR__PPPL_MISC__NW_TC_BS_BFD_PrsPhoneDetail), then keying ahead starts to break down as soon as you hit your first underscore. Enter the lighthouse:</p>
<p><img src="http://fmcollective.com/wp-content/uploads/2007/07/croppercapture2thumbnail.Png" alt="RG lighthouse" /> The lighthouse (shown here in pink) is just a table occurrence of an out-of-the-way table ( PS: You can just as easily do a lighthouse with a text box, but I like the single-line quality of a TO). In my case, I prefix these with a simple &#8220;z&#8221; and then a name for the particular constellation of TOs that I want to be able to target. In this case, a TO that handles the design of a scheduling function in my solution can be reached by simply typing &#8220;zsche&#8230;&#8221;.  Note that when you key to your lighthouse, it will end up at the bottom right of your screen, so place it at the southeast end of your TOs.</p>
<p>Ahoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://fmcollective.com/2007/07/20/sailing-the-boundless-rg-here-there-be-dragons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adventures in Barcoding</title>
		<link>http://fmcollective.com/2007/06/08/adventures-in-barcoding/</link>
		<comments>http://fmcollective.com/2007/06/08/adventures-in-barcoding/#comments</comments>
		<pubDate>Fri, 08 Jun 2007 23:27:45 +0000</pubDate>
		<dc:creator>Peter Vinogradov</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[Op-ed]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://fmcollective.com/?p=51</guid>
		<description><![CDATA[
As a fulltime educator, there&#8217;s never any shortage of new and exciting projects to inspire me and capture my interest. As an FM developer, though, it can sometimes be a bit of a stretch. Even new releases of FileMaker (like that&#8216;ll happen any time soon&#8230;) can be a melancholy blend of &#8220;gee whiz&#8221; moments and [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://fmcollective.com/wp-content/uploads/2007/06/bcmilldyi.gif" alt="Adventures in Barcoding" /></p>
<p>As a fulltime educator, there&#8217;s never any shortage of new and exciting projects to inspire me and capture my interest. As an FM developer, though, it can sometimes be a bit of a stretch. Even new releases of FileMaker (like <em>that</em>&#8216;ll happen any time soon&#8230;) can be a melancholy blend of &#8220;gee whiz&#8221; moments and feature request letdowns (&#8221;what?! They didn&#8217;t include facial recognition on container fields?! Damnit, I&#8217;ve been asking for that since version 4!&#8221;). Fortunately, we can sometimes count on our clients to throw something fun our way.<span id="more-51"></span></p>
<p>Recently, a client asked me if we could integrate barcode scanning into their solution. It was a simple problem &#8211; set up a workstation so that the user could scan items off a catalog and have them end up in a proposal. For me though, I have to confess a little hesitation. As far as I was concerned, barcodes are for the big boys like Walmart and my public library. <img src="http://fmcollective.com/wp-content/uploads/2007/06/croppercapture7.Png" alt="Item Selection Club Sandwich" align="right" />Why couldn&#8217;t my client just get by with the FileMaker value lists I had painstakingly set up for them (My specialty, the &#8220;item selection club sandwich&#8221;, stacked 12 deep with key-based dropdowns, masking popup menus, scriptevent plain entry, type-aheads, conditional container fields, mayonnaise, etc.). Anyway, I&#8217;d heard of barcodes, and understood the concept, so I said what the heck.</p>
<p><a href="http://fmcollective.com/wp-content/uploads/2007/06/ls2200light.jpg" title="The Symbol (Motorola) LS2208"><img src="http://fmcollective.com/wp-content/uploads/2007/06/ls2200light.thumbnail.jpg" alt="The Symbol (Motorola) LS2208" align="left" /></a>After shopping a bit, I found a scanner, ordered it and set about reading the Wikipedia entries on barcode symbologies. When I awoke three days later, the scanner had arrived (<em>Symbol LS2208</em>). I recommend this unit, but if you buy it, don&#8217;t order the &#8220;multi-interface&#8221; version unless you have some clue how to make the phone-jack-looking &#8220;multi-interface&#8221; end of the cable fit into your computer. The USB version, on the other hand, is really cool, and it was only a matter of seconds before I was scanning everything in my office and marveling at the little numbers getting magically typed into notepad.</p>
<p>If you&#8217;re integrating barcode scanning in<a href="http://fmcollective.com/wp-content/uploads/2007/06/a55shirt.jpg" title="Father’s Day Shirt"><img src="http://fmcollective.com/wp-content/uploads/2007/06/a55shirt.jpg" alt="Father’s Day Shirt" align="right" /></a>to a solution for the first time, and are simple-minded, be sure to plan for this phase of idiotic wonder, as it can be time-consuming. If you choose to bill your clients for it, then let me save them some money and share my research notes on this phase:</p>
<ul>
<li> You can&#8217;t draw working barcodes freehand. Don&#8217;t try.</li>
<li> You can&#8217;t scan a barcode off the screen unless you own a CCD scanner</li>
<li> The characters printed under the barcodes on stuff you own are exactly what the barcode says. There are no surprises or hidden messages.</li>
<li>For father&#8217;s day, get your father a t-shirt with a barcode that represents the string &#8220;A55FACE&#8221;. It will amuse him at the supermarket self checkout.</li>
</ul>
<p>With this research out of the way, I began to think about how to integrate my scanner with FileMaker. In it&#8217;s simplest form, you could click into a field, scan a barcode, and have that code appear in the field. Time-saving and cool, but it still falls well short of the kind of functionality your local grocer takes for granted. Ideally, you want each scan to trigger a script, and you want that script to take the contents of your scan and deliver it to the right place, and you want to be able to do everything without going back to your keyboard or moving your mouse. In fact, if you could do it without looking at the screen, that would be an even bigger bonus.</p>
<p>Possibly the simplest approach (other than the lame one described previously) would be to have a big global field to collect your scans, along with a button to parse the collected scans when you&#8217;re all done. To do this, though, you need a way for your scans to separate with carriage returns. Enter the world of ADF (stands for: <em>awesome dynamic fun</em> &#8211; look it up) rules, which are little macros that you can teach your scanner to perform every time it scans something. Luckily the <em>LS2208 Quickstart Guide</em> comes with a series of three barcodes just for this purpose. Scan them in order, and magically, your scanner will insert a carriage return after every scan.</p>
<p><a href="http://fmcollective.com/wp-content/uploads/2007/06/croppercapture1.Png" title="123Scan Rules Dialog"><img src="http://fmcollective.com/wp-content/uploads/2007/06/croppercapture1.thumbnail.Png" alt="123Scan Rules Dialog" align="right" /></a>While I had considered this approach briefly, it felt a bit cheap and it didn&#8217;t provide the user enough feedback to let them know what they were scanning (a field full of ID codes isn&#8217;t very friendly). So, I cracked open the 400 page PDF that comes with the <em>LS2208</em> and started learning more about ADF. From my initial read, it looked like the way to teach my scanner to do fancy scanner tricks was to jump around the 400-page PDF, work out the proper series of steps, represented as barcodes, and scan them in exactly the right order (and of course, from my research in the idiotic wonder phase, I knew I would have to do a lot of printing since I couldn&#8217;t scan off the screen). So while I found all these magic ADF barcodes to be really neat, in theory, I began to wonder whether the people at Symbol (Motorola) might not have bothered to write some software to handle all of this. Digging around in my <em>LS2208</em> CD, I discovered exactly that, a little utility called <em>123Scan</em>. I ran it, and spent an hour and a half trying to get it to talk to my scanner. A quick trip to the PDF let me know that it would only work if my scanner was connected by RS232 serial cable. I was about to resign myself to hours of tedious flipping through the PDF when I discovered that I could use <em>123Scan</em> to generate a script of ADF barcodes and send them to my printer. Happy Day.</p>
<p align="left"><a href="http://fmcollective.com/wp-content/uploads/2007/06/croppercapture2.Png" title="ADF - begin new rule"><img src="http://fmcollective.com/wp-content/uploads/2007/06/croppercapture2.Png" alt="ADF - begin new rule" align="left" /></a><a href="http://fmcollective.com/wp-content/uploads/2007/06/croppercapture3.Png" title="Send CTRL+6"><img src="http://fmcollective.com/wp-content/uploads/2007/06/croppercapture3.Png" alt="Send CTRL+6" align="right" /></a>So, first order of business was to get FileMaker to execute a script when a barcode got scanned. What I figured I could do was use the ADF rules to prepend a keyboard shortcut to the front of each scan. I really wanted something out-of-the-way, like CTRL+ALT+SHIFT+6, but it didn&#8217;t seem like ADF could get that fancy. CTRL+6 would have to do. In FileMaker, I set up a custom menu for my script and gave it the CTRL+6 shortcut.</p>
<p align="left">&nbsp;</p>
<p align="left"><a href="http://fmcollective.com/wp-content/uploads/2007/06/croppercapture4.Png" title="ADF - Send Pause"><img src="http://fmcollective.com/wp-content/uploads/2007/06/croppercapture4.Png" alt="ADF - Send Pause" align="left" /></a></p>
<p align="right"><a href="http://fmcollective.com/wp-content/uploads/2007/06/croppercapture5.Png" title="ADF - Send the Rest"><img src="http://fmcollective.com/wp-content/uploads/2007/06/croppercapture5.Png" alt="ADF - Send the Rest" align="right" /></a>My next concern was the time lag between launching the script and handling the remaining data. I didn&#8217;t want the barcode data stream to get lost while FileMaker was trying to get a script in gear. Fortunately, ADF allows you to set pauses, so I did (with a little experimenting, it seemed like 0.4 seconds was as short as I could make it and still have it be reliable).</p>
<p>Finally, I knew I would need an enter key (the keypad variety, not the keyboard version), and a beep at the end to let the user know the scanner was ready to go again.</p>
<p>With all of that set up in <em>123Scan</em> I printed up the ADF barcode instruction series, scanned it into my <em>LS2208</em> and behold, it worked. What followed, of course, was another hour or so of Idiotic Wonder &#8211; &#8220;Does it really work? Wow. What happens if I scan this? Wow. What about this? Wow. What about from 2 feet away? Wow. Etc.&#8221;</p>
<p><a href="http://fmcollective.com/wp-content/uploads/2007/06/croppercapture6.Png" title="Data Stream Capture Dialog"><img src="http://fmcollective.com/wp-content/uploads/2007/06/croppercapture6.Png" alt="Data Stream Capture Dialog" align="left" /></a>Of course, you do have to think about what you want your FM script to do with its data stream. After some experimenting, I settled on having it invoke a custom dialog with the title &#8220;Gathering Barcode&#8221; and a single global variable input field. With the &#8220;Enter&#8221; key suffixed by ADF rules, this dialog only flashes for a second and I kind of like the visual feedback. With this barcode collected, I could safely process the input, manage context, error trap, etc.</p>
<p>Another gotcha is the possibility of unfriendly barcodes. Suppose someone accidentally (read: inquisitively) scans their gym pass. In my case, I knew all the &#8220;good&#8221; barcodes would represent ID numbers with the same common two-letter prefix. It took some fiddling, but I was able to organize my ADF rules so that barcodes without the prefix would just generate a beep and pass nothing to the computer.</p>
<p>Finally, what about generating the barcodes themselves? My client assures me that they have an office supply vendor who will generate sequential barcode stickers for all items going forward, but I also wanted the option of generating the occasional set of labels in-house.  Working together, Google and I turned up this handy tool: <a href="http://www.barcodemill.com/index.php">http://www.barcodemill.com/index.php</a>  Which also includes a neat little image tool you could work into a web viewer: <a href="http://www.barcodemill.com/tech/index.php?load=/tech/install/millfree.php">http://www.barcodemill.com/tech/index.php?load=/tech/install/millfree.php</a> (I&#8217;m not sure the operator would look favorably on an industrial-strength application of this &#8211; they do have a commercial version &#8211; but I imagine the occasional lookup wouldn&#8217;t hurt). If someone out there knows of a better free barcode generator, please post below.</p>
<p>As for symbology, I settled on Code 128. It supports a full ASCII set and is relatively compact. The next phase of this project is going to involve a mobile solution for walking around a showroom floor and collecting items to upload later. I&#8217;ve set aside a full two days for idiotic wonder when that hardware comes in&#8230;</p>
<p><a href="http://fmcollective.com/wp-content/uploads/2007/06/bcmill4.gif" title="alphabet in Code 128 from BarcodeMill.com"><img src="http://fmcollective.com/wp-content/uploads/2007/06/bcmill4.gif" alt="alphabet in Code 128 from BarcodeMill.com" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://fmcollective.com/2007/06/08/adventures-in-barcoding/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Reflections from Exile</title>
		<link>http://fmcollective.com/2007/05/30/reflections-from-exile/</link>
		<comments>http://fmcollective.com/2007/05/30/reflections-from-exile/#comments</comments>
		<pubDate>Wed, 30 May 2007 16:45:35 +0000</pubDate>
		<dc:creator>Peter Vinogradov</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[Op-ed]]></category>

		<guid isPermaLink="false">http://fmcollective.com/?p=50</guid>
		<description><![CDATA[In the season finale of “30 Rock”, Jack Donaghee (Alec Baldwin’s high-powered executive character) suffers a heart attack, clutches his chest and cries “Ride it Donaghee! Ride it straight to hell!”

In an effort to avoid a similar fate, I recently took a week of exile from work (pretty fancy term for "vacation", no?) and went to a location where the only internet access was dialup. Before I left, I opened my “trip packing” database, checked off the boxes for “cold, relaxing, sun” (I was going to Canada), unchecked the box for “work” and set the “willingness to smell” field to a value of 9 (out of 10). I printed the resulting packing list and closed FileMaker for a whole 7 days, possibly the longest for me in three years.

That gap gave me some time to reflect on a number of nagging personal questions. For example: “Do I want to quit my day job and be a fulltime consultant?” or “Which will ultimately be a bigger letdown: iPhone, FM9 or the Heroes finale?”]]></description>
			<content:encoded><![CDATA[<p>In the season finale of “30 Rock”, Jack Donaghee (Alec Baldwin’s high-powered executive character) suffers a heart attack, clutches his chest and cries “Ride it Donaghee! Ride it straight to hell!”</p>
<p>In an effort to avoid a similar fate, I recently took a week of exile from work (pretty fancy term for &#8220;vacation&#8221;, no?) and went to a location where the only internet access was dialup. Before I left, I opened my “trip packing” database, checked off the boxes for “cold, relaxing, sun” (I was going to Canada), unchecked the box for “work” and set the “willingness to smell” field to a value of 9 (out of 10). I printed the resulting packing list and closed FileMaker for a whole 7 days, possibly the longest for me in three years.</p>
<p>That gap gave me some time to reflect on a number of nagging personal questions. For example: “Do I want to quit my day job and be a fulltime consultant?” or “Which will ultimately be a bigger letdown: iPhone, FM9 or the Heroes finale?” <span id="more-50"></span>One such reflection was on the issue of my various FM workarounds and techniques.</p>
<p>I am a big admirer of developers who spit out technique files and custom functions whose utility are matched only by the simplicity and elegance of their approach. “What’s that? You want self-documenting contextual help menus on all your layouts. Why presto! Here’s a two line startup script that will do exactly that…etc.”</p>
<p>My own techniques, by contrast, tend to address the most oddball situations with the most epic ensemble of steps and components. Earlier this year, for example, a school I consult for wanted to revamp their student reports in the lower grades. They wanted space for subject narratives along with checklist items tailored to specific subjects and grade levels. This was familiar turf for me, so I wasn’t sweating it… yet. As we got into it, though, it turned out the school really wanted to be able to display the checklist items in multiple, balanced columns, they wanted individual items to be able to wrap to multiple lines, and they wanted absolutely no whitespace. The issues here may be obvious, but I’ll spell them out: the checklist items exist in a related table, which means I could either build the layout with portals (and kiss the word-wrapping/sliding goodbye) or build the layout on the checklist items table with subsummaries for all the report parts (and kiss the balanced columns goodbye). I have taken both approaches for other clients and projects.</p>
<p><a href="http://fmcollective.com/wp-content/uploads/2007/05/p1i1.gif" title="pseudoportal example"><img src="http://fmcollective.com/wp-content/uploads/2007/05/p1i1.gif" alt="pseudoportal example" border="0" /></a></p>
<p>Now, these are longtime FileMaker users, and I had been clear with them that they may have to live with certain limitations, but when it comes down to it, I hate having to break it to a client that between me and FileMaker, someone’s about to come up short. So, I gave them my usual “let me play with it and see what I can do” and then set about finding a workaround.  After a day or so, I worked out a way to use repeating calc fields to draw in the related data, and these behaved miraculously well in terms of sliding (btw &#8211; anyone who feels like dissing repeating fields really needs to keep it down until FileMaker dramatically improves their print offerings). If anyone is curious about this technique, I’ve put a file here: <a href="http://petervinogradov.com/TechniqueFiles/PV_PseudoPortals.zip">http://petervinogradov.com/TechniqueFiles/PV_PseudoPortals.zip</a> )</p>
<p>To be clear, this method is far from ideal. When I generate a student report from my location, I can actually hear their server whining about it from 100 miles away. Still, the client was happy and I was just left having to figure out how I wanted to bill it. See, I’m a big fan of spiral development, but when things like this come up my spirals tend to take on a shape that would do Salvador Dali proud. As much as I don’t like telling clients that something can’t be done, it feels almost as bad telling a client that something seemingly trivial took an ungodly number of hours to accomplish. But I guess that’s fodder for a different essay.</p>
<p>I’ve hacked my way through many workarounds like this, and usually, I get to a point where I start to wonder whether to keep going or whether it’s time to cut my losses and turn back. Just how many plug-ins, custom functions, scripts and “utility tables” does it take to bring me to that point? Well that depends on a lot of factors, including client personality, sleep, caffeine levels, and that ubiquitous parameter, “willingness to smell”.</p>
<p>For a while now, I’ve been dabbling with “session model” architecture, which is basically where you have all your action take place in a “sessions” table, and hook out to your database by setting various key fields. While I won’t go into detail about my specific approach (the good people at DevCon certainly didn’t think I should…grumble…grumble…didn’t want to go to their stupid conference anyway…etc. ), I will say that it has a certain style that appeals to me and has enough compelling advantages that I decided to take the plunge and apply it to a number of big projects.</p>
<p><a href="http://fmcollective.com/wp-content/uploads/2007/05/p1i2.gif" title="RG from a “Session Model” project"><img src="http://fmcollective.com/wp-content/uploads/2007/05/p1i2.gif" alt="RG from a “Session Model” project" align="left" /></a></p>
<p>Now, unlike the sliding portal workaround, which has a discernable plug that can be pulled at any time, the decision to build an entire interface around a non-standard architecture required a pretty big leap of faith and a commitment to live with whatever limitations emerge. For one thing, session model architecture (at least my peculiar version of it), pretty much tosses out simple access to certain FileMaker fundamentals, like the flipbook, basic find controls, list view, etc. While I’m willing to live without these features (and the havoc they can wreak in the hands of uninitiated end users), there are times when I really miss them and the wonderful simplicity of what I now call “old school” FM development.</p>
<p>And so, since my exile, the question I keep returning to (along with a bag of maple leaf cookies) is, “am I really doing my clients a favor by designing this way, or would they be better off in the long run with a more standard design approach?” I guess I won’t really know until I’ve lived with it for a while and built up a larger time log that I can study. Until then, I suppose it’s a matter of celebrating the stuff that feels especially easy and living with the stuff that feels needlessly complicated, even if it involves clutching my chest from time to time and telling myself to “ride it straight to hell!”</p>
]]></content:encoded>
			<wfw:commentRss>http://fmcollective.com/2007/05/30/reflections-from-exile/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Roll Your Own Edit Mode</title>
		<link>http://fmcollective.com/2007/05/19/roll-your-own-edit-mode/</link>
		<comments>http://fmcollective.com/2007/05/19/roll-your-own-edit-mode/#comments</comments>
		<pubDate>Sun, 20 May 2007 03:16:56 +0000</pubDate>
		<dc:creator>Ernest Koe</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[FM7]]></category>
		<category><![CDATA[FM8]]></category>
		<category><![CDATA[FM8.5]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://fmcollective.proofgroup.com/?p=29</guid>
		<description><![CDATA[The Problem
As FileMaker developers, we take a lot of things for granted.  For example, FileMaker&#8217;s Browse Mode/Find Mode feature is actually pretty slick; just place a field on a layout and it becomes both a data-update field as well as a query field without additional coding. However, when a layout is set to &#8220;save [...]]]></description>
			<content:encoded><![CDATA[<h2>The Problem</h2>
<p>As FileMaker developers, we take a lot of things for granted.  For example, FileMaker&#8217;s Browse Mode/Find Mode feature is actually pretty slick; just place a field on a layout and it becomes both a data-update field as well as a query field without additional coding. However, when a layout is set to &#8220;save record changes automatically&#8221;, the frequency of people <em>thinking</em> they are in Find mode when they are actually happily clobbering data is enough to drive the most laissez-faire FileMaker developer nuts.</p>
<p>Sometimes,  calling such problems &#8220;training-issues&#8221; just isn&#8217;t enough.</p>
<p>One solution is to roll your own Edit Mode feature. This technique uses the power of global variables in FileMaker 8+. In this example, I am going to combine scripts, a global variable and a custom privilege set to regulate users&#8217; record-edit access.</p>
<p>Note: this article in intended to illustrate a general technique, do not rely solely on this example to secure your database.</p>
<p><span id="more-29"></span></p>
<p>The screenshots below are from a Mac but this tip is platform-agnostic.<a href="http://fmcollective.com/wp-content/uploads/2007/05/rollyourowneditmode.zip" title="Example File"></a></p>
<p><a href="http://fmcollective.com/wp-content/uploads/2007/05/rollyourowneditmode.zip" title="Example File">Download the Example File</a></p>
<p>Note: the top level account is &#8220;admin&#8221; with no password</p>
<h2>Step-by-Step</h2>
<p><strong>1. Create the table</strong><br />
In this example, I am going to start with a new file. I have defined a table called &#8220;contacts with a few basic fields.</p>
<p><a href="http://fmcollective.com/wp-content/uploads/2007/05/ryo_create_table.png" title="create table"><img src="http://fmcollective.com/wp-content/uploads/2007/05/ryo_create_table.png" alt="create table" height="304" width="402" /></a></p>
<p>Don&#8217;t worry about the &#8220;lock status&#8221; field for now; that is an interface bell-and-whistle that I added to give the user some visual feedback. Check out the example file to learn more about that later.<br />
<strong><br />
2. Create the &#8220;toggle&#8221; script</strong><br />
Next, I am going to create a basic script that toggles the edit mode.  The script is going to use a global variable as a switch. It sets a global variable to either 1 or zero each time the script is called.</p>
<p>I have chosen to name my global variable switch <code>$$__locked</code> but you could call it whatever you wish. Just make sure it is a <strong>global</strong> variable because we want the variable to hold on to its value after the script is run.</p>
<p>The script works by checking first to see if <code>$$__locked</code> is &#8220;on&#8221; (i.e. has a value that isn&#8217;t zero or empty). If <code>$$__locked</code> is &#8220;on&#8221;, the script turns our switch &#8220;off&#8221; by setting  <code>$$__locked </code>to zero. <code></code></p>
<p><a href="http://fmcollective.com/wp-content/uploads/2007/05/ryo_script.png" title="ryo_script.png"><img src="http://fmcollective.com/wp-content/uploads/2007/05/ryo_script.png" alt="ryo_script.png" height="281" width="439" /></a></p>
<p><strong>3. Configure record level access </strong></p>
<p>We need to tell FileMaker to check the global <code>$$__locked</code> before allowing our user to make record changes.  Since record access is controlled by FileMaker privilege,  I am going to  go over to the Define&gt;Accounts &amp; Privileges&#8230; menu and create a User account with a custom privilege set called &#8220;User&#8221;&#8230;</p>
<p><a href="http://fmcollective.com/wp-content/uploads/2007/05/ryo_define_accts.png" title="modify accounts"><img src="http://fmcollective.com/wp-content/uploads/2007/05/ryo_define_accts.png" alt="modify accounts" height="170" width="331" /></a></p>
<p><a href="http://fmcollective.com/wp-content/uploads/2007/05/ryo_edit_account.png" title="ryo_edit_account.png"><img src="http://fmcollective.com/wp-content/uploads/2007/05/ryo_edit_account.png" alt="ryo_edit_account.png" height="225" width="326" /></a></p>
<p>To configure the record data access setting, I select &#8216;Custom Privileges&#8217; from the &#8216;Records&#8217; pull down menu of the &#8216;Edit Privilege Set&#8217; screen&#8230;</p>
<p><a href="http://fmcollective.com/wp-content/uploads/2007/05/ryo_custom_priv.png" title="ryo_custom_priv.png"><img src="http://fmcollective.com/wp-content/uploads/2007/05/ryo_custom_priv.png" alt="ryo_custom_priv.png" height="314" width="498" /></a><a href="http://fmcollective.com/wp-content/uploads/2007/05/ryo_modify_data_access.png" title="ryo_modify_data_access.png"> </a></p>
<p>I am going to control access to the &#8220;contacts&#8221; table by highlighting it and changing the &#8216;Edit&#8217; privilege to &#8216;limited&#8230;&#8221;</p>
<p><a href="http://fmcollective.com/wp-content/uploads/2007/05/ryo_record_access.png" title="ryo_record_access.png"><img src="http://fmcollective.com/wp-content/uploads/2007/05/ryo_record_access.png" alt="ryo_record_access.png" height="265" width="488" /></a></p>
<p>My goal is to use a calculation expression to govern the user&#8217;s record modification activity. Records can be edited when:</p>
<blockquote><p><code>not $$__locked</code>.<code></code>..</p></blockquote>
<p><a href="http://fmcollective.com/wp-content/uploads/2007/05/ryo_edit_test.png" title="ryo_edit_test.png"><img src="http://fmcollective.com/wp-content/uploads/2007/05/ryo_edit_test.png" alt="ryo_edit_test.png" height="369" width="483" /></a></p>
<p>FileMaker will evaluate the expression <code>not $$__locked</code> each time the user tries to modify a record. If <code>$$__locked</code> is zero or empty, the expression <code>not $$__locked will</code> evaluate to true (not locked) and the user will get to edit records. If <code>$$__locked</code> is &#8220;1&#8243;, our expression will evaluate to false and our user will be blocked from making any changes to &#8216;contact&#8217; records.</p>
<p><strong>4. Bells &amp; Whistles</strong></p>
<p>In the example file, you&#8217;ll note that I have added couple of simple re-login scripts to toggle between my &#8220;user&#8221; account and my &#8220;admin&#8221; account.</p>
<p>Finally, let&#8217;s cap it off by attaching a button to our script and by adding a &#8220;lock status&#8221; calculation field to create a simple indicator of the record lock status.</p>
<p><strong> </strong></p>
<p><a href="http://fmcollective.com/wp-content/uploads/2007/05/ryo_simple_ui.png" title="ryo_simple_ui.png"><img src="http://fmcollective.com/wp-content/uploads/2007/05/ryo_simple_ui.png" alt="ryo_simple_ui.png" /></a></p>
<p>Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://fmcollective.com/2007/05/19/roll-your-own-edit-mode/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Creating multiple child records from a list</title>
		<link>http://fmcollective.com/2007/04/18/creating-multiple-child-records-from-a-list/</link>
		<comments>http://fmcollective.com/2007/04/18/creating-multiple-child-records-from-a-list/#comments</comments>
		<pubDate>Wed, 18 Apr 2007 14:15:59 +0000</pubDate>
		<dc:creator>Ernest Koe</dc:creator>
				<category><![CDATA[Design Patterns]]></category>

		<guid isPermaLink="false">http://fmcollective.proofgroup.com/?p=26</guid>
		<description><![CDATA[Problem
You want to create child records from a list of values in a set of parent records
Solution
Create a loop-within-a-loop FileMaker script; use the power of indexed variables
 
Download Example File

Example
//create child records from lists of values example
//by Ernest Koe, The Proof Group LLC, April 18, 2007
Go to Layout [ “Parent” (Parent) ]
Go to Record/Request/Page [ [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
You want to create child records from a list of values in a set of parent records</p>
<p><strong>Solution</strong><br />
Create a loop-within-a-loop FileMaker script; use the power of indexed variables</p>
<p><strong> </strong></p>
<p><a href="http://fmcollective.com/wp-content/uploads/2007/05/loopinloopfp7.zip" title="Example File">Download Example File</a></p>
<p><span id="more-26"></span></p>
<p><strong>Example</strong><br />
//create child records from lists of values example<br />
//by Ernest Koe, The Proof Group LLC, April 18, 2007</p>
<p>Go to Layout [ “Parent” (Parent) ]<br />
Go to Record/Request/Page [ First ]</p>
<p>//Loop through our parent records, store the parentid in a variable</p>
<p>Loop</p>
<p>//store the parentid in a variable while looping through each parent record<br />
Set Variable [ $parentid; Value:Parent::parentid ]</p>
<p>//$n is just a counter to help us loop through child values<br />
Set Variable [ $n; Value:1 ]</p>
<p>//$itemcount is the total number of child values<br />
Set Variable [ $itemCount; Value:ValueCount ( Parent::childvalues ) ]</p>
<p>//While we are INSIDE the parent loop<br />
//do a loop through the child values, storing each item the $childid variable</p>
<p>//the inner loop to store the child values</p>
<p>Loop</p>
<p>//the trick is to store each child id in a repetition of the variable!<br />
Set Variable [ $childid[$n]; Value:GetValue ( Parent::childvalues ; $n ) ]</p>
<p>Set Variable [ $n; Value:$n + 1 ]<br />
Exit Loop If [ $n  &gt; $itemCount ]<br />
End Loop</p>
<p>Go to Layout [ “Child” (Child) ]</p>
<p>//inner loop that creates a new record for each value in childid[]</p>
<p>//$i is another counter<br />
Set Variable [ $i; Value:1 ]</p>
<p>Loop<br />
New Record/Request<br />
Set Field [ Child::parentid; $parentid ]<br />
Set Field [ Child::childid; $childid[$i] ]<br />
Set Variable [ $i; Value:$i+1 ]<br />
Exit Loop If [ $i   ≥   $n ]<br />
End Loop</p>
<p>Go to Layout [ “Parent” (Parent) ]<br />
Go to Record/Request/Page [ Next; Exit after last ]<br />
End Loop</p>
<p><strong>Discussion</strong><br />
The crux of this technique to is realize that you can store and access data in variable repetitions; we can set childID[1] = &#8220;a&#8221;, childID[2] to &#8220;b&#8221;, childID[3] to &#8220;c&#8221; and so forth. The beauty of variables is that you can set their indexes (the repetition numbers of the variable) with the value of another variable, such as a counter that is incremented while in a loop.</p>
]]></content:encoded>
			<wfw:commentRss>http://fmcollective.com/2007/04/18/creating-multiple-child-records-from-a-list/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Simplicity and Software Architecture</title>
		<link>http://fmcollective.com/2006/12/16/simplicity-and-software-architecture/</link>
		<comments>http://fmcollective.com/2006/12/16/simplicity-and-software-architecture/#comments</comments>
		<pubDate>Sat, 16 Dec 2006 04:43:58 +0000</pubDate>
		<dc:creator>corn</dc:creator>
				<category><![CDATA[Design Patterns]]></category>

		<guid isPermaLink="false">http://fmcollective.proofgroup.com/?p=20</guid>
		<description><![CDATA[I&#8217;m always a bit behind the times so it was only recently that I found out that DevCon would be returning to the JW Marriott Grande Lakes in Orlando. I actually miss the Arizona setting. Sure, it&#8217;s hot in AZ but it&#8217;s a dry heat. Orlando is just as hot with the humidity but it [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m always a bit behind the times so it was only recently that I found out that DevCon would be returning to the <a href="http://www.grandelakes.com/">JW Marriott Grande Lakes</a> in Orlando. I actually miss the Arizona setting. Sure, it&#8217;s hot in AZ but it&#8217;s a <a href="http://science.howstuffworks.com/question651.htm">dry heat</a>. Orlando is just as hot with the humidity but it does have better food going for it. While both cities suffer from a severe case of sprawl, there is something about the Sonoran desert that is seductive to me. Walking through the desert brush makes me more aware of life and the scale of it. It&#8217;s my personal <a href="http://en.wikipedia.org/wiki/Total_Perspective_Vortex">Total Perspective Vortex</a>.</p>
<p><span id="more-20"></span></p>
<p>Not far from 101, just off of Bell Road, is Taliesin West, home of<br />
the architecture school started by Frank Lloyd Wright. Love or hate the<br />
man, I&#8217;ve always appreciated the design approach he brought to<br />
architecture. I think there is a lot to be learned from both his<br />
successes and his failures, perhaps more from the latter. The same can be said of many architects. Earlier this<br />
year Albert Harum-Alvarez invited a small group to tour the <a href="http://www.sfgate.com/cgi-bin/article.cgi?f=/c/a/2006/02/02/DDG3MGVUL449.DTL">Julian Street Inn</a>, a shelter serving the homeless population in<br />
San Jose. The facility was designed by Christopher Alexander, whose<br />
writing on design patterns have influenced not just architecture but<br />
the software industry as well. The tour was incredibly useful in understanding architecture on the many different scales it exists. </p>
<p>Inertia led me into my current vocation of software development. My<br />
avocation, on the other hand, is design, architecture, and<br />
construction. It seems natural to me then that I would be drawn to the<br />
ideas of Alexander and embrace the merger of art and information<br />
science. As a self-professed software architect I look for patterns in<br />
design at all levels of the system. Patterns exist not only in the user<br />
interface but also in the structure of the application logic and data<br />
model. I am constantly revising my practices in an effort to distill<br />
them into the essential &#8211; everything else is just a distraction. To<br />
that end, I&#8217;m not certain whether I agree or disagree with Joel Spolsky<br />
(and by extension Don Norman) when he <a href="http://www.joelonsoftware.com/items/2006/12/09.html">derides simplicity</a>.<br />
I think what he calls simplicity is what I would call a spare feature<br />
set. My goal, on the other hand, is not the reduction of features but<br />
rather making certain that each feature is implemented in as<br />
unobfuscated a manner as possible. Sometimes this means moving things<br />
into the data model, other times it means moving them out. Often it is<br />
an attempt to bring a certain aesthetic to the application.
</p>
<p>There&#8217;s a danger in confusing simplicity with simplistic or<br />
unsophisticated. In data modeling &quot;simple&quot; is often used as a synonym for &quot;flat and wide&quot; when it comes to table structure. In application<br />
design it is often used to berate scripting and UI control. I think we<br />
lose sight of the real meaning of simplicity as it relates to our<br />
applications. Simple is not a design methodology that describes how we<br />
put things together, it&#8217;s a description of the user&#8217;s perception of the<br />
end result. Sometimes simple methods are appropriate in creating simple<br />
results. Other times it&#8217;s an engineering marvel under the hood to<br />
present the user with a &quot;simple&quot; view of the world. The software architect&#8217;s job is to know when each approach is appropriate to the end goal of user simplicity. </p>
]]></content:encoded>
			<wfw:commentRss>http://fmcollective.com/2006/12/16/simplicity-and-software-architecture/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
