<?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 Philadelphia FileMaker User Group - serving the Pennsylvania, New Jersey and Delaware Region &#187; Tips and tricks</title>
	<atom:link href="http://www.phillyfilemaker.org/index.php/category/tips-and-tricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phillyfilemaker.org</link>
	<description>We’re a FileMaker User Group serving the Pennsylvania, New Jersey and Delaware Region</description>
	<lastBuildDate>Mon, 30 Jan 2012 18:34:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>FM Academy Webinar January 18th &#8211; Our own Jerry Salem!</title>
		<link>http://www.phillyfilemaker.org/index.php/2012/01/fm-academy-webinar-this-afternoon/</link>
		<comments>http://www.phillyfilemaker.org/index.php/2012/01/fm-academy-webinar-this-afternoon/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 16:09:01 +0000</pubDate>
		<dc:creator>Colin Keefe</dc:creator>
				<category><![CDATA[Tips and tricks]]></category>
		<category><![CDATA[Training]]></category>
		<category><![CDATA[Content Management Systems]]></category>
		<category><![CDATA[FM Academy]]></category>
		<category><![CDATA[Jerry Salem]]></category>

		<guid isPermaLink="false">http://www.phillyfilemaker.org/?p=2425</guid>
		<description><![CDATA[For those of you who don’t know, Philly FileMaker’s sponsor, IT Solutions Consulting, has partnered with 360Works, MightyData, Anvil Dataworks, Fiddlehead Software, Skeleton Key and Kyo Logic on a new initiative called FM Academy, which has been producing free webinars whose purpose is to further educate FileMaker users and developers to encourage best practices, and [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you who don’t know, Philly FileMaker’s sponsor, <a href="http://www.itsolutions-inc.com/" target="_blank">IT Solutions Consulting</a>, has partnered with 360Works, MightyData, Anvil Dataworks, Fiddlehead Software, Skeleton Key and Kyo Logic on a new initiative called <a href="www.filemakeracademy.com" target="_blank">FM Academy</a>, which has been producing free webinars whose purpose is to further educate FileMaker users and developers to encourage best practices, and to foster further adoption of the software.</p>
<p>Why post it here?  Well, PFUG regulars will be very familiar with our own Jerry Salem, who will be hosting a webinar January 18th at 2 PM EST, called <strong>Playing Nicely with Others &#8211; FileMaker and Content Management Systems</strong>.</p>
<p>There’s still time to register!  Go here for details:</p>
<p><a href="http://www.filemakeracademy.com/?page_id=49" target="_blank">http://www.filemakeracademy.com/?page_id=49</a></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'FM Academy Webinar January 18th &amp;#8211; Our own Jerry Salem! on The Philadelphia FileMaker User Group - serving the Pennsylvania, New Jersey and Delaware Region',url: 'http://www.phillyfilemaker.org/index.php/2012/01/fm-academy-webinar-this-afternoon/',contentID: 'post-2425',suggestTags: 'Content Management Systems,FM Academy,Jerry Salem',providerName: 'The Philadelphia FileMaker User Group - serving the Pennsylvania, New Jersey and Delaware Region',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.phillyfilemaker.org/index.php/2012/01/fm-academy-webinar-this-afternoon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crossing Drupal Street IV</title>
		<link>http://www.phillyfilemaker.org/index.php/2011/10/crossing-drupal-street-iv/</link>
		<comments>http://www.phillyfilemaker.org/index.php/2011/10/crossing-drupal-street-iv/#comments</comments>
		<pubDate>Mon, 10 Oct 2011 15:26:00 +0000</pubDate>
		<dc:creator>Jerry Salem</dc:creator>
				<category><![CDATA[FileMaker]]></category>
		<category><![CDATA[Integration]]></category>
		<category><![CDATA[Tips and tricks]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Jerry Salem]]></category>

		<guid isPermaLink="false">http://www.phillyfilemaker.org/?p=1200</guid>
		<description><![CDATA[The last couple of installments were about understanding the basics of what makes a Drupal web site.  We covered nodes, views, and plugins, among other things.  We didn&#8217;t go unnoticed either.  While at the 2011 DevCon, I was featured on an episode of FileMaker Success Tips. This week we are going to look at the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.phillyfilemaker.org/wp-content/uploads/2011/10/Logo.png"><img class="aligncenter size-medium wp-image-2376" src="http://www.phillyfilemaker.org/wp-content/uploads/2011/10/Logo-300x120.png" alt="" width="300" height="120" /></a>The last couple of installments were about understanding the basics of <a title="Crossing Drupal Street III" href="http://www.phillyfilemaker.org/index.php/2011/06/crossing-drupal-street-iii/" target="_blank">what makes a Drupal web site</a>.  We covered nodes, views, and plugins, among other things.  We didn&#8217;t go unnoticed either.  While at the <a href="http://www.filemaker.com/devcon">2011 DevCon</a>, I was featured on an <a title="Filemaker Success Tips Drupal Episode" href="http://traffic.libsyn.com/fmsuccesstips/FM_Success_Tips_DEVCON2011c.mp3" target="_blank">episode</a> of <a href="http://www.facebook.com/pages/Filemaker-Success-Tips-Podcast/132104049047" target="_blank">FileMaker Success Tips</a>.</p>
<p>This week we are going to look at the integration of a Drupal web site and a FileMaker database.  We had a client with a specific need; an art school that offers classes to adults in their community.  They have a FileMaker back-end database that they use for registration and membership.  They also have a web site where people can view class offerings and enroll in classes.  The client would like to create a way to link these two independent databases.</p>
<p><span id="more-1200"></span>There are two points where the two systems touch each other: presenting the classes offered for a given semester and the registration of students into specific classes.  The client and I decided to leave the first goal for the moment, and concentrate on the second goal of getting the registration data into FileMaker.</p>
<p>I am not working in a vacuum, of course, as there is already a workflow in place.  The accountant logs into their PayPal portal and does a screen print of the daily transactions.  This is handed off to a secretary who keys the information into the FileMaker database.</p>
<p>My suggestion to the client was to remove the excess printing and keystroke entry.  The workflow I suggested was:</p>
<ol>
<li>A user (the secretary who used to key the data into FileMaker) clicks a button and is shown a list view of transactions from the web site.</li>
<li>The user then navigates to each record in turn and checks the student registering for the class.  Are they currently in the FileMaker database?  If they are, compare the existing FileMaker data with the data that the student entered on the site. Does the data match, has the address updated? etc.  Or is the student new to the school?  If so, add the student to the FileMaker database.</li>
<li>After reviewing the data entered on the web site, the user creates a new Order in the FileMaker and imports all the data.  If there is a problem with the transaction, it is flagged for follow up later.</li>
</ol>
<p>PROPOSED METHOD</p>
<p>The first thing to do is figure out how to view the registration data from inside the database.  There are two basic ways to do this: import the web data into temporary tables or directly view the data using ESS.  I chose the second method.  The client is using a Drupal plugin called UberCart to manage the registrations.  This plugin is very popular for Drupal sites that sell things; this site is no exception.  Viewing MySQL data using ESS has been <a href="http://www.phillyfilemaker.org/index.php/2010/06/please-join-us-june-22nd-using-filemaker-as-a-sql-front-end/">covered before</a> but one think I needed to discover for myself was the data structure for UberCart.  This was done by trial and error, reading the documentation, and asking knowledgeable people.  Eventually I came up with this realtionship graph of the UberCart tables:</p>
<p style="text-align: center;"><a href="http://www.phillyfilemaker.org/wp-content/uploads/2011/09/AnnotatedRelationships.png"><img class="aligncenter size-medium wp-image-2339" style="border-width: 1px; border-color: black; border-style: solid;" src="http://www.phillyfilemaker.org/wp-content/uploads/2011/09/AnnotatedRelationships-300x202.png" alt="" width="300" height="202" /></a></p>
<p>UberCart explanation;  The base table for the Order (or Invoice) is called uc_Order.  Each LineItem is in the uc_XXX table.  The table that has the products, i.e. the things that are sold (in this case classes) are in the uc_Products table.</p>
<p>When integrating with Drupal it is easy to get burned by placing your own fields in the native Drupal tables.  This is not a good practice.  In most situations, you don&#8217;t have much control over the Drupal site.  The administrator may not give you permission to create fields, and since plugins get updated all the time, they may rewrite the Drupal table and you would lose your custom fields.  If you need to create custom fields, do them in your FileMaker database.  To do this you may need to create a special table with a one-to-one relationship to the Drupal table.</p>
<p style="text-align: center;"><a href="http://www.phillyfilemaker.org/wp-content/uploads/2011/09/UtilityTable.png"><img class="aligncenter size-medium wp-image-2341" style="border-width: 1px; border-color: black; border-style: solid;" src="http://www.phillyfilemaker.org/wp-content/uploads/2011/09/UtilityTable-300x149.png" alt="" width="300" height="149" /></a></p>
<p>In our case, I needed to create a table (Called zWebOrderLineItems, highlighted above)  to hold the status of each registration from the web site (the Status field), and to hold the FileMaker ID of the student taking the class (_kf_ContactID).  From the utility table we can make a relationship to the native FileMaker table holding the students in our database.</p>
<p>WORKFLOW</p>
<p>Once I had figured out the relationships between all the various tables in UberCart, then the rest was just FileMaker.  The workflow looked like this:</p>
<ol>
<li>The user clicks on button on home page.</li>
<li>He/she is taken to a list view of the Web Orders that need to be processed.</li>
<li>The user clicks on the first order and confirms that the student is in the FileMaker database.</li>
<li>If the student is not in the database, the user clicks a button to add the student.</li>
<li>If the student is in the database, the data (address, DOB, cell phone, etc.) is confirmed as correct or updated.</li>
<li>The user clicks a button to create a new invoice.</li>
<li>Then, the user goes to next Order in list.</li>
</ol>
<p>Here is an illustration of the user interface.  The left side is all info from the Drupal site.  The right side is the corresponding info for that student in the FileMaker database.</p>
<p>&nbsp;</p>
<p style="text-align: center;"><a href="http://www.phillyfilemaker.org/wp-content/uploads/2011/09/InterfaceAnnotatted.png"><img class="aligncenter size-medium wp-image-2345" style="border-width: 1px; border-color: black; border-style: solid;" src="http://www.phillyfilemaker.org/wp-content/uploads/2011/09/InterfaceAnnotatted-300x154.png" alt="" width="300" height="154" /></a></p>
<p>DISCUSSION</p>
<p>Creating an ESS link from the Drupal web site to the client&#8217;s back-end FileMaker database has certainly made their job easier.  Now students are registered for classes in near real-time.  Before the integration, registrations were done in batch mode the day after the registrations were entered on the web site.  Using a server side script, the main page in the database checks for new web orders and alerts the users within 5 minutes of record creation.  In addition, the registrations are entered into the database using two button clicks, instead of completely re-keying all of the information by hand.</p>
<p>Having a user review the data before it goes into the database is always a good idea.  Unlike using FileMaker as an interface, you don&#8217;t have the same control over data input in a web application.  For example, a user may put in their address as Rock Ln., while your business rule (or your direct mail service) may require addresses to be spelled out, i.e. Rock Lane.  In addition, user review will let you have the user search your database for existing fuzzy matches (I may be in the database as Jerome Salem, but registered for a class as Jerry Salem) where you wouldn&#8217;t want your database to be freely searchable on the web!  For these reasons, I would always recommend a &#8220;scrubber layer&#8221; between any external database and your in-house database.</p>
<p>Finally, this technique allows both systems to do what they do well, with minimal amount of interaction between the two.  In this case the data flow is one-way, from Drupal into the FileMaker database.  Next time we will look at the opposite, letting data flow from the back-end database into Drupal.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Crossing Drupal Street IV on The Philadelphia FileMaker User Group - serving the Pennsylvania, New Jersey and Delaware Region',url: 'http://www.phillyfilemaker.org/index.php/2011/10/crossing-drupal-street-iv/',contentID: 'post-1200',suggestTags: 'Drupal,Integration,Jerry Salem',providerName: 'The Philadelphia FileMaker User Group - serving the Pennsylvania, New Jersey and Delaware Region',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.phillyfilemaker.org/index.php/2011/10/crossing-drupal-street-iv/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://traffic.libsyn.com/fmsuccesstips/FM_Success_Tips_DEVCON2011c.mp3" length="0" type="audio/mpeg" />
		</item>
		<item>
		<title>Graph Data Not in a Row</title>
		<link>http://www.phillyfilemaker.org/index.php/2011/08/graph-data-not-in-a-row/</link>
		<comments>http://www.phillyfilemaker.org/index.php/2011/08/graph-data-not-in-a-row/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 15:00:16 +0000</pubDate>
		<dc:creator>Jerry Salem</dc:creator>
				<category><![CDATA[FileMaker]]></category>
		<category><![CDATA[Tips and tricks]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[Jerry Salem]]></category>

		<guid isPermaLink="false">http://www.phillyfilemaker.org/?p=2024</guid>
		<description><![CDATA[The addition of charting in FileMaker version 11 was a long overdue and welcome addition. I don&#8217;t want to look a gift horse in the mouth. This tool is great at showing histograms of grouped data, but there are a couple of things that are more challenging to do with this feature. Problem In this [...]]]></description>
			<content:encoded><![CDATA[<p>The addition of charting in FileMaker version 11 was a long overdue and welcome addition. I don&#8217;t want to look a <a title="look a gift horse in the mouth" href="http://en.wiktionary.org/wiki/don't_look_a_gift_horse_in_the_mouth" target="_blank">gift horse in the mouth</a>. This tool is great at showing histograms of grouped data, but there are a couple of things that are more challenging to do with this feature.</p>
<p><strong><span id="more-2024"></span>Problem</strong></p>
<p><strong></strong>In this episode, I will present a technique to show data that is not evenly spaced. As a typical example we are going to look at pricing data. For our example, we are building a solution for a company that sells items. The items are sold at a particular price that is entered into the database. However, the price changes over time. Our task is to present the user with a graph of the longitudinal price changes. As you read through this canonical example, keep in mind we can use the same technique for any variable that changes over time. Here are some other examples where this would be useful: a student&#8217;s test scores, the number of orders a customer has placed, a patient&#8217;s blood pressure, or the number of times a product has been ordered. Basically any data that is related to the parent record and changes over time. Here is the data we are going to be working with. These are the dates when new pricing has been implemented over the past year for a product:</p>
<p style="text-align: center;"><a href="http://www.phillyfilemaker.org/wp-content/uploads/2011/06/Data.png"><img class="aligncenter size-full wp-image-2139" style="border-width: 1px; border-color: black; border-style: solid;" src="http://www.phillyfilemaker.org/wp-content/uploads/2011/06/Data.png" alt="" width="176" height="252" /></a></p>
<p>One might argue that showing the data in a portal like this is all you really need. In many cases I agree with the &#8220;less is more&#8221; motif. However, you can sometimes learn more from the graphed data than from just looking at the data in a table. First, let&#8217;s just graph the data using the new FileMaker Charts tool:</p>
<p style="text-align: center;"><a href="http://www.phillyfilemaker.org/wp-content/uploads/2011/06/SimpleGraph1.png"><img class="aligncenter size-medium wp-image-2142" style="border-width: 1px; border-color: black; border-style: solid;" src="http://www.phillyfilemaker.org/wp-content/uploads/2011/06/SimpleGraph1-290x300.png" alt="" width="290" height="300" /></a></p>
<p>If you don&#8217;t look closely at the X (horizontal) axis, you may conclude from this graph that the price has gone up steadily over the past year. Here is the data presented with the correct X axis (I will call this &#8220;spaced data&#8221;):</p>
<p style="text-align: center;"><a href="http://www.phillyfilemaker.org/wp-content/uploads/2011/06/SpacedData.png"><img class="aligncenter size-medium wp-image-2141" style="border-width: 1px; border-color: black; border-style: solid;" src="http://www.phillyfilemaker.org/wp-content/uploads/2011/06/SpacedData-289x300.png" alt="" width="289" height="300" /></a></p>
<p>From the spaced data, it is much easier to see a couple of trends that were not obvious from looking at the table data or the simple bar graph. First, you can see that there were way more price changes in the first half of the year than in the second half of the year. Second, since about May 2011 the price was relatively stable; the price only changed 3 times and stayed at about $60. Performing this type of analysis can be invaluable for the end users of the database. There are a couple of steps to do to present data in this way. It isn&#8217;t too hard once you have done it a couple of times. <strong>Method</strong> <strong></strong>In order to present the data that is spaced properly (as in the &#8220;spaced data&#8221; graph) we need to be able to tell the database that the date values are actually part of a larger picture. To do that we need to build a &#8220;helper table&#8221; of date values. In the <a href="http://www.phillyfilemaker.org/wp-content/uploads/2011/06/GraphEx.zip" target="_blank">example file</a>, the table is called Daily. It has a minimum number of fields: a serial number key field (probably not needed, but it is a good habit to have a key field in all tables), a date, a number field set to global storage, and a display calculation showing just the month name from the date field. For this table, you will need to do some maintenance to make sure the dates are always up to date. Typically I would run a server side script that creates new date record every day. What we are really going to plot along the X axis are these date records. The Y values will be the pricing data. Here is how everything is related: <a href="http://www.phillyfilemaker.org/wp-content/uploads/2011/06/Relationship.jpg"><img class="aligncenter size-full wp-image-2156" src="http://www.phillyfilemaker.org/wp-content/uploads/2011/06/Relationship.jpg" alt="" width="561" height="167" /></a>The Item table is related to the Pricing table using the &#8220;item_PRICING&#8221; table occurrence, this makes the portal shown at the beginning of this post. The X axis is the daily records that fall between a Max and Min date. Those dates are in the global date fields gStart and gEnd and are set in the background using a script trigger (although you could set them manually). This is represented by the item_DAILY table occurrence. Finally the Y axis data is that Pricing data that corresponds to the date record and the Item record we are on. To make that relationship we have a helper global field in the Daily table (gLink) which is also set via the script trigger. The Y data is represented by the item_Daily_PRICING table occurrence. Here is the detail for the item_Daily relationship. I am including this, since it usually trips me up too.</p>
<p>&nbsp;</p>
<p style="text-align: center;"><a href="http://www.phillyfilemaker.org/index.php/2011/08/graph-data-not-in-a-row/relationshipdetail1-2/" rel="attachment wp-att-2246"><img class="aligncenter size-full wp-image-2246" style="border-width: 1px; border-color: black; border-style: solid;" src="http://www.phillyfilemaker.org/wp-content/uploads/2011/07/RelationshipDetail1.png" alt="item_DAILY Detail" width="548" height="362" /></a></p>
<p>&nbsp;</p>
<p>Here is the setup for the actual graph. There are a couple of interesting points here. The data in the horizontal axis is &#8220;filtered&#8221; so only the first day of each month shows a value. Depending on the date range you may want to just show every date. The Y axis is the data from the item_daily_PRICING table. The table object is on a layout linked to the Item TO. Note that we are graphing data from the related table &#8216;item_DAILY&#8217;.</p>
<p style="text-align: center;"><a href="http://www.phillyfilemaker.org/index.php/2011/08/graph-data-not-in-a-row/spaceddatachartsetup/" rel="attachment wp-att-2247"><img class="aligncenter size-full wp-image-2247" style="border-width: 1px; border-color: black; border-style: solid;" src="http://www.phillyfilemaker.org/wp-content/uploads/2011/07/SpacedDataChartSetup.png" alt="Spaced Data Chart Setup" width="465" height="279" /></a></p>
<p>For all this to work, three things need to be set on record load. In the current (Item) table, we need to set the date range for the X axis of the graph. This would probably be the Max and Min of the dates of the things you want to graph (in this case, the dates from the item_PRICING relationship). I set my Min date to the last day of the month before the minimum date, and the Max to the second day of the month after the maximum date. This is just so my fancy axis labels look nice. Also you need to set the &#8216;helper global&#8217; in the Daily table to be the current item key value.</p>
<p style="text-align: center;"><a href="http://www.phillyfilemaker.org/index.php/2011/08/graph-data-not-in-a-row/script-2/" rel="attachment wp-att-2160" target="_blank"><img class="aligncenter size-full wp-image-2160" style="border-width: 1px; border-color: black; border-style: solid;" src="http://www.phillyfilemaker.org/wp-content/uploads/2011/06/Script1.jpg" alt="Set Globals on Record Load" width="492" height="209" /></a></p>
<p>Once these are all set, the graph will look something like this:</p>
<p>&nbsp;</p>
<p style="text-align: center;"><a href="http://www.phillyfilemaker.org/index.php/2011/08/graph-data-not-in-a-row/formview/" rel="attachment wp-att-2157" target="_blank"><img class="aligncenter size-full wp-image-2157" style="border-width: 1px; border-color: black; border-style: solid;" src="http://www.phillyfilemaker.org/wp-content/uploads/2011/06/FormView.jpg" alt="Form View" width="495" height="273" /></a></p>
<p style="text-align: left;">This technique is a bit trickier than the <a title="We can Sort it out" href="http://www.phillyfilemaker.org/index.php/2011/03/we-can-sort-it-out/" target="_blank">sorting</a> or <a title="Use “Set Window Title” Script Step to Give Users Feedback on What They’re Waiting For" href="http://www.phillyfilemaker.org/index.php/2011/02/use-set-window-title-script-step-to-give-users-feedback-on-what-theyre-waiting-for/" target="_blank">setting a window title</a> tips presented earlier on this forum, it is definitely worth the trouble. You can get the <a href="http://www.phillyfilemaker.org/wp-content/uploads/2011/06/GraphEx.zip">demo file</a> to get more details on the X axis labels.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Graph Data Not in a Row on The Philadelphia FileMaker User Group - serving the Pennsylvania, New Jersey and Delaware Region',url: 'http://www.phillyfilemaker.org/index.php/2011/08/graph-data-not-in-a-row/',contentID: 'post-2024',suggestTags: 'design,Jerry Salem',providerName: 'The Philadelphia FileMaker User Group - serving the Pennsylvania, New Jersey and Delaware Region',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.phillyfilemaker.org/index.php/2011/08/graph-data-not-in-a-row/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Navigating to List Views with Summary Parts</title>
		<link>http://www.phillyfilemaker.org/index.php/2011/07/navigating-to-list-views-with-summary-parts/</link>
		<comments>http://www.phillyfilemaker.org/index.php/2011/07/navigating-to-list-views-with-summary-parts/#comments</comments>
		<pubDate>Mon, 25 Jul 2011 15:45:44 +0000</pubDate>
		<dc:creator>Jerry Salem</dc:creator>
				<category><![CDATA[FileMaker]]></category>
		<category><![CDATA[Tips and tricks]]></category>
		<category><![CDATA[FileMaker 11]]></category>
		<category><![CDATA[Jerry Salem]]></category>

		<guid isPermaLink="false">http://www.phillyfilemaker.org/?p=2055</guid>
		<description><![CDATA[Here is a behavior I am not fond of. When I click on a button to go to a list, I expect to be at the top of the list on the first record.  This works fine if you are using any version of FileMaker.  However with version 10, Filemaker introduced a new wrinkle, sub-summary [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a behavior I am not fond of. When I click on a button to go to a list, I expect to be at the top of the list on the first record.  This works fine if you are using any version of FileMaker.  However with version 10, Filemaker introduced a new wrinkle, sub-summary layout parts that are visible in Browse mode.  This wonderfully useful feature did introduce one unexpected consequence.</p>
<p><span id="more-2055"></span>Run this code snippet to navigate to a list view containing a sub-summary to illustrate my point.</p>
<p><code>Goto layout (List view with Sub Summaries)<br />
Sort<br />
Goto Record[First]</code></p>
<p>When the user does this the first record is at the top of the list.  But the first sub summary is not visible, until the user moves the scroll bar.  This is especially evident if the user has a couple of screens full of records in the list.</p>
<p><a title="ListView by phillyfilemaker, on Flickr" href="http://www.flickr.com/photos/34739032@N07/5783969625/"><img style="border: 1px solid black;" src="http://farm6.static.flickr.com/5226/5783969625_dbb7c1f536.jpg" alt="ListView" width="397" height="500" /></a></p>
<p>the result SHOULD look like this</p>
<p><a title="ListBetter by phillyfilemaker, on Flickr" href="http://www.flickr.com/photos/34739032@N07/5784524800/"><img style="border: 1px solid black;" src="http://farm3.static.flickr.com/2087/5784524800_0f175eaa6d.jpg" alt="ListBetter" width="386" height="500" /></a></p>
<p>To solve this is not too hard.  actually it only takes two script steps.</p>
<p><span style="font-family: monospace;">Goto layout (List view with Sub Summaries)<br />
</span><span style="font-family: monospace;">Sort<br />
</span><span style="font-family: monospace;">Show Record[First]<br />
</span><span style="font-family: monospace;">Enter Preview Mode[]<br />
</span><span style="font-family: monospace;">Enter Browse Mode[] </span></p>
<div>Attached is a <a href="http://www.phillyfilemaker.org/wp-content/uploads/2011/05/ListEx.zip">sample file</a> illustrating the point.  Note that this is not the type of issue that pops up with any regularity.  For example, if you have happened to selected the first record in a found set, or any record that will be on the first screen full of data, then the sub summary will appear at the top of the list.  Also smaller sets of data don&#8217;t reveal this behavior.  Therefore you wouldn&#8217;t see this issue till untill after development, and your database really gets filled with data.</div>
<p>&nbsp;</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Navigating to List Views with Summary Parts on The Philadelphia FileMaker User Group - serving the Pennsylvania, New Jersey and Delaware Region',url: 'http://www.phillyfilemaker.org/index.php/2011/07/navigating-to-list-views-with-summary-parts/',contentID: 'post-2055',suggestTags: 'FileMaker 11,Jerry Salem',providerName: 'The Philadelphia FileMaker User Group - serving the Pennsylvania, New Jersey and Delaware Region',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.phillyfilemaker.org/index.php/2011/07/navigating-to-list-views-with-summary-parts/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Dial My Database</title>
		<link>http://www.phillyfilemaker.org/index.php/2011/07/dial-my-database/</link>
		<comments>http://www.phillyfilemaker.org/index.php/2011/07/dial-my-database/#comments</comments>
		<pubDate>Tue, 05 Jul 2011 14:50:08 +0000</pubDate>
		<dc:creator>Jerry Salem</dc:creator>
				<category><![CDATA[FileMaker Go]]></category>
		<category><![CDATA[Tips and tricks]]></category>
		<category><![CDATA[FileMaker GO]]></category>
		<category><![CDATA[Jerry Salem]]></category>

		<guid isPermaLink="false">http://www.phillyfilemaker.org/?p=2147</guid>
		<description><![CDATA[For the past few weeks I have been thinking about our last Philly FileMaker user group meeting back in May.  It was all about connecting your database to other services and extending your information to contacts and calendars outside of your database.  Imagine being able to dial a phone number right from your database!  How positively [...]]]></description>
			<content:encoded><![CDATA[<p>For the past few weeks I have been thinking about our last Philly FileMaker <a title="4/26/11 Meeting Video: John Sindelar and Jesse Barnum – Zulu iCal Server and Docubin" href="http://www.phillyfilemaker.org/index.php/2011/05/42611-meeting-video-john-sindelar-and-jesse-barnum-zulu-ical-server-and-docubin/" target="_blank">user group meeting</a> back in May.  It was all about connecting your database to other services and extending your information to contacts and calendars outside of your database.  Imagine being able to dial a phone number right from your database!  How positively retro.</p>
<p><img class="alignnone" src="http://3.bp.blogspot.com/_TIYbd3YykdQ/SEarfWt9dMI/AAAAAAAAAFk/kP0kYYsHSmE/s400/bat-phone.jpg" alt="" width="336" height="228" /></p>
<p><span id="more-2147"></span>I remember designing databases in the <a href="http://en.wikipedia.org/wiki/1990s">1990&#8242;s</a> that would let you do exactly that.  It was only for very forward thinking companies back then.  Shortly after that phones became way more complicated for this to be really practical.</p>
<p><em>Then came the <a href="http://www.apple.com/iphone/">iPhone</a> and <a href="http://www.filemaker.com/products/filemaker-go/">Filemaker GO</a>. Once again, it is practical to dial a phone number directly from a database.</em></p>
<p>There are two script steps you can accomplish this: Dial Phone or Open URL.  Both script steps work the same as far as I can tell, but in either method the trick is that a phone number needs to be referenced as just digits.  You must first remove anything that isn&#8217;t a number. For example, a phone number field that has the contents 215-555-1234 will not dial correctly.   In FileMaker you can strip non-numeric characters out of the phone number using the Filter function.</p>
<p>Here is an example script using the Dial Phone and one using Open URL:</p>
<p style="text-align: center"><a href="http://www.phillyfilemaker.org/wp-content/uploads/2011/06/Script.jpg"><img class="aligncenter size-medium wp-image-2150" style="border: 1px solid black" src="http://www.phillyfilemaker.org/wp-content/uploads/2011/06/Script-300x176.jpg" alt="" width="300" height="176" /></a><a href="http://www.phillyfilemaker.org/wp-content/uploads/2011/06/Script2.jpg"><img class="aligncenter size-medium wp-image-2151" style="border: 1px solid black" src="http://www.phillyfilemaker.org/wp-content/uploads/2011/06/Script2-300x102.jpg" alt="" width="300" height="102" /></a></p>
<p>Attach a script like one of these examples to a button next to a phone number and you are on your way.  If anyone knows any functional difference between Dial Phone or Open URL and when one is more appropriate than the other please leave a comment or drop me a line.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Dial My Database on The Philadelphia FileMaker User Group - serving the Pennsylvania, New Jersey and Delaware Region',url: 'http://www.phillyfilemaker.org/index.php/2011/07/dial-my-database/',contentID: 'post-2147',suggestTags: 'FileMaker GO,Jerry Salem,Tips and tricks',providerName: 'The Philadelphia FileMaker User Group - serving the Pennsylvania, New Jersey and Delaware Region',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.phillyfilemaker.org/index.php/2011/07/dial-my-database/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Tracking Changes in Your Database</title>
		<link>http://www.phillyfilemaker.org/index.php/2011/07/tracking-changes-in-your-database/</link>
		<comments>http://www.phillyfilemaker.org/index.php/2011/07/tracking-changes-in-your-database/#comments</comments>
		<pubDate>Fri, 01 Jul 2011 12:00:00 +0000</pubDate>
		<dc:creator>Jerry Salem</dc:creator>
				<category><![CDATA[FileMaker]]></category>
		<category><![CDATA[Tips and tricks]]></category>
		<category><![CDATA[development practices]]></category>
		<category><![CDATA[FileMaker 10]]></category>
		<category><![CDATA[FileMaker 11]]></category>
		<category><![CDATA[Jerry Salem]]></category>

		<guid isPermaLink="false">http://www.phillyfilemaker.org/?p=911</guid>
		<description><![CDATA[A nice tip for displaying record modification]]></description>
			<content:encoded><![CDATA[<p>Everyone likes a good story, even one that relates to a database. When you are working with a database that is shared among different users you will eventually see this scene, or perhaps experience it yourself:</p>
<p>You, or someone else, are staring at the computer screen looking at a record that has changed since the last time you looked at it and you mutter to yourself, &#8220;Who changed this record?  This is not the same as the last time I looked at it!&#8221;</p>
<p>An audit log is like looking at a record through time.  It will let you trace any changes that have been made on a piece of data in your database.  For example, in a contact management system an audit log will let you see address changes over time for a particular person.  You can use an audit log in an ordering system to track changes made to each invoice over time.  It is also an important tool for determining workflow processes. Remember the old adage, &#8220;who what when where why and how&#8221;.  Who changed this record? What data was changed? When was it changed? Why was it changed?and How?  An audit log can tell you all of these things (except probably the &#8220;Why&#8221;).</p>
<p><span id="more-911"></span>There are many tools around the web availible for building audit logs. Here is an technique that <a href="http://fmforums.com/forum/topic/32414-yet-another-audit-trail/" target="_blank">I used to use</a>, and here is a  <a title="CNS Audit" href="http://www.cnsplug-ins.com/Plug-ins/CNS_Audit" target="_blank">commercial</a> product.  My current favorite audit log tool is called <a href="http://www.nightwing.com.au/FileMaker/demosX/demoX01.html">UltraLog</a> from Nightwing Enterprises and is the basis for the rest of this article.</p>
<p style="text-align: center;"><img class="aligncenter" style="border: 1px solid black;" src="http://www.nightwingenterprises.com/demosX/UltraLog.jpg" alt="" width="512" height="326" /></p>
<p>This tool uses a single field to track changes.  In this field is a concatenated list that shows the changes that have been made to specified fields for the record.  Unlike other methods this technique doesn&#8217;t rely on a separate table to write the changes.  It is simple to use and implement, but there are some drawbacks with this method.  Since it writes the changes directly to the record, it can&#8217;t track deleted records.  This is an unfair criticism, though, as there are plenty of techniques to block record deletion, hide deleted records, or move deleted records to an archive table.  These are all fine ways to take care of this situation.  Keep your eyes on the reason for this technique to simply tell the story of the record.</p>
<p>But what good is an audit trail if you don&#8217;t know where it is?  Depending on the database and situation, there are two ways I will display the audit trail.  Either as a tab, or a pop up.</p>
<p>Almost every database I have seen has Last Modified fields in each table and displayed on layouts.   Why not use this piece of information, but make it more powerful? I do this by making the Modified Date label a button.  When you click that button it brings up the modification history of the record.  This is a subtle and intuitive touch that you can show users once and they will almost always remember that clicking on the Modification date displays the modification history.  The way I do this is also very simple.  I don&#8217;t bother with a script or even a layout for displaying the information.  Make the label a button and set it to bring up a custom dialog box.  Make the title of the box &#8216;Record History&#8217; or something like that.  For the body of the dialog box, use the Modification History field.  Of course you could also use a script and a separate layout which will look much nicer, but take more time.  Here is an example:</p>
<p>&nbsp;</p>
<p style="text-align: center;"><a rel="attachment wp-att-2206" href="http://www.phillyfilemaker.org/index.php/2011/07/tracking-changes-in-your-database/changes2/"><img class="size-full wp-image-2206 aligncenter" style="border: 1px solid black;" title="changes2" src="http://www.phillyfilemaker.org/wp-content/uploads/2011/07/changes2.jpg" alt="Modification Log" width="602" height="320" /></a></p>
<p>If your database incorporates tabs then you have a better option.  Simply make a tab for modification changes.  This is more user friendly and also adds significant advantages.  For example you can do finds for records modified by a certain person, or records modified in a date range.</p>
<p style="text-align: center;"><a rel="attachment wp-att-2208" href="http://www.phillyfilemaker.org/index.php/2011/07/tracking-changes-in-your-database/changes3/"><img class="aligncenter size-full wp-image-2208" style="border: 1px solid black;" title="changes3" src="http://www.phillyfilemaker.org/wp-content/uploads/2011/07/changes3.jpg" alt="Modification Log" width="701" height="258" /></a></p>
<p style="text-align: left;">&nbsp;</p>
<p style="text-align: left;">Here is another example showing how you can display an audit trail for an invoice with line items.  This tab shows the audit trail, along with a portal underneath that shows the invoices for the contact. The portal on the right shows the line items for the selected invoice.</p>
<p style="text-align: center;"><a href="http://www.phillyfilemaker.org/wp-content/uploads/2011/06/Log.png"></a><a rel="attachment wp-att-2209" href="http://www.phillyfilemaker.org/index.php/2011/07/tracking-changes-in-your-database/changes4/"><img class="aligncenter size-full wp-image-2209" style="border: 1px solid black;" title="changes4" src="http://www.phillyfilemaker.org/wp-content/uploads/2011/07/changes4.jpg" alt="Audit Trail" width="690" height="233" /></a></p>
<p>SOMETHING EXTRA</p>
<p>I have also realized that using the UltraLog technique, it is possible to write to the Modification History field in your own scripts.  In the case illustrated (an invoice), when a line item is deleted from the invoice, it also writes to the Modification History field.  As here is the script fragment;</p>
<div>
<p><code>SET VARIABLE [$ItemCode;InvoiceLines::ItemCode]<br />
SET VARIABLE [$Quant; InvoiceLines::Quantity]<br />
SET FIELD[Invoice::AuditLog; get(currentTimeStamp) &amp; " " &amp; get(accountname) &amp; " " &amp; "LineItemDeleted " &amp; $ItemCode &amp; "/" &amp; $Quant &amp; "¶" &amp; Invoice::AuditLog]</code></p>
<p>Insert these lines in the &#8216;Delete invoice line&#8217; script, before the delete line.  Just to keep everything looking nice, you should make the first entries (timestamp, account name, the same.  After that you can enter any data you need too.  This makes it possible to track any type of actions made on a record.</p>
<p>Keeping this technique in mind will make the audit log much more powerful!  So now when you look at a record and say &#8220;Who changed this record!  This is not the same as the last time I looked at it!&#8221;  You can answer the question by clicking on the Modification Date and reading the record&#8217;s story.  Instead of saying &#8220;The database just changed my data&#8221; you can know Who changed What field and When it was changed.  Not quite as good as curling up with a good book, but possibly more informative!</p>
<p>In the next installment, I will show you how you can modify the UltraLog custom function to capture not only field modifications by the users, but also automatic changes performed by users.  I&#8217;ll also use the UltraLog with systems that have a &#8220;roll your own&#8221; security system and doesn&#8217;t make use of native FileMaker accounts.</p>
</div>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Tracking Changes in Your Database on The Philadelphia FileMaker User Group - serving the Pennsylvania, New Jersey and Delaware Region',url: 'http://www.phillyfilemaker.org/index.php/2011/07/tracking-changes-in-your-database/',contentID: 'post-911',suggestTags: 'development practices,FileMaker 10,FileMaker 11,Jerry Salem',providerName: 'The Philadelphia FileMaker User Group - serving the Pennsylvania, New Jersey and Delaware Region',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.phillyfilemaker.org/index.php/2011/07/tracking-changes-in-your-database/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Crossing Drupal Street III</title>
		<link>http://www.phillyfilemaker.org/index.php/2011/06/crossing-drupal-street-iii/</link>
		<comments>http://www.phillyfilemaker.org/index.php/2011/06/crossing-drupal-street-iii/#comments</comments>
		<pubDate>Tue, 28 Jun 2011 12:00:00 +0000</pubDate>
		<dc:creator>Jerry Salem</dc:creator>
				<category><![CDATA[Integration]]></category>
		<category><![CDATA[Tips and tricks]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Jerry Salem]]></category>

		<guid isPermaLink="false">http://www.phillyfilemaker.org/?p=1203</guid>
		<description><![CDATA[This is where it may get hairy&#8230; Compare relationships and querries During the last episode we learned that Drupal is most powerful when the knowledgeable developer uses plug-ins to extend the abilities of the web site.  Some of the most useful plug-ins are CCK (adds the ability to create custom fields), Fivestar (adds a voting widget [...]]]></description>
			<content:encoded><![CDATA[<p><em><strong>This is where it may get hairy&#8230;</strong></em></p>
<p><a title="1490430-Who-needs-pictures-of-cute-kids-1 by phillyfilemaker, on Flickr" href="http://www.flickr.com/photos/34739032@N07/5040102984/"><img style="border: 1px solid black;" src="http://farm5.static.flickr.com/4149/5040102984_171614c732.jpg" alt="1490430-Who-needs-pictures-of-cute-kids-1" width="300" height="289" /></a></p>
<p>Compare relationships and querries</p>
<p>During the <a href="http://www.phillyfilemaker.org/index.php/2010/09/crossing-drupal-ii/">last episode</a> we learned that Drupal is most powerful when the knowledgeable developer uses plug-ins to extend the abilities of the web site.  Some of the most useful plug-ins are CCK (adds the ability to create custom fields), Fivestar (adds a voting widget to your website) and Views (a powerful way to view data from different nodes).  We used the CCK to create a couple of new fields in the Things content type.</p>
<p>This episode we will show a basic technique to display information.  Lets say you want to see a list of content types.  To use FileMaker-speak, lets say you want to see a list of related records.</p>
<p><span id="more-1203"></span>On our test web site, I have created a number of blog entries.  I would like to view just the three most current blog entries in a list on the home page.  If I was doing this in FileMaker I would create a relationship from the base table occurrence of the home layout to the blog table.  And then put a portal on the home layout showing the first three records.  Right now, the web site has nothing on the right side.</p>
<p><a title="StartingPoint by phillyfilemaker, on Flickr" href="http://www.flickr.com/photos/34739032@N07/5118841292/"><img style="border: 1px solid black;" src="http://farm2.static.flickr.com/1091/5118841292_73d13ed930.jpg" alt="StartingPoint" width="500" height="493" /></a></p>
<p>Doing a similar task in Drupal is also a multi step process.  We will first need to use the <strong>Views</strong> plug in to create the relationship or portal.  Then to put it on the home screen, we will use the <strong>Blocks</strong> module to define the block and place it on the home page.  Here are the steps;</p>
<ol>
<li>Create a view of just blog entries (remember, in our web site, we have two content types (i.e. tables), Stories and Things.  We are using Stories for our blog entries</li>
<li>Refine the view to just show the most recent records, and decide on what fields we are going to show</li>
<li>Create a Block to define the object (a link, or a list)</li>
<li>Put the Block on the screen using Menus</li>
</ol>
<p>To navigate to the Views area, and create a new view; select Site Building &#8211;&gt; Views &#8211;&gt; List &#8211;&gt; Add</p>
<p><a title="NewView by phillyfilemaker, on Flickr" href="http://www.flickr.com/photos/34739032@N07/5047999217/"><img style="border: 1px solid black;" src="http://farm5.static.flickr.com/4153/5047999217_75cc65f7d0.jpg" alt="NewView" width="500" height="311" /></a></p>
<p>As before, give the view a Human readable name, a computer readable name, a tag and define the View type.  The default type is Node; that is for just regular tables. If you add new data sources, they will show up on the list too.  This is similar to defining the context of the relationship. What type of data are you going to view?</p>
<p>From here you need to give the View a name, I called mine, &#8216;Recent_Stories&#8217;.  Lets do the most basic setup for the View.  It is a little backwards, but here is what you do; Define Fields then Filters, then go to the basic section for the formatting.  Once the Defaults are done, we can then define new types of displays:  a page and a block.  The workflow goes from column 3, to 4, then 2 and finally 1.<br />
<a title="ViewofRecent_Stories by phillyfilemaker, on Flickr" href="http://www.flickr.com/photos/34739032@N07/5048023691/"><img style="border: 1px solid black;" src="http://farm5.static.flickr.com/4133/5048023691_3ce20985fa.jpg" alt="ViewofRecent_Stories" width="500" height="358" /></a></p>
<ol>
<li>Add F<strong>ields</strong> (define what fields are in the View)</li>
<li><strong>Filter</strong> for just Stories</li>
<li>Add a <strong>Display Type </strong>( for this example a Page)</li>
</ol>
<p>Now that the view is built, we have to put it somewhere.  We are going to add it to the right side of the standard web page.</p>
<p>Select &#8211;&gt; Site building &#8211;&gt; Blocks &#8211;&gt; List  From the admin banner across the top.  Move the Recent_Stories view from the bottom section to the right side, at first I was surprised how slick it is to just drag something.  Then I remembered, this is only novel for a web page.  You could drag and drop things in computer programs since 1984.</p>
<p><a title="MoveBlocks by phillyfilemaker, on Flickr" href="http://www.flickr.com/photos/34739032@N07/5118825042/"><img style="border: 1px solid black;" src="http://farm2.static.flickr.com/1211/5118825042_a1c480e6f5.jpg" alt="MoveBlocks" width="401" height="500" /></a></p>
<p>Using these techniques you can also create views to show more specific information, such as posts with or without comments.  As your site grows you will certainly have many views. You can also pass parameters into the view for more power.  For example, pass the user name to only show posts that were written by the current user.  We will be seeing a lot more of views in future installments <strong>Crossing Drupal</strong>.</p>
<p>Here is a great shot of our progress, the block on the right shows the most recent three posts, I clicked on the first one to show it in the main part of the screen.<a title="Drupal_Block by phillyfilemaker, on Flickr" href="http://www.flickr.com/photos/34739032@N07/5094733015/"><img style="border: 1px solid black;" src="http://farm5.static.flickr.com/4090/5094733015_94616104ea.jpg" alt="Drupal_Block" width="500" height="333" /></a></p>
<p><em>Today&#8217;s big lesson is that Views in Drupal  are similar to relationships in Filemaker</em>.  A view also contains formatting and style information.  You can pass arguments to a view for more control over what the user sees.  The view can be placed on a page using Blocks, or as we will learn next time, using the Menus.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Crossing Drupal Street III on The Philadelphia FileMaker User Group - serving the Pennsylvania, New Jersey and Delaware Region',url: 'http://www.phillyfilemaker.org/index.php/2011/06/crossing-drupal-street-iii/',contentID: 'post-1203',suggestTags: 'Drupal,Integration,Jerry Salem',providerName: 'The Philadelphia FileMaker User Group - serving the Pennsylvania, New Jersey and Delaware Region',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.phillyfilemaker.org/index.php/2011/06/crossing-drupal-street-iii/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FMPHP: Passing an array of values and performance testing on adding records</title>
		<link>http://www.phillyfilemaker.org/index.php/2011/06/fmphp-passing-an-array-of-values-and-performance-testing-on-adding-records/</link>
		<comments>http://www.phillyfilemaker.org/index.php/2011/06/fmphp-passing-an-array-of-values-and-performance-testing-on-adding-records/#comments</comments>
		<pubDate>Tue, 07 Jun 2011 16:02:40 +0000</pubDate>
		<dc:creator>Robin Story</dc:creator>
				<category><![CDATA[FileMaker]]></category>
		<category><![CDATA[Integration]]></category>
		<category><![CDATA[Tips and tricks]]></category>
		<category><![CDATA[createRecord()]]></category>
		<category><![CDATA[newAddCommand()]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.phillyfilemaker.org/?p=2076</guid>
		<description><![CDATA[In my previous post about the difference between the createRecord() and newAddCommand() functions in PHP, Anders Monsen asked in comments: I’ve never tried the createRecord method, but the ability to send an array of field values in the method seems very interesting. How would you format this data in the $values array? $rec =&#38; $fm-&#62;createRecord(‘Form [...]]]></description>
			<content:encoded><![CDATA[<p>In my previous post about the difference between the createRecord() and newAddCommand() functions in PHP, <a href="http://www.mightydata.com/company/team.php">Anders Monsen</a> asked in comments:</p>
<blockquote><p>I’ve never tried the createRecord method, but the ability to send an array of field values in the method seems very interesting. How would you format this data in the $values array?<br />
$rec =&amp; $fm-&gt;createRecord(‘Form View’, $values);<br />
The PHP API lacks good examples of each of the methods in the class, and this post brings attention to an alternate method to set data, though I’m not certain when it might be useful, aside from bypassing the large XML array in the $result. Might be worth a try to see the differences in performance.</p></blockquote>
<p>So two worthy questions, for which I have answers!<span id="more-2076"></span></p>
<p>First off, the $values array.</p>
<p>In the previous example, we had the following code snippet:</p>
<p><code>$fm &amp;= new Filemaker('myDB', 'localhost', 'web', 'web123');<br />
$rec = $fm-&gt;createRecord('web_layout');<br />
$rec-&gt;setField('Name', 'Robin');<br />
$result = $rec-&gt;commit();</code></p>
<p>You could create consecutive lines of setField calls for each field that you wanted to edit. But you could alternately add the fields as an array when you call the createRecord (or newAddCommand) functions.</p>
<p>Here&#8217;s how that would look (I&#8217;m going to use a few extra fields to illustrate).</p>
<p><code>$valuesArray = array('Name' =&gt; 'Robin', 'Year' =&gt; 2011, 'Week' =&gt; '6/5/2011')<br />
$rec = $fm-&gt;createRecord('web_layout'; $valuesArray);<br />
$result = $rec-&gt;commit();</code></p>
<p>FileMaker, in fact, will automatically treat each value as a separate array. When you&#8217;re hand-coding, you don&#8217;t have to do this <em>unless</em> you&#8217;re trying to write to a repeating field &#8212; let&#8217;s say I wanted to make an repeating field to store the haul of veggies I got from this week&#8217;s CSA. So your $valuesArray could in fact look like this:<br />
<code>$valuesArray = array('Name' =&gt; 'Robin', 'Year' =&gt; 2011, 'Week' =&gt; '6/5/2011', 'CSA' =&gt; array('Spinach', 'Lettuce', 'Radishes', 'Arugula', 'Salad Mix'));</code><br />
(Just like when you&#8217;re in a calculation dialog, you want to be careful about closing off your nested arrays, hence the double-thesis at the end!)</p>
<p>PHP has many robust array manipulation functions, and the $_POST and $_GET variables when you submit a form are stored as arrays. With only a little manipulation and careful programming, you could theoretically just dump that $_POST data directly into your new record, a web form with hundreds of fields could process in just a half-dozen or so lines of PHP.</p>
<p>But as to the second question, what is the performance difference between these two commands?</p>
<p>You can&#8217;t really test this on single-record adds: You have to have a respectable amount of data that you can add. At first I thought 300 songs (or about the entire song catalog of The Beatles) would be a good benchmark to test on, but I kept bumping my head on the 30 second maximum execution time (I&#8217;ll see what I can do to beef that up in a future post). So I pared it down to just 150 records.</p>
<p>I whipped up a PHP script to move those songs (song, year or release, album, author(s), lead vocal(s), peak position in both UK and US charts, and notes. Thanks, Wikipedia!) from a .csv file into FileMaker. Once with createRecord() and a bunch of setField() commands, once with createRecord() with the values passed in as an array, once with newAddCommand() and a bunch of setField() commands, and once with newAddCommand() and a value array and a microtime timer to test how long it took each task to complete.</p>
<table border="0" cellspacing="10" align="top">
<tbody>
<tr>
<th>Method</th>
<th>setField()</th>
<th>value array</th>
</tr>
<tr>
<th>createRecord()</th>
<td>22.148</td>
<td>23.916</td>
</tr>
<tr>
<th>newAddCommand()</th>
<td>26.37</td>
<td>25.918</td>
</tr>
</tbody>
</table>
<p>Obviously, 150 records in 30 seconds isn&#8217;t particularly stellar performance, but it is worth pointing out that I am probably not working on an optimal setup. Unsurprisingly, createRecord() appears to have an advantage over newAddCommand (because it&#8217;s a bit more &#8220;trim&#8221; as a function), but I admit I wasn&#8217;t expecting the value array to underperform compared with multiple setField() statements, which I thought would cause incremental execution time run-ups. But as neither the webserver nor the FileMaker server were dedicated solely to this task and may have had to stretch its resources at any time, I would caution against taking this table as the definitive guide to performance on any of these values, and I would urge you to test these methods out on your own and post your results in comments. (For information on how to put a timer on your scripts, check out the <a href="http://us2.php.net/manual/en/function.microtime.php">microtime</a> examples at php.net).</p>
<p>By the way &#8212; did you know you can shave seconds off the processing time by keeping your web-facing layout in form view?</p>
<p><a rel="attachment wp-att-2080" href="http://www.phillyfilemaker.org/index.php/2011/06/fmphp-passing-an-array-of-values-and-performance-testing-on-adding-records/benchmark/">FMPHP add records benchmark sample files</a></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'FMPHP: Passing an array of values and performance testing on adding records on The Philadelphia FileMaker User Group - serving the Pennsylvania, New Jersey and Delaware Region',url: 'http://www.phillyfilemaker.org/index.php/2011/06/fmphp-passing-an-array-of-values-and-performance-testing-on-adding-records/',contentID: 'post-2076',suggestTags: 'createRecord(),FileMaker,newAddCommand(),PHP',providerName: 'The Philadelphia FileMaker User Group - serving the Pennsylvania, New Jersey and Delaware Region',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.phillyfilemaker.org/index.php/2011/06/fmphp-passing-an-array-of-values-and-performance-testing-on-adding-records/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FMPHP: The difference between createRecord() and newAddCommand()</title>
		<link>http://www.phillyfilemaker.org/index.php/2011/05/fmphp-the-difference-between-createrecord-and-newaddcommand/</link>
		<comments>http://www.phillyfilemaker.org/index.php/2011/05/fmphp-the-difference-between-createrecord-and-newaddcommand/#comments</comments>
		<pubDate>Thu, 19 May 2011 20:38:14 +0000</pubDate>
		<dc:creator>Robin Story</dc:creator>
				<category><![CDATA[FileMaker]]></category>
		<category><![CDATA[Integration]]></category>
		<category><![CDATA[Tips and tricks]]></category>
		<category><![CDATA[AddCommand()]]></category>
		<category><![CDATA[createRecord()]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.phillyfilemaker.org/?p=2035</guid>
		<description><![CDATA[If you&#8217;ve been looking at building custom PHP scripts to add records to your FileMaker database, you might have come across the following snippet from the Custom Web Publishing with PHP document: There are two ways to create a record: Use the createRecord() method, specifying a layout name, and optionally specifying an array of field [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve been looking at building custom PHP scripts to add records to your FileMaker database, you might have come across the following snippet from the <a href="http://www.filemaker.com/downloads/pdf/fms9_cwp_php_en.pdf">Custom Web Publishing with PHP document</a>:</p>
<blockquote><p>There are two ways to create a record:</p>
<ul>
<li>Use the createRecord() method, specifying a layout name, and optionally specifying an array of field values. You can also set values individually in the new record object.The createRecord() method does not save the new record to the database. To save the record to the database, call the commit() method.<br />
For example:<br />
<code>$rec =&amp; $fm-&gt;createRecord('Form View', $values);<br />
$result = $rec-&gt;commit();</code></li>
<li>Use the Add command. Use the newAddCommand() method to create a FileMaker_Command_Add object, specifying the layout name and an array with the record data. To save the record to the database, call the execute() method.<br />
For example:<br />
<code>$newAdd =&amp; $fm-&gt;newAddCommand('Respondent', $respondent_data);<br />
$result = $newAdd-&gt;execute();</code></li>
</ul>
</blockquote>
<p>Which is somewhat helpful, but many people wonder what the substantive difference is between these two statements.<span id="more-2035"></span></p>
<p>Honestly, not a whole lot, but there is one important distinction between these two commands. The first indication of difference is in the way the two statements are &#8220;fired off.&#8221; The createRecord() statement is completed with a commit() call, whereas the newAddCommand uses an execute() call.</p>
<p>Let&#8217;s say you had the code<br />
<code><br />
$fm = new Filemaker('myDB', 'localhost', 'web', 'web123');<br />
$rec = $fm-&gt;createRecord('web_layout');<br />
$rec-&gt;setField('Name', 'Robin');<br />
$result = $rec-&gt;commit();<br />
</code></p>
<p>and the code<br />
<code><br />
$fm = new Filemaker('myDB', 'localhost', 'web', 'web123');<br />
$rec = $fm-&gt;newAddCommand('web_layout');<br />
$rec-&gt;setField('Name', 'Robin');<br />
$result = $rec-&gt;execute();<br />
</code></p>
<p>Both would basically perform the same task: They would add a record to the table on web_layout, set the &#8220;Name&#8221; field to &#8220;Robin&#8221;. In both instances, the record will not be created in FileMaker until the $result variable is set, at which point all the fields will be written.</p>
<p>The big difference is what comes back to $result: In createRecord(), result returns a simple integer value letting you know if the add was successful (e.g, 1 if the commit was successful). But for newAddCommand, the $result variable is an array containing a bunch of information about that new record, including the record ID. This means that you could follow that bit of code with this:<br />
<code><br />
$newRecord = current($result-&gt;getRecords());<br />
$recID = $newRecord-&gt;getRecordID();<br />
$serial = $newRecord-&gt;getField('SerialNumber');<br />
echo "&lt;p&gt;The record was added successfully: The new recordID is $recID and the auto-assigned serial number is $serial.&lt;/p&gt;";</code></p>
<p>With createRecord(), there won&#8217;t be much of a handle for you to hold onto if you want to report back on the record that was created. Not the worst thing in the world, certainly, and if you don&#8217;t need it, then there no reason to clutter up your memory space with the massive array that the newAddCommand() will return.</p>
<p>If you&#8217;re curious to see the sort of information that is passed back to the $result, using a <code>echo print_r($result);</code> command after you execute the newAddCommand() statement will give you a good idea of what is being returned, including table structure information!</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'FMPHP: The difference between createRecord() and newAddCommand() on The Philadelphia FileMaker User Group - serving the Pennsylvania, New Jersey and Delaware Region',url: 'http://www.phillyfilemaker.org/index.php/2011/05/fmphp-the-difference-between-createrecord-and-newaddcommand/',contentID: 'post-2035',suggestTags: 'AddCommand(),createRecord(),Integration,PHP',providerName: 'The Philadelphia FileMaker User Group - serving the Pennsylvania, New Jersey and Delaware Region',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.phillyfilemaker.org/index.php/2011/05/fmphp-the-difference-between-createrecord-and-newaddcommand/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Choose the Right Layout</title>
		<link>http://www.phillyfilemaker.org/index.php/2011/05/choose-the-right-layout/</link>
		<comments>http://www.phillyfilemaker.org/index.php/2011/05/choose-the-right-layout/#comments</comments>
		<pubDate>Fri, 06 May 2011 12:00:54 +0000</pubDate>
		<dc:creator>Jerry Salem</dc:creator>
				<category><![CDATA[FileMaker]]></category>
		<category><![CDATA[Tips and tricks]]></category>
		<category><![CDATA[FileMaker 10]]></category>
		<category><![CDATA[FileMaker 11]]></category>
		<category><![CDATA[Jerry Salem]]></category>

		<guid isPermaLink="false">http://www.phillyfilemaker.org/?p=1679</guid>
		<description><![CDATA[Using the script trigger OnLayoutLoad will let you use the built in FileMaker navigation tools.  Your users will thank you!]]></description>
			<content:encoded><![CDATA[<p>Ah the good old days!  Back when the status area was vertical, if you wanted to display a particular layout depending on some conditions, then you needed to create your own navigation buttons.  But face it, those buttons were never as good as the native navigation provided by FileMaker.  Thanks to script triggers we can use the built-in navigation buttons and also conditionally display a particular layout.</p>
<p><span id="more-1679"></span></p>
<h3><strong>Example</strong></h3>
<p>I have a client that is a museum.  They host many events, such as tours for schools or camps, overnight visits for schools, and birthday parties.  All of these events are in a single table.  However each event type has its own layout with different business rules and different groups of fields that need to be filled out.</p>
<p>The client wants to see all of the events in a list view, and also be able to move easily between events in form view.</p>
<p><a title="List of Events by phillyfilemaker, on Flickr" href="http://www.flickr.com/photos/34739032@N07/5333699163/"><img style="margin: 5px; border: 1px solid black;" src="http://farm6.static.flickr.com/5169/5333699163_a32a44fc11.jpg" alt="List of Events" width="300" height="500" /></a></p>
<p>Each type of event has its own layout. As shown in this image:<br />
<a title="DifferentFormViewsForDifferentEvents by phillyfilemaker, on Flickr" href="http://www.flickr.com/photos/34739032@N07/5334314650/"><img style="margin: 5px; border: 1px solid black;" src="http://farm6.static.flickr.com/5088/5334314650_a715d05b69.jpg" alt="DifferentFormViewsForDifferentEvents" width="500" height="196" /></a></p>
<h3><strong>Technique</strong></h3>
<p>Instead of building custom forward and back buttons and hiding the Status Toolbar, use a script trigger to decide what type of event layout to display.  In FileMaker version 10 and later we have new layout options.  Today we will take advantage of OnRecordLoad.  This trigger is a layout trigger, found on the Layout Setup dialog box in the third tab, Script Triggers.</p>
<p>Whenever a new record is selected, or made the active record this script fires.  Here is the script in our example file:</p>
<p><a title="NavigationScript by phillyfilemaker, on Flickr" href="http://www.flickr.com/photos/34739032@N07/5333699319/"><img style="margin: 5px;" src="http://farm6.static.flickr.com/5282/5333699319_9a864bd196.jpg" alt="NavigationScript" width="500" height="365" /></a></p>
<p>Using this new technique we can give regular users the ability to use native FileMaker navigation buttons. In the old days we created our own forward and back buttons and put them on each layout.  If a user happened to open the status area, then there was a good chance he or she would eventually land on the wrong layout for the event being viewed.  This could be a disaster.</p>
<p>There are a couple of things I especially like about this technique.</p>
<p>1) Any time I can use the native FileMaker tools I feel like I am giving my users more of the power that comes with using a FileMaker solution.<br />
2) I don&#8217;t need to reinvent anything.  The status area already has a navigation tool and it works great.</p>
<p>I am posting an <a href="http://www.phillyfilemaker.org/wp-content/uploads/2011/01/NavigationEx.zip">example file</a> so you can get the full experience.  Try going to the form view and click from record to record using the Status Toolbar navigation tool. Enjoy!</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Choose the Right Layout on The Philadelphia FileMaker User Group - serving the Pennsylvania, New Jersey and Delaware Region',url: 'http://www.phillyfilemaker.org/index.php/2011/05/choose-the-right-layout/',contentID: 'post-1679',suggestTags: 'FileMaker 10,FileMaker 11,Jerry Salem',providerName: 'The Philadelphia FileMaker User Group - serving the Pennsylvania, New Jersey and Delaware Region',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.phillyfilemaker.org/index.php/2011/05/choose-the-right-layout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

