Friday, June 19, 2009

FILEMAKER: Script Triggers For Easier Portal Filtering

From Dwayne Wright - Certified FileMaker 9 Developer
WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright

CHAPTER 04: Controlling Portal Data

Back in November of 2008, I wrote a blog post and included an example file about filtering portal data titled EXAMPLE: Portals Based Upon Date Ranges. Today I created a movie that is a FileMaker 10 script trigger tweak upon those techniques.


There is a related movie on this topic! CLICK HERE!


=
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 (Virtual One On One Training Services)
If you are interested in a one on one virtual session, please click here or send me an email at info@dwaynewright.com and we will schedule an appointment.

Monday, June 1, 2009

FILEMAKER: Portal Creation, Highlighting and Sorting Reminders

From Dwayne Wright - Certified FileMaker 9 Developer
WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright

APPENDIX 2: Portal Misc

Here are some quick portal row comments that came up during a virtual one on one session with a client. Looking down at the notes I took, I thought I’d jot them down quickly and post them.

RESTRICTIONS ON CREATING NEW RELATED RECORDS
It is important to remember that to create related records in a portal, the child matching key field needs to be able to accept new data strings and the relationship needs to include the operators of =, ≥ or ≤ . Basically, they need to be equal to match criteria in order to be created reliably.

HIGHLIGHTING THE CURRENT PORTAL ROW

There isn’t a checkbox in the portal setup dialog to allow the current portal row that the user is within to standout visually. This can be accomplished using your FileMaker design skills and there are dozens of examples of different methods on the internet. You can do a google search for “highlight portal row” and you can find these diverse postings. I don’t actively include this feature in my solutions but I know of many developers that do. For the most part, developers are using some form of conditional formatting to achieve this feature and that does require everyone use FileMaker 9 or higher.

PORTAL SORTING WILL OVERRIDE RELATIONSHIP SORTING
The setting for the sort order for a portal will override the sort setting for the relationship itself.

DYNAMICALLY SORTING PORTAL ROWS
This is another technique I rarely include in my solutions and there are dozens of sites out there that have different ways of achieving this feature. I’ll include a few links about the topic below. Also, you can do a google search for “FileMaker portal row sorting” and you can find these diverse postings from the developer community.

Here are some links to other posts that might be of interest in regards to this topic...

Can’t Add Portal Row ( Calculated Child Key )
Can’t Add Portal Row ( Security Setting )Sorting A Portal Row
Improving Portal Sorting With Design
Sorting Portal Via A Calculation Field
EXAMPLE - Portal Sort Via Calculation
EXAMPLE: Get Field Portal Sorting
EXAMPLE: Get Field Function Sorting Portals With Color
EXAMPLE: GetField Sort ASC/DESC Portal With Color
When Portal Sorting Gets Excessive
Portal Sorting (but not really) Using Tabs
=
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 ==================
Help support this blog by considering a donating to its ongoing growth. For more details, please visit http://www.dwaynewright.com/donate.html

Sunday, February 22, 2009

FILEMAKER: Brain Dump Of A Portal Troubleshooting Session

From Dwayne Wright - Certified FileMaker 9 Developer
WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright

CHAPTER 10: Troubleshooting Portals

Previously I chatted about a portal sorting via hidden tabs that I encountered in a clients database. In the same database, there was another portal that would show product sales or purchase totals for a number of years. Now the portal only went to 2008 and they wanted a new portal row for the 2009 year. This was a very different implementation because there was a value list next to the portal. Using it, you could dynamically show every sale or purchase history. So we must be using some sort of join table and I'm thinking it must be pretty large in size.

Currently, the customer has 1,324 records in the products table and the portal shows years 2003 to 2008. So we have six years, then multiply that by 1324 records and then multiple that by 2 (for purchases or sales). So that gives me a grand total of 15,888 records.

Now I was wondering how they handled the join table for new records, so it was going to be interesting to look under the hood. It seems quite nimble and I'm wondering how FileMaker is doing these aggregate totals so quickly. After taking a peek, I became bewildered because the join table in use, the total field is a straight number field. So it is getting stamped somewhere. I wonder if this might be part of some nightly routine using the FileMaker Server scheduling. The entire office is updating to FileMaker 10, so this might be a great place to start introducing script triggers.

Sure enough, I'm finding a number of maintenance scripts but none of them are pointing me in the direction I was hoping. Wow, as I continue to look under the hood, there are hundreds of scripts here. They are nicely organized into folders but the sheer number of them is out there. I'm not sure I'm going to be able to find them via a seeking and discover manual process. After spending a hour, going to try and see if I can get a DDR or BaseElements to help me out here.

