<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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>Comments on: FileMaker Dictionary Functions</title>
	<atom:link href="http://sixfriedrice.com/wp/filemaker-dictionary-functions/feed/" rel="self" type="application/rss+xml" />
	<link>http://sixfriedrice.com/wp/filemaker-dictionary-functions/</link>
	<description>smart business solutions</description>
	<lastBuildDate>Fri, 18 May 2012 01:30:19 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Chuck Ross</title>
		<link>http://sixfriedrice.com/wp/filemaker-dictionary-functions/comment-page-1/#comment-2044</link>
		<dc:creator>Chuck Ross</dc:creator>
		<pubDate>Thu, 17 Mar 2011 23:19:20 +0000</pubDate>
		<guid isPermaLink="false">http://sixfriedrice.com/wp/filemaker-dictionary-functions/#comment-2044</guid>
		<description>Thanks very much for this. I love dictionaries in PHP, REALbasic and other languages, and was hoping I would have to write FileMaker dictionary routines myself. I did add one function to the library which you might be interested in: DictKeys.

Let(
  [
    FirstItem = DictFirst( Dict )
  ];

  Case(
    Dict = Null;
    Null;

    FirstItem &amp; ¶ &amp; DictKeys( DictRemove( Dict; FirstItem ) )
  )
)

