WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright

In this particular point, I want scripts that go to found sets to have the logic to ...
- show an error message if there are no records in the found set to go to and exit gracefully
- go to the form view layout if there is only one record in the found set
- go to the list view layout if there are more than one record in the found set
Now InBizness has over 50 tables and many of them have both form and list views (there are a few join tables that I can ignore for these purposes). Manually coding each decision branch would be a bit overwhelming. On the surface, using the feature to go to a layout by a calculated value seems the way to go. I could choose to go to the layout by its name or by its position in the layout order. Now going by the layout order is not an option in a database that is under constant construction and InBizness is definitely one of those. Manually typing in the layout name again and again and again for each script step that will use this found set option is also not an option because of the time involved to create and maintain.

Here are some posts about the Go To Layout script step that you mind find interesting, if you are unfamiliar with the various aspects of it.
The Go To Layout Script Step
EXAMPLE: Go to Layout Example
Go To Layout - Via Account Name

So I decided to create a custom function that will look at the found count of records, then look at the base table and then return the layout needed. Here is a small sample of the custom function I wrote ...
Case(
Get ( FoundCount ) = 1 and Get ( LayoutTableName ) = "Campaign"; "FORM_Campaign";
Get ( FoundCount ) > 1 and Get ( LayoutTableName ) = "Campaign"; "LIST_Campaign";
Get ( FoundCount ) = 1 and Get ( LayoutTableName ) = "Client"; "FORM_clients";
Get ( FoundCount ) > 1 and Get ( LayoutTableName ) = "Client"; "LIST_clients";
etc...
"")
The actual calculation had over 50 lines and will likely grow when I integrate a planned manufacturing module to InBizness. I should also note that this function has even one more element of danger because it looks at the name of the table occurrence (not the table name itself) that is assigned to the layout. I wouldn't have even tried to do this if I wasn't working with a solution that totally embraces the Anchor / Buoy relationship design method.

Now you might wonder how I'm going to handle the advance notice of no records in the found set. Well, this is going to be something I address in the header (a name often given to script steps at the top of a script) of the overall script itself. I try to add that as a posting later on.
That being said, my calculated go to layout script step will be at the bottom of the script. This is because I will have to go to the appropriate layout first and then analyze what my base table occurrence is and what my found set count is.
So I'm going to wrap up this blog post for now but I'll try to update you on the overall progress of this implementation plays out.
=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.
© 2009 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.
ADVERTISEMENT ==============================
Looking for a robust FileMaker CRM template to manage your business? Check out the InBizness product line at http://www.dwaynewright.com/solutions.html.
No comments:
Post a Comment