Larry’s posterous

Larry  //  

May 31 / 10:38am

FileMaker Bar Charts | free range, organic, sustainable ideas

This looks excellent, and very simple -- not a word that comes to mind with most FM charting solutions. Can't wait to dig into the sample file.

Filed under  //  filemaker  

Comments (0)

Apr 3 / 1:13pm

Quick way to populate a new field across many records

I just learned this, though it's probably been in FileMaker for a long time.  Never seen it any any of the documentation.  In the past, if I needed to add a new text or number field to a table, and wanted it populated with some data, I would show all records and create a script to loop through them, setting the field value with Set Field.  Depending on the number of records it could take up to a half hour. 

But apparently you can create the field as a stored calculation, exit the Manage Database screen, then go back to Manage Database and change the field to Text or Number.  When you exit Manage Database again, the field is now modifiable, but the previously calculated data is still there.  I had no idea.

Filed under  //  filemaker  

Comments (1)

Mar 31 / 10:35pm

Little modification of Sticky Tabs file

Click here to download:
sticky_tabs_v10.fp7 (84 KB)

I downloaded and was toying with the Sticky Tabs demo posted by Brian Ginn of FileMaker Louisville tonight and couldn't put it down.  Using some of the dictionary functions written by Six Fried Rice, and another by Bruce Robertson, I got it working with multiple layouts and multiple tab panel sets.  Still uses just one script and just one global variable.

Here are links to the two posts demoing the dictionary functions from SFR, all of which I have to admit I'm a complete slave to in my own work:

PassParameter (), DictGet() and GetParameter are here, and DictRemove() and DictReplace() are here (there are a couple dependencies, so add them in that order).  They're all lightweight (i.e. brief) in terms of the code, but they can do heavy duty stuff.  The function by Bruce Robertson is a recursive function called FrontTabs() -- it gives a simple list of all the front tabs on the given layout.  It's here at briandunning.com.

The rewritten script does the same two basic things the original did: captures the front tabs to a global, then goes to those tabs each time the layout is loaded.  With multiple tabs it just had a little more ground to cover.

For the first step -- maintaining a list of the front tabs -- I used SFR's DictReplace function (Again, the functions are just wonderful and incredibly powerful.  Essentially they just give you a way to pass multiple script parameters, but really they're as powerful as associative arrays in PHP, letting you pass as many key/value pairs as you need, even nesting them if need be).  Each time a tab panel is clicked, the DictReplace function passes an entry to the dictionary stored in $$stickyTab.  The entry has the current layout as the name, and a list of the front tabs on the layout as the value.

Flip between the layouts and the $$stickyTab variable begins to look like this:

<:D t002:=2
8
:>


<:C t002:=2
9
:>


<:E t002:=3
9
:>


<:B t002:=5
3
9
:>


I've separated out the name pairs for clarity.  The left side of each entry is the layout name, and the right side is the list of front tabs. 

Step two is easy.  The script is triggered like in the original file, by OnLayoutLoad, with $$stickyTab passed as the parameter.  But instead of going to one object it pulls the current layout's dictionary entry from the $$stickyTab dictionary and loops through the list of front tabs, going to each in turn.

I hope that's useful.  I don't post a lot of FileMaker stuff online, but this one was fun to work with.  I haven't pasted all the code from the script and parameters, but I'm attaching my copy of the file.  There really isn't that much code needed.  I hope Geoff and company at SFR don't mind me passing on their functions.  And thanks again to Brian for the great file.  It was incredibly fun to work on.

EDIT:  Just looking back at the SFR blog, I noticed Geoff actually posted this same technique in January, though I don't think he carried it out to multiple layouts.

Filed under  //  filemaker  

Comments (2)