<?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: Set Field by Name Exposed</title>
	<atom:link href="http://sixfriedrice.com/wp/set-field-by-name-exposed/feed/" rel="self" type="application/rss+xml" />
	<link>http://sixfriedrice.com/wp/set-field-by-name-exposed/</link>
	<description>smart business solutions</description>
	<lastBuildDate>Sun, 29 Jan 2012 19:10:42 -0600</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Chuck Pelto</title>
		<link>http://sixfriedrice.com/wp/set-field-by-name-exposed/comment-page-1/#comment-2009</link>
		<dc:creator>Chuck Pelto</dc:creator>
		<pubDate>Fri, 26 Nov 2010 18:16:48 +0000</pubDate>
		<guid isPermaLink="false">http://sixfriedrice.com/wp/set-field-by-name-exposed/#comment-2009</guid>
		<description>Wouldn&#039;t it have been nice if these people at FMI had made it so that a variable could have been used to identify the field?

Oh...but no....that would have required too much thought.</description>
		<content:encoded><![CDATA[<p>Wouldn&#8217;t it have been nice if these people at FMI had made it so that a variable could have been used to identify the field?</p>
<p>Oh&#8230;but no&#8230;.that would have required too much thought.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Tinoco</title>
		<link>http://sixfriedrice.com/wp/set-field-by-name-exposed/comment-page-1/#comment-1916</link>
		<dc:creator>David Tinoco</dc:creator>
		<pubDate>Thu, 11 Mar 2010 18:13:48 +0000</pubDate>
		<guid isPermaLink="false">http://sixfriedrice.com/wp/set-field-by-name-exposed/#comment-1916</guid>
		<description>I am having trouble using a script parameter and this script step.

The field is called g_inventoryItem
and has 10 repetitions.

I pass g_inventoryItem as a script parameter and then use:

Set Variable $counter = 1;
Loop
SetFieldByName: Get(ScriptParameter) &amp; &quot;[&quot; &amp; $counter &amp; &quot;]&quot; ; &quot;&quot;
Set Variable $counter = $counter + 1;
Exit Loop If $counter &gt; 10
End Loop

But it says the field is missing</description>
		<content:encoded><![CDATA[<p>I am having trouble using a script parameter and this script step.</p>
<p>The field is called g_inventoryItem<br />
and has 10 repetitions.</p>
<p>I pass g_inventoryItem as a script parameter and then use:</p>
<p>Set Variable $counter = 1;<br />
Loop<br />
SetFieldByName: Get(ScriptParameter) &amp; &#8220;[" &amp; $counter &amp; "]&#8221; ; &#8220;&#8221;<br />
Set Variable $counter = $counter + 1;<br />
Exit Loop If $counter &gt; 10<br />
End Loop</p>
<p>But it says the field is missing</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://sixfriedrice.com/wp/set-field-by-name-exposed/comment-page-1/#comment-1769</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Thu, 30 Apr 2009 20:33:37 +0000</pubDate>
		<guid isPermaLink="false">http://sixfriedrice.com/wp/set-field-by-name-exposed/#comment-1769</guid>
		<description>Thanks so much!  SO much better then filemaker&#039;s help file.  I spent so long until I read your article to figure out you have to &#039;build&#039; the field name.

&quot;Customers::&quot; &amp; Get ( ScriptParameter )

Script trigger on exit &#039;FullName&#039; field, passing Get ( ActiveFieldName ) results in: &quot;Customers::FullName&quot;

works beautifully now!!  Cheers to short/smart scripts!
1 liner, I love it!!</description>
		<content:encoded><![CDATA[<p>Thanks so much!  SO much better then filemaker&#8217;s help file.  I spent so long until I read your article to figure out you have to &#8216;build&#8217; the field name.</p>
<p>&#8220;Customers::&#8221; &amp; Get ( ScriptParameter )</p>
<p>Script trigger on exit &#8216;FullName&#8217; field, passing Get ( ActiveFieldName ) results in: &#8220;Customers::FullName&#8221;</p>
<p>works beautifully now!!  Cheers to short/smart scripts!<br />
1 liner, I love it!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Will M. Baker</title>
		<link>http://sixfriedrice.com/wp/set-field-by-name-exposed/comment-page-1/#comment-1689</link>
		<dc:creator>Will M. Baker</dc:creator>
		<pubDate>Mon, 23 Feb 2009 22:36:13 +0000</pubDate>
		<guid isPermaLink="false">http://sixfriedrice.com/wp/set-field-by-name-exposed/#comment-1689</guid>
		<description>Something interesting I&#039;ve found when using this to set repeating fields: often, when we reference a specific repetition of a repeating field, we&#039;ll do so with some extra white space for padding, like this:
  FIELD [ 2 ]

FileMaker in general is forgiving, and doesn&#039;t care about the extra spaces.  It can evaluate FIELD [ 2 ] just as easily as FIELD[2].

&#039;Set Field By Name&#039; is less forgiving.  The following statement properly executes, inserting the value &quot;Test&quot; into the second repetition of the field.
  Set Field By Name [&quot;FIELD[2]&quot;; &quot;Test&quot;]

But this statement results in error 102:
  Set Field By Name [&quot;FIELD [ 2 ]&quot;; &quot;Test&quot;]</description>
		<content:encoded><![CDATA[<p>Something interesting I&#8217;ve found when using this to set repeating fields: often, when we reference a specific repetition of a repeating field, we&#8217;ll do so with some extra white space for padding, like this:<br />
  FIELD [ 2 ]</p>
<p>FileMaker in general is forgiving, and doesn&#8217;t care about the extra spaces.  It can evaluate FIELD [ 2 ] just as easily as FIELD[2].</p>
<p>&#8216;Set Field By Name&#8217; is less forgiving.  The following statement properly executes, inserting the value &#8220;Test&#8221; into the second repetition of the field.<br />
  Set Field By Name ["FIELD[2]&#8220;; &#8220;Test&#8221;]</p>
<p>But this statement results in error 102:<br />
  Set Field By Name ["FIELD [ 2 ]&#8220;; &#8220;Test&#8221;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lorne Walton</title>
		<link>http://sixfriedrice.com/wp/set-field-by-name-exposed/comment-page-1/#comment-1547</link>
		<dc:creator>Lorne Walton</dc:creator>
		<pubDate>Mon, 19 Jan 2009 18:20:12 +0000</pubDate>
		<guid isPermaLink="false">http://sixfriedrice.com/wp/set-field-by-name-exposed/#comment-1547</guid>
		<description>The awesome power of this will start to sink in better once I get my hands on FM 10. I just want to point out what I think is a typo in this line:
&quot;Set Field by Name [ Get(ScriptParameter); Upper(GetField(Get(ScriptParameter))) ]&quot;

That should be &quot;GetFieldName&quot;, right?

If I&#039;m right, please feel free to erase this massage after you make the fix. Thanks for SFR!</description>
		<content:encoded><![CDATA[<p>The awesome power of this will start to sink in better once I get my hands on FM 10. I just want to point out what I think is a typo in this line:<br />
&#8220;Set Field by Name [ Get(ScriptParameter); Upper(GetField(Get(ScriptParameter))) ]&#8221;</p>
<p>That should be &#8220;GetFieldName&#8221;, right?</p>
<p>If I&#8217;m right, please feel free to erase this massage after you make the fix. Thanks for SFR!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen Dolenski</title>
		<link>http://sixfriedrice.com/wp/set-field-by-name-exposed/comment-page-1/#comment-1500</link>
		<dc:creator>Stephen Dolenski</dc:creator>
		<pubDate>Sat, 10 Jan 2009 04:10:12 +0000</pubDate>
		<guid isPermaLink="false">http://sixfriedrice.com/wp/set-field-by-name-exposed/#comment-1500</guid>
		<description>one way to reduce having to open both &quot;Specify&quot; dialog boxes (one for the name and one for the result ) when developing the calculation put all the logic in the first (default double clickable) &quot;Specify&quot; calc dialog. Wrapping it with a Let () statement and setting a local script variable $result, then putting that in to the second Calc field 

[code]
 Let ([

$field = GetFieldName ( sscode::field ) ;  // or a complex calc to determine your target field. 
$result = &quot; XYZ&quot; // or complex calc to provide dynamic results depending on target field. 

];

$field

)//Let
[/code]

Then you only need to manage your code from one place.

Or you can put two variables in each dialog box $target / $result and set the logic elsewhere in your script using variables. 

Alternatively Abstract your logic even further by creating Parameter based Scripts that are reusable. A single Script that handles ALL your Set Field by Names that expects two parameters or global variables, a Target field And Result you pass these to your script it does its job, in case of using global variables have it null the values on completion.</description>
		<content:encoded><![CDATA[<p>one way to reduce having to open both &#8220;Specify&#8221; dialog boxes (one for the name and one for the result ) when developing the calculation put all the logic in the first (default double clickable) &#8220;Specify&#8221; calc dialog. Wrapping it with a Let () statement and setting a local script variable $result, then putting that in to the second Calc field </p>
<p>[code]<br />
 Let ([</p>
<p>$field = GetFieldName ( sscode::field ) ;  // or a complex calc to determine your target field.<br />
$result = " XYZ" // or complex calc to provide dynamic results depending on target field. </p>
<p>];</p>
<p>$field</p>
<p>)//Let<br />
[/code]</p>
<p>Then you only need to manage your code from one place.</p>
<p>Or you can put two variables in each dialog box $target / $result and set the logic elsewhere in your script using variables. </p>
<p>Alternatively Abstract your logic even further by creating Parameter based Scripts that are reusable. A single Script that handles ALL your Set Field by Names that expects two parameters or global variables, a Target field And Result you pass these to your script it does its job, in case of using global variables have it null the values on completion.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Larry</title>
		<link>http://sixfriedrice.com/wp/set-field-by-name-exposed/comment-page-1/#comment-1464</link>
		<dc:creator>Larry</dc:creator>
		<pubDate>Wed, 07 Jan 2009 07:06:54 +0000</pubDate>
		<guid isPermaLink="false">http://sixfriedrice.com/wp/set-field-by-name-exposed/#comment-1464</guid>
		<description>Forgive me if this was mentioned already, but another thing I&#039;ve just noticed in playing around with this is that you can include more Set Field By Name steps than you need.  FileMaker gives an error 102 (Field Is Missing), but essentially skips right over it without giving a warning dialog.  I have a generic &quot;New Related Record Script&quot; which, depending on the context, might need a number of additional fields set.  So I can pass as parameters:
&lt;pre&gt;&lt;code&gt;
 #( &quot;field1&quot; ; GetFieldName ( TABLE::Field ) ) &amp; #( &quot;field1Value&quot; ; &quot;My Value&quot; ) &amp;
 #( &quot;field2&quot; ; GetFieldName ( TABLE::Field ) ) &amp; #( &quot;field2Value&quot; ; &quot;My Value&quot; ) &amp;etc.
&lt;/pre&gt;&lt;/code&gt;

to the script which, for good measure, could have a half dozen or more appropriately numbered Set Field By Name steps in it.  

And I&#039;ll definitely be making a shorthand GFN() for that function since I can see I&#039;ll be using it a lot.</description>
		<content:encoded><![CDATA[<p>Forgive me if this was mentioned already, but another thing I&#8217;ve just noticed in playing around with this is that you can include more Set Field By Name steps than you need.  FileMaker gives an error 102 (Field Is Missing), but essentially skips right over it without giving a warning dialog.  I have a generic &#8220;New Related Record Script&#8221; which, depending on the context, might need a number of additional fields set.  So I can pass as parameters:</p>
<pre><code>
 #( "field1" ; GetFieldName ( TABLE::Field ) ) &amp; #( "field1Value" ; "My Value" ) &amp;
 #( "field2" ; GetFieldName ( TABLE::Field ) ) &amp; #( "field2Value" ; "My Value" ) &amp;etc.
</code></pre>
<p>to the script which, for good measure, could have a half dozen or more appropriately numbered Set Field By Name steps in it.  </p>
<p>And I'll definitely be making a shorthand GFN() for that function since I can see I'll be using it a lot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michel Vincent</title>
		<link>http://sixfriedrice.com/wp/set-field-by-name-exposed/comment-page-1/#comment-1461</link>
		<dc:creator>Michel Vincent</dc:creator>
		<pubDate>Wed, 07 Jan 2009 05:03:22 +0000</pubDate>
		<guid isPermaLink="false">http://sixfriedrice.com/wp/set-field-by-name-exposed/#comment-1461</guid>
		<description>Hello Geoff,
The idea of automatic xml tags creation works fine.
I already know about xml exportation with FileMaker but this method, IMHO, combined with loops in scripts, gives a lot of flexibility. What I like is the fact that, since the formula is based on the FieldName, it never needs to be edited (that&#039;s a complex solution for a lazy person). I hope that it will be useful to others as it would have been to me in some projects.
Here is an example :
Define 2 text fields : FirstName and LastName 
(make sure that their name is the same as the xml tag name).
Then define a first calculation field: FirstName_
(it has the very same name as the target source field followed by an underscore)
The calculation is as follows:

&lt;pre&gt;&lt;code&gt;IIf ( not IsEmpty ( GetField(Left(GetFieldName ( Self);Length(GetFieldName ( Self)) -1)) ) ;
                        &quot;&lt;&quot; &amp; RightWords(GetFieldName ( Self);1) &amp; &quot;&gt;&quot; 
                        &amp; GetField(Left(GetFieldName ( Self);Length(GetFieldName ( Self)) -1)) 
                        &amp; &quot;&lt;/&quot; &amp; RightWords(GetFieldName ( Self);1) &amp; &quot;&gt;&quot; ; &quot;&quot; )
&lt;/code&gt;&lt;/pre&gt;

The result must be text and (unfortunately?) the result must be stored if we want anything to show.
We can now duplicate the FirstName_ field and rename it LastName_ and we don&#039;t have to modify the formula.
As a result, if the FirstName field contains Geoff, the FirstName_ field will show:

&lt;pre&gt;&lt;code&gt;&lt;FirstName&gt;Geoff&lt;/FirstName&gt;&lt;/code&gt;&lt;/pre&gt;

2 important details : 
in the xml tags, we don&#039;t want to display the TableName so it is important to extract only the last word in the GetFieldName. Also note the use of the underscore character as a suffix to the name of the calculation fields. RightWords will ignore this special character so we have to be careful not to use a regular character as this would necessitate an unnecessary longer formula to extract the correct text.
Also, since the calculation fields have stored results, it is better to create all the fieds before populating the database. If you have to add or rename fields afterwards, you can force the updating with a Replace command on the source field (replace the source field by the sourcefield calculation).
Sorry for the long explanation.</description>
		<content:encoded><![CDATA[<p>Hello Geoff,<br />
The idea of automatic xml tags creation works fine.<br />
I already know about xml exportation with FileMaker but this method, IMHO, combined with loops in scripts, gives a lot of flexibility. What I like is the fact that, since the formula is based on the FieldName, it never needs to be edited (that&#8217;s a complex solution for a lazy person). I hope that it will be useful to others as it would have been to me in some projects.<br />
Here is an example :<br />
Define 2 text fields : FirstName and LastName<br />
(make sure that their name is the same as the xml tag name).<br />
Then define a first calculation field: FirstName_<br />
(it has the very same name as the target source field followed by an underscore)<br />
The calculation is as follows:</p>
<pre><code>IIf ( not IsEmpty ( GetField(Left(GetFieldName ( Self);Length(GetFieldName ( Self)) -1)) ) ;
                        "&lt;" &amp; RightWords(GetFieldName ( Self);1) &amp; "&gt;"
                        &amp; GetField(Left(GetFieldName ( Self);Length(GetFieldName ( Self)) -1))
                        &amp; "&lt;/" &amp; RightWords(GetFieldName ( Self);1) &amp; "&gt;" ; "" )
</code></pre>
<p>The result must be text and (unfortunately?) the result must be stored if we want anything to show.<br />
We can now duplicate the FirstName_ field and rename it LastName_ and we don&#8217;t have to modify the formula.<br />
As a result, if the FirstName field contains Geoff, the FirstName_ field will show:</p>
<pre><code>&lt;FirstName&gt;Geoff&lt;/FirstName&gt;</code></pre>
<p>2 important details :<br />
in the xml tags, we don&#8217;t want to display the TableName so it is important to extract only the last word in the GetFieldName. Also note the use of the underscore character as a suffix to the name of the calculation fields. RightWords will ignore this special character so we have to be careful not to use a regular character as this would necessitate an unnecessary longer formula to extract the correct text.<br />
Also, since the calculation fields have stored results, it is better to create all the fieds before populating the database. If you have to add or rename fields afterwards, you can force the updating with a Replace command on the source field (replace the source field by the sourcefield calculation).<br />
Sorry for the long explanation.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