Null is a custom function that just returns an empty string. Using this with the Pop function I found here allows very easy iteration through a dictionary&#039;s entries.</description>
		<content:encoded><![CDATA[<p>Thanks very much for this. I love dictionaries in PHP, REALbasic and other languages, and was hoping I would have to write FileMaker dictionary routines myself. I did add one function to the library which you might be interested in: DictKeys.</p>
<p>Let(<br />
  [<br />
    FirstItem = DictFirst( Dict )<br />
  ];</p>
<p>  Case(<br />
    Dict = Null;<br />
    Null;</p>
<p>    FirstItem &amp; ¶ &amp; DictKeys( DictRemove( Dict; FirstItem ) )<br />
  )<br />
)</p>
<p>Null is a custom function that just returns an empty string. Using this with the Pop function I found here allows very easy iteration through a dictionary&#8217;s entries.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Graham</title>
		<link>http://sixfriedrice.com/wp/filemaker-dictionary-functions/comment-page-1/#comment-2014</link>
		<dc:creator>Dave Graham</dc:creator>
		<pubDate>Fri, 17 Dec 2010 09:06:43 +0000</pubDate>
		<guid isPermaLink="false">http://sixfriedrice.com/wp/filemaker-dictionary-functions/#comment-2014</guid>
		<description>@Don: This is only about a year late, but I wanted a reliable way of initializing all names as local variables and I just saw your function. When any value in the dictionary contains quotes, using an Evaluate() function will fail unless you first escape the quotes. Then it turns into a recursive mess to set variables back to their properly unescaped value(s). I suspect that it&#039;s easier to do this with SFR&#039;s existing functions recursively.

Here&#039;s my stab at it:

// Name: DictInit( dict )
// Purpose: initialize all names in dictionary as local variables matching values

Let( [ 
	thisName = DictFirst ( dict ) 
] ; 

If( 
	not IsEmpty( thisName ) ; 
		Let( 
		[
			thisValue = Quote( Substitute ( DictGet ( dict ; thisName ) ; [ &quot;\&quot;&quot; ; &quot;%34&quot; ] ) ) ; // escape quotes in value
			dict = DictRemove ( dict ;  thisName ) // pop this off the top of the dictionary
		] ; 
			Evaluate( &quot;Let( $&quot; &amp; thisName &amp; &quot; = &quot; &amp; thisValue &amp; &quot; ; \&quot;\&quot; )&quot; ) // assign the escaped value to the variable
			&amp; Evaluate( &quot;Let( $&quot; &amp; thisName &amp; &quot; = Substitute ( $&quot; &amp; thisName &amp; &quot; ; \&quot;%34\&quot; ; \&quot;\\\&quot;\&quot; ) ; \&quot;\&quot; )&quot;  ) // reverse escaping
			&amp; DictInit ( dict ) // continue until all variables are initialized 
		)
	)
)</description>
		<content:encoded><![CDATA[<p>@Don: This is only about a year late, but I wanted a reliable way of initializing all names as local variables and I just saw your function. When any value in the dictionary contains quotes, using an Evaluate() function will fail unless you first escape the quotes. Then it turns into a recursive mess to set variables back to their properly unescaped value(s). I suspect that it&#8217;s easier to do this with SFR&#8217;s existing functions recursively.</p>
<p>Here&#8217;s my stab at it:</p>
<p>// Name: DictInit( dict )<br />
// Purpose: initialize all names in dictionary as local variables matching values</p>
<p>Let( [<br />
	thisName = DictFirst ( dict )<br />
] ; </p>
<p>If(<br />
	not IsEmpty( thisName ) ;<br />
		Let(<br />
		[<br />
			thisValue = Quote( Substitute ( DictGet ( dict ; thisName ) ; [ "\"" ; "%34" ] ) ) ; // escape quotes in value<br />
			dict = DictRemove ( dict ;  thisName ) // pop this off the top of the dictionary<br />
		] ;<br />
			Evaluate( &#8220;Let( $&#8221; &amp; thisName &amp; &#8221; = &#8221; &amp; thisValue &amp; &#8221; ; \&#8221;\&#8221; )&#8221; ) // assign the escaped value to the variable<br />
			&amp; Evaluate( &#8220;Let( $&#8221; &amp; thisName &amp; &#8221; = Substitute ( $&#8221; &amp; thisName &amp; &#8221; ; \&#8221;%34\&#8221; ; \&#8221;\\\&#8221;\&#8221; ) ; \&#8221;\&#8221; )&#8221;  ) // reverse escaping<br />
			&amp; DictInit ( dict ) // continue until all variables are initialized<br />
		)<br />
	)<br />
)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Smith</title>
		<link>http://sixfriedrice.com/wp/filemaker-dictionary-functions/comment-page-1/#comment-2007</link>
		<dc:creator>Dan Smith</dc:creator>
		<pubDate>Tue, 23 Nov 2010 01:52:11 +0000</pubDate>
		<guid isPermaLink="false">http://sixfriedrice.com/wp/filemaker-dictionary-functions/#comment-2007</guid>
		<description>oops, looks like the last part of my message was cut off, let me try it again...

DictRemove 
&lt;code&gt;pattern = &quot;&quot;; &quot;/&gt;&quot;]; [&quot;&lt;&quot; ; &quot;/&lt;&quot;] ) &amp; &quot;:=&quot; ;&lt;/code&gt;

DictFirst
&lt;code&gt;foundValue = Substitute( Middle( dict; endOfStartValue ; lengthFoundValue ) ; [&quot;/:&quot;; &quot;:&quot;]; [&quot;/=&quot;; &quot;=&quot;]; [&quot;/&gt;&quot;; &quot;&gt;&quot;]; [&quot;/&lt;&quot; ; &quot;&lt;&quot; ] )&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>oops, looks like the last part of my message was cut off, let me try it again&#8230;</p>
<p>DictRemove<br />
<code>pattern = ""; "/&gt;"]; ["&lt;&quot; ; &quot;/&lt;&quot;] ) &amp; &quot;:=&quot; ;</code></p>
<p>DictFirst<br />
<code>foundValue = Substitute( Middle( dict; endOfStartValue ; lengthFoundValue ) ; ["/:"; ":"]; ["/="; "="]; ["/&gt;"; "&gt;"]; ["/&lt;&quot; ; &quot;&lt;&quot; ] )</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Smith</title>
		<link>http://sixfriedrice.com/wp/filemaker-dictionary-functions/comment-page-1/#comment-2006</link>
		<dc:creator>Dan Smith</dc:creator>
		<pubDate>Tue, 23 Nov 2010 01:45:46 +0000</pubDate>
		<guid isPermaLink="false">http://sixfriedrice.com/wp/filemaker-dictionary-functions/#comment-2006</guid>
		<description>I just found an error with DictRemove and DictFirst functions.  Neither of them use substitute on the &#039;name&#039;.  If use use the DictToString() function with DictRemove and DictFirst as they are, you would get stuck in an endless loop (until FM gives you an out of memory error).

Example of DictToString() that will cause an endless loop:
DictToString( #(&quot;Table::Field&quot;;&quot;value&quot;) ; &quot;$name: $value&quot; )


setting the corresponding &#039;Let&#039; variables to the calculation below fixes the problem:

DictRemove 
    pattern = &quot;&quot;; &quot;/&gt;&quot;]; [&quot;&lt;&quot; ; &quot;/&quot;; &quot;&gt;&quot;]; [&quot;/&lt;&quot; ; &quot;&lt;&quot; ] )</description>
		<content:encoded><![CDATA[<p>I just found an error with DictRemove and DictFirst functions.  Neither of them use substitute on the &#8216;name&#8217;.  If use use the DictToString() function with DictRemove and DictFirst as they are, you would get stuck in an endless loop (until FM gives you an out of memory error).</p>
<p>Example of DictToString() that will cause an endless loop:<br />
DictToString( #(&#8221;Table::Field&#8221;;&#8221;value&#8221;) ; &#8220;$name: $value&#8221; )</p>
<p>setting the corresponding &#8216;Let&#8217; variables to the calculation below fixes the problem:</p>
<p>DictRemove<br />
    pattern = &#8220;&#8221;; &#8220;/&gt;&#8221;]; ["&lt;&quot; ; &quot;/"; "&gt;"]; ["/&lt;&quot; ; &quot;&lt;&quot; ] )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Don Levan</title>
		<link>http://sixfriedrice.com/wp/filemaker-dictionary-functions/comment-page-1/#comment-1892</link>
		<dc:creator>Don Levan</dc:creator>
		<pubDate>Mon, 25 Jan 2010 21:32:17 +0000</pubDate>
		<guid isPermaLink="false">http://sixfriedrice.com/wp/filemaker-dictionary-functions/#comment-1892</guid>
		<description>Based on a script snipped posted to the Pause on Error (Portland 2010) wiki by John Sindelar, I have created a new function to work with your dictionary functions. This function converts a dictionary to local variables. 

&lt;pre&gt;&lt;code&gt;
//DictConvertToParameters ( dict ) 
//Created by Don Levan. Adapted from the &quot;Seed Code Calendar: Calendar Utility: Parameters to Local Variables&quot; script posted by John Sindelar to the Pause on Error, Portaland 2010 wiki. 
//Purpose: Converts a dict to local variables. 

Let ( 
  [ 

    n = dict ; 
    prefix = &quot;$&quot; ; 


    e = PatternCount ( n ; &quot; = &quot; ) = 0 ; 

    string = Substitute ( 
                          n ; 
                          [&quot;:&gt;&lt;:&quot;; &quot;; &quot;];
                          [&quot;&quot; ; &quot;&quot; ] 

                        ) 

  ] ; 

  Evaluate ( &quot;Let ( [ &quot; &amp; pre?x &amp;  string &amp; &quot;\&quot; ] ; \&quot;\&quot; )&quot; ) 

)
&lt;/code&gt;&lt;/pre&gt;


I am hoping you all can help me identify escapes I might have missed that would cause it to fail.</description>
		<content:encoded><![CDATA[<p>Based on a script snipped posted to the Pause on Error (Portland 2010) wiki by John Sindelar, I have created a new function to work with your dictionary functions. This function converts a dictionary to local variables. </p>
<pre><code>
//DictConvertToParameters ( dict )
//Created by Don Levan. Adapted from the "Seed Code Calendar: Calendar Utility: Parameters to Local Variables" script posted by John Sindelar to the Pause on Error, Portaland 2010 wiki.
//Purpose: Converts a dict to local variables. 

Let (
  [ 

    n = dict ;
    prefix = "$" ; 

    e = PatternCount ( n ; " = " ) = 0 ; 

    string = Substitute (
                          n ;
                          [":&gt;&lt;:&quot;; &quot;; &quot;];
                          [&quot;" ; "" ] 

                        ) 

  ] ; 

  Evaluate ( "Let ( [ " &amp; pre?x &amp;  string &amp; "\" ] ; \"\" )" ) 

)
</code></pre>
<p>I am hoping you all can help me identify escapes I might have missed that would cause it to fail.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas Seidler</title>
		<link>http://sixfriedrice.com/wp/filemaker-dictionary-functions/comment-page-1/#comment-1844</link>
		<dc:creator>Thomas Seidler</dc:creator>
		<pubDate>Fri, 16 Oct 2009 16:36:10 +0000</pubDate>
		<guid isPermaLink="false">http://sixfriedrice.com/wp/filemaker-dictionary-functions/#comment-1844</guid>
		<description>just got a JSON reader up and running, tested fairly extensively, version 10 now working. It was actually quite simple and very fast compared to the other stuff! It just flies through JSON and replaces syntax with appropriately escaped Dict/List syntax. Not yet made use of it, but hopefully by this time next week our web menu system will be powered by it!

Here is link to key changed function: http://www.harmlesswise.com/0906-filemaker-python-dictionary-list-functions#1.1.1

But you&#039;ll need to see version notes at end and update 2 other functions, minor speed/flexibility improvements etc.

T x</description>
		<content:encoded><![CDATA[<p>just got a JSON reader up and running, tested fairly extensively, version 10 now working. It was actually quite simple and very fast compared to the other stuff! It just flies through JSON and replaces syntax with appropriately escaped Dict/List syntax. Not yet made use of it, but hopefully by this time next week our web menu system will be powered by it!</p>
<p>Here is link to key changed function: <a href="http://www.harmlesswise.com/0906-filemaker-python-dictionary-list-functions#1.1.1" rel="nofollow">http://www.harmlesswise.com/0906-filemaker-python-dictionary-list-functions#1.1.1</a></p>
<p>But you&#8217;ll need to see version notes at end and update 2 other functions, minor speed/flexibility improvements etc.</p>
<p>T x</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas Seidler</title>
		<link>http://sixfriedrice.com/wp/filemaker-dictionary-functions/comment-page-1/#comment-1820</link>
		<dc:creator>Thomas Seidler</dc:creator>
		<pubDate>Fri, 24 Jul 2009 18:04:59 +0000</pubDate>
		<guid isPermaLink="false">http://sixfriedrice.com/wp/filemaker-dictionary-functions/#comment-1820</guid>
		<description>Oright my loves, gone the next level, taken the ball and run with it to deep dark places. Full syntactic dictionary and list functionality is what i was after and i reckon i&#039;ve pretty much got there, effective Foreach functionality and much much more....

Enjoy, but i guess it&#039;s only for the lunatic fringe, btw as per Bruce R&#039;s comments, it produces JSON though can&#039;t read it alas... (i didn&#039;t start with trying to get a JSON reader and my mind nearly split doing the above anyway...)&gt;&gt;&gt;

http://www.harmlesswise.com/0906-filemaker-python-dictionary-list-functions

T</description>
		<content:encoded><![CDATA[<p>Oright my loves, gone the next level, taken the ball and run with it to deep dark places. Full syntactic dictionary and list functionality is what i was after and i reckon i&#8217;ve pretty much got there, effective Foreach functionality and much much more&#8230;.</p>
<p>Enjoy, but i guess it&#8217;s only for the lunatic fringe, btw as per Bruce R&#8217;s comments, it produces JSON though can&#8217;t read it alas&#8230; (i didn&#8217;t start with trying to get a JSON reader and my mind nearly split doing the above anyway&#8230;)&gt;&gt;&gt;</p>
<p><a href="http://www.harmlesswise.com/0906-filemaker-python-dictionary-list-functions" rel="nofollow">http://www.harmlesswise.com/0906-filemaker-python-dictionary-list-functions</a></p>
<p>T</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bruce Robertson</title>
		<link>http://sixfriedrice.com/wp/filemaker-dictionary-functions/comment-page-1/#comment-1804</link>
		<dc:creator>Bruce Robertson</dc:creator>
		<pubDate>Sat, 13 Jun 2009 23:36:01 +0000</pubDate>
		<guid isPermaLink="false">http://sixfriedrice.com/wp/filemaker-dictionary-functions/#comment-1804</guid>
		<description>Seems like this is a pseudo-JSON; but why not just go all the way and actually use JSON? Then you can use the results in web viewers, etc.</description>
		<content:encoded><![CDATA[<p>Seems like this is a pseudo-JSON; but why not just go all the way and actually use JSON? Then you can use the results in web viewers, etc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Smith</title>
		<link>http://sixfriedrice.com/wp/filemaker-dictionary-functions/comment-page-1/#comment-1725</link>
		<dc:creator>Dan Smith</dc:creator>
		<pubDate>Sun, 15 Mar 2009 22:08:07 +0000</pubDate>
		<guid isPermaLink="false">http://sixfriedrice.com/wp/filemaker-dictionary-functions/#comment-1725</guid>
		<description>Thanks for these custom functions!  They blew my mind!  Check out the link to see how I used them to implement a &quot;Row Highlight Selection&quot; feature, capable of the following:

1) The active record is automatically highlighted when you access a record
2) Ctrl + click on a record to highlight more than one record at a time
3) Shift + click to highlight all records between the currently active record and the one you click on
4) Click the &quot;View Highlighted&quot; button to view only the highlighted records in a new window
5) now open a new window and do all of the above again - each window has it&#039;s own set of highlighted records!</description>
		<content:encoded><![CDATA[<p>Thanks for these custom functions!  They blew my mind!  Check out the link to see how I used them to implement a &#8220;Row Highlight Selection&#8221; feature, capable of the following:</p>
<p>1) The active record is automatically highlighted when you access a record<br />
2) Ctrl + click on a record to highlight more than one record at a time<br />
3) Shift + click to highlight all records between the currently active record and the one you click on<br />
4) Click the &#8220;View Highlighted&#8221; button to view only the highlighted records in a new window<br />
5) now open a new window and do all of the above again &#8211; each window has it&#8217;s own set of highlighted records!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bruce Robertson</title>
		<link>http://sixfriedrice.com/wp/filemaker-dictionary-functions/comment-page-1/#comment-1684</link>
		<dc:creator>Bruce Robertson</dc:creator>
		<pubDate>Thu, 19 Feb 2009 21:14:40 +0000</pubDate>
		<guid isPermaLink="false">http://sixfriedrice.com/wp/filemaker-dictionary-functions/#comment-1684</guid>
		<description>Writing DictQuery and DictXTAB routines.</description>
		<content:encoded><![CDATA[<p>Writing DictQuery and DictXTAB routines.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