If you haven't checked out BaseElements, do yourself and give it a go!

Well, I know now that I would probably never have found this without Goya BaseElements. It looks like the value are set via a stamping process from a report run from a Vendors perspective. The script goes from one vendor to the next manually setting the total field for the join table equal to the aggregate total of the sales order and purchase order line items. So it looks like the very cool feature I'm interested in is just a by product of running the master report. How absolutely weird.

So I had to take a week or so away from this project and knock out some other project work. Getting back to work on a complex and undocumented database you don't have much experience with is hard. I was able to import the data into the join table and all looked well and good. So I'm three steps into the myth of the separation model allowing you to leave the data file intact. So far I have had to add 4 fields and import 2,400 records to build a join table for 2009. I take a look at the reporting script that BaseElements leads me to believe is the one stamping the data. Towards the top of the script, I see that it is setting a variable to a carriage return list of years and 2009 is absent. It looks like this list is parsed later on, so I add a 2009 value to the list and move one. I ran the report that I thought would stamp my annual value data for 2009 but I was mistaken. My imported 2009 value in the portal is empty for something I know was sold in 2009! Darn!

I then try to add a new sales order and see if I can reproduce the stamping event. Twenty minutes later, I cannot figure out how to add a line item to a new order. It has an elaborate selector field where you have to pick a supplier from one field, then a product from another field and apparently some action is required to add the item. However, I cannot find any button anywhere that will execute the action. So I have to downshift to looking at the scripts in ScriptMaker and I found a promising candidate. I decided to execute it with the script debugger running. This script "Add Item To Order" did absolutely nothing at all. Then ran a script underneath this called "Add Item To Order - New" and this did add a line item but without any product code or description information. Very frustrating and not sure how much longer I can continue to throw darts at the board with a blindfold on.

So I'm going to try and see if I can get this tagging done onsite or have the clients authorization to research it further. It may very well take me a few hours or more to hunt down this process. In the meantime, I'll go ahead and do a work around for the stamping process. I'll try to make it so that it fails gracefully and only runs on 2009 transactions. Of course, this is going to require even more fields for me to track.

About 30 minutes later and I'm still making little or no headway ... when ... my eye catches something. There are two 2009 records and one has data. So I deleted all the 2009 join files, ran the script again and 25 minutes later (yeah, it is NOT a barn burner), the correct 2009 totals are there! So I had stumbled upon the solution but missed it because my earlier attempts had sabotaged me!
=
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 ==================
Help support this blog by considering a donating to its ongoing growth. For more details, please visit http://www.dwaynewright.com/donate.html

Wednesday, February 11, 2009

FILEMAKER: Same Portal - Different Tab

From Dwayne Wright - Certified FileMaker 9 Developer
WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright

CHAPTER 09: Tricks and Techniques

Multiple portals that are very similar can be paginated by using FileMaker tab panels. You can have one portal that is sorted by date ascending in one tab panel and the same portal sorted by date descending in another tab panel. You can even create buttons that look like they are sorting the portal but are actually going to the tab panel that holds the corresponding portal. You can have a portal that shows the first 20 rows of a relationship in one tab and another tab panel that has the same portal but it starts at row 21.

Here are some links to other posts that might be of interest in regards to this topic...
Six Fried Rice On Hidden Tabs
Portal Sorting (but not really) Using Tabs
=
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 ==================
Help support this blog by considering a donating to its ongoing growth. For more details, please visit http://www.dwaynewright.com/donate.html

Wednesday, January 28, 2009

FILEMAKER: Portal Sorting (but not really) Using Tabs

From Dwayne Wright - Certified FileMaker 9 Developer
WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright

CHAPTER 02: Portal Sorting

So I came across a client database that had a rather odd way of sorting a portal. The portal was located in a products table and was designed to show sales history. The columns in the portal were order id, date, company, quantity and order status. The portal had buttons to sort the row by date, company and qty. The customer wanted to add the ability to sort by order status.


The default sort for the portal was by the sales order date and the company on the sales order. The buttons on the three sort options were all tied to Go To Object script steps. This was very odd to me and I needed to research this technique. The buttons themselves were broken down into ...

DATE COLUMN BUTTON
Let( $$date = Choose( $$date; 1; 0);
Choose( $$date; "Date"; "Date D")
)

COMPANY COLUMN BUTTON
Let( $$company = Choose( $$company; 1; 0);
Choose( $$company; "Company"; "Company D")
)

QTY COLUMN BUTTON
Let( $$qty = Choose( $$qty; 1; 0);
Choose( $$qty; "Total"; "Total D")
)

Looking at the sort fields themselves, nothing remarkable. The company field was a placebo calculation field that was equal to related company name on the sales order. The date field was a lookup field from the sales order. I didn't see any hidden tabs but I thought I'd investigate. Sure enough, the darn thing is a layered hidden tab configuration. The tab have the same portal but with a different default sort order and the sort buttons do not sort but simply go to the correct tab with the corresponding default sort order portal.

This required me to take a closer look at the calculations that drive the Go To Object and I'm certainly glad I did. What the developer is doing is doing is toggling between an ascending sort for the portal and a descending sort. I don't use the Let or Choose function that often and this is a marvelous way to use them. So I went ahead and deconstructed the tabs and add a couple tabs of my own for the status sort. One tab to hold the portal for the ascending sort and one for the descending sort.

Needed to add a placebo order status field in the sales order line item table. This is because the portal is linked to the sales order line items and the status is linked to the order itself. I added my own sort button for status and attached my revised version of the Go To Object step ...

Let( $$status = Choose( $$status; 1; 0);
Choose( $$status; "Status"; "Status D")
)

I then wired everything back up and it worked like a charm!
=
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 ==================
Help support this blog by considering a donating to its ongoing growth. For more details, please visit http://www.dwaynewright.com/donate.html

Monday, January 5, 2009

FILEMAKER: Constant Relationship Portals And Tab Panels

From Dwayne Wright - Certified FileMaker 9 Developer
WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright

CHAPTER 09: Tricks and Techniques

This article is a piece of a larger collection of articles on a proof of concept file I'm doing with the 360Works email plug-in. I'll include some links below for the other articles. As I was building this part of the example file, I knew I'd be doing some portal work that some folks might not have seen before. So I thought I'd document it here in the FileMaker Portals Explored Blog. Here are the previous links ...

External Functions Registering Your Plug-in
A Friday Afternoon With The 360Works Email Plug-In

In my proof of concept file, I'm going to have a tab panels called "Emails By Account" and then have a sub-tab panel within it for the accounting, sales, support, management and information tech related emails. Within each of these tab panels will be a portal showing just those emails that account that have a status of unread.



So first we are going to create relationships that match with our possible account options listed above. So we will create some calculate global fields for the parent matching key fields for our dashboard. Then we will set up the relationships for each account, using the Anchor / Buoy design method.

Here you can see the primary match fields that I'll be using in the relationships.

Here you can see the anchor/buoy relationship graph design to allow me to setup a portal per account that is viewed via a tab panel.

Next we take our portal that we defined for the Emails (all) tab, copy it, paste it off to the side and shrink it just a little bit to fit into our Emails (by account) sub-tab. We also do not need the To Account field in the nested portal because those portals only show the emails for that account.

Here you can see the Emails All tab.

Here you can see the Emails By Account Tab, the nested tab panel within it, the chosen Accounting tab selected and the portal within it.

I decided that I would put a tooltip in place so you can see the to address on the email, just to be sure it is too the correct account.

Here you can see the portal is showing you that an email was sent to multiple addresses but was included in the tab for this account.
=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 2008 - 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.

Monday, December 22, 2008

FILEMAKER: Don’t Forget You Can Start Your Portal At A Row Other The The First

From Dwayne Wright - Certified FileMaker 9 Developer
WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright

CHAPTER 01: The Basics

As you know, a portal is designed to give you a mini list view of records related to the current record you are browsing. You can add a vertical scroll bar to view an almost unlimited number of related records. In some cases, you might have a limited amount of horizontal data to show the user and in a case like this, you can setup dueling portals. For example, one portal can show you related records 1 through 18 and the second portal (using the same relationship and fields can show you records 19 through 36.

Here you can see the dialog box setup for the second portal row.

Here you can see the staff layout from my InBizness product and we are looking at the portals that show the media file records that are associated with that staff member record.

Now the FileMaker 9 feature of auto resizing can goof you up a little here. If you have portal auto resizing setup, your first portal will dynamically show you more than the 18 records when the window is expanded. So you will see duplicate records in the second portals and unfortunately, I don’t have a resolution for that.

If you have any ideas or comments, please feel free to send them my way and I’ll update this blog post accordingly!
=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 2008 - 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.