Wednesday, July 15, 2009

FILEMAKER 10: Send Email On Field Modification

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

CHAPTER 17: Script Triggers

At the FileMaker web site, they have a section to learn more about FileMaker 10. The specific link I’m referring to is http://www.filemaker.com/products/fmp/features.html . I was perusing this content today and watched the two minute video on script triggers. There wasn’t any technical content I hadn’t been familiar with but I enjoy checking such things out for reference. The video is quite well done but I want to highlight one thing the presenter mentioned in passing.

To illustrate script triggers in a real world setting, he attached a trigger to the ship date field in an invoice. He mentioned the attached script would fire on the edited change of data in that field and it would ask the database user if they would like to send an email to the invoice client of the ship date change?

I thought this was a wonderful idea and wonder why there isn’t a list of such trigger implementation ideas out there! Anyway, I immediately went to the list of requested features for my InBizness SOHO product and added this to the list! I also added this down as a note to send to some of my customers. They may like this feature added into their solution as well.

Do you have a script trigger implementation you would like to share? If so, please feel free to add it in the comments below or send me an email at info@dwaynewright.com.

Here are some links to other posts that might be of interest in regards to this topic...
Send Mail Dialog Box
Send Mail Script Step
A READER ASKS: Customized Send Email Messages
The Send Mail Script Step
A READER ASKS: 1400 Emails And Send Mail Script Step
EXAMPLE: Send Mail Script Example
A READER ASKS: Change The "From" default In Send Mail Script Step
A READER ASKS: Sending Email through IWP
=
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.

Friday, June 19, 2009

Button Bar Without Any Buttons - Compliments Of Script Triggers

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

I’m not sure if this technique has been explored out on the inter-webs but I thought I’d share this with the FileMaker community at large. Creating a button bar by using repeating container fields is nothing new. Normally, you would put an invisible button on top of each repetition and it would perform the script. The repeating field allows you to cycle different graphic to show different buttons or different button states.

This is different, more powerful and ruthlessly simple. In this case, I’m using a repeating text field, there are no buttons, one OnObjectEnter script trigger and one very simple script. Here is a 11 minute long video that explores the process, please feel free to tell me what you think!

Repeating Field Dock (script trigger only)
=
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

Thursday, June 11, 2009

FILEMAKER 10: OnRecordCommit Script Trigger and Instant Web Publishing

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

CHAPTER 17: Script Triggers

FYI... Pulled this tidbit from the online FileMaker KnowledgeBase and thought I’d pass it along. I heartily recommend every professional FileMaker developer to check out this valuable resource from time to time.

ARTICLE: # 7092
DIRECT URL: http://tinyurl.com/lz4w3k

The focus of the article is a condition in which the script associated with the OnRecordCommit script trigger isn’t firing as expected within FileMaker Instant Web Publishing. It looks to be associated with the edit record behavior found in browser based implementations. In particular, it looks to be associated to edits that are preceded with an Open Record / Request Script Step.

I’d like to reference another valuable and often overlooked resource, the help system built into FileMaker 10 itself. There is an article titled “Setting Up Script Triggers” and the following can be found in the Notes section ...

In Instant Web Publishing and Custom Web Publishing, script triggers can only be activated by a script and not by direct user interaction. For example, if a user tabs into a field that has an OnObjectEnter script trigger, the trigger will not activate. If a script step causes focus to move into that field, the script trigger will activate.
=
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

Tuesday, June 2, 2009

A READER ASKS: Go To Next Portal Doesn’t Seem To

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

CHAPTER XX: Scripting Loops

A READER ASKS

I am attempting to copy data from one portal to another using a loop to copy each line of the first portal. It copies the first line OK but does not go to the next row. It just loops around and around the first row. I just can’t see what is wrong.

I am using Filemaker 9 Pro, code attached. I would be very grateful for any pointers.

Enter browse mode
Set Variable[$ClientID;Value:Invoice::ClientID_fk
If[not isEmpty(getField(INVOICE::ClientID_fk]
End If
Go to Object[ObjectName: "InvoicePort"]
Go to Portal Row
[Select First]
Loop
Set Variable [$Quant;Value:LINEITMS::Quantity]
If[not isEmpty(GwtField(LINEITEMS::Quantity))]
End If
Set Variable [$Amt;value:LINEITEMS::Amount]
If[not isEmpty(GetField(LINEITEMS::Amount))]
End If
Set Variable [$Desc;value:LINEITEMS::Description]
If[not isEmpty(getField(LINEITEMS::Description))]
End If

#Dump information into ROA table
Go to Layout["ROA"(ROA)]
Go to Object[Object Name: "ROAPortal"]
New Record/Request
Set Field[ROA:ClientID_fk; $ClientID]
Set Field[ROA:Quantity; $Quant]
Set Field[ROA:Amount; $Amt]
Set Field[ROA:Description; $Desc]
Commit Records/Requests
[No dialog]
Go to Portal Row
[Select;Next;Exit after last]
End Loop


-------
DWAYNE RESPONDS
The Commit Records script step is the problem. When you commit a record, you exit the record as well. This takes you out of the portal completely, so the Go To Next means that since you are not in the portal anymore (due to exiting the record), you are going to the first row again.

Before you exit the record, set a variable equal to the portal row number. Commit the record, go back to the Portal Row number by using the variable information and then use your Go To Next Portal Row [exit after last]. You could also go to the portal row variable plus 1 and then tweak your exit loop conditional.
=
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

Saturday, May 30, 2009

FILEMAKER 10: Command Double Clicking An Object Brings Up Script Trigger Settings

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

CHAPTER 17: Script Triggers

I guess the title says it all but I’ll go ahead and add a little background. I heard this on edition 19 of The FileMaker Talk podcast (http://filemakertalk.com/) while Matt interviews Geoff Rlye & Andy Persons from Excelisys. If you are using FileMaker 10, you are likely using the new script trigger feature and assigning triggers to layout objects.


Up to now, I’ve always been right clicking my layout objects and choosing the script trigger option from the contextual menu. However, the double command click (double control click for Windows users, I assume) makes accessing the script trigger dialog box much faster!

Here you can see the contextual menu after right clicking a layout object.
=
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

Saturday, April 25, 2009

FILEMAKER 10: OnObjectModify Script Trigger Explored

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

CHAPTER 17: Script Triggers

The OnObjectModify script trigger will fire when the object it is associated with has its value changed (with a few notable exceptions). The most common firing method will be when a user types into a field or clicks into a value list to make a new selection choice. Fields with value lists attached to them are going to be a popular place for a script trigger. For example, a “No” checkbox selection to a field could easily run a number of background actions to accommodate associated business logic.

Download The Example (click here)
View The Movie (click here)


So if you have a field on a layout with an OnObjectModify script trigger applied, it will fire each time the field is changed ... regardless if that change is committed. So typing each letter will fire the trigger each time, so it isn’t a very good situation for a script containing the Show Custom Dialog script step. Of course, that is exactly what I did in my example file (grin).

The OnObjectModify trigger will also fire during your standard cut, paste or clear field value commands as well as the Insert family of script steps. These script step commands are dependent upon the field be on the current layout. For this reason, many developers use the Set family of script steps such as Set Field, Set Field By Name and Set Next Serial Value. Do these “non-layout dependent” script steps fire an OnObjectModify script trigger? The answer is “No”, they will not and this is something that developers will need to factor into their triggering implementations.

Other “no fire” OnObjectModify trigger situations include field auto entry settings, calculation/summary field changes and drag/drop into fields that were not actively selected. I have to admit that I’m not familiar with FileMaker drag and drop support at the time I’m writing this up. It is something I continue to forget about as I develop in day to day tasks. I’m sure that will change sometime in the future because this feature is simply too cool to ignore for long.

INTERESTING LEFTOVERS
The OnObjectModify trigger is what is called a Post-Event Script Trigger.

You can assign a script trigger to the repeating field and the OnObjectModify will trigger each time you modify that repetitions value.

I would like to revisit my opening sentence. The OnObjectModify script trigger will fire when the object it is associated with has its value changed. In theory, you can have the same field on the same layout multiple times and each could have a different OnObjectModify trigger applied to them. In the real world, this would probably happen with a field appears on multiple tab panels. In the same field / different trigger situation, the layout field that was modified will fire its trigger and its twin fields trigger will NOT fire.

=
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 ==================
MacUSA provides website and FileMaker Pro hosting services. Utilizing the highest performance web and FileMaker servers. We make FileMaker database hosting as simple as possible. Mac USA Technical Support has been voted the best by our customers. FileMaker Server hosting for your FileMaker web hosting needs supporting FileMaker 10 down through version 5. Hosting FileMaker Pro databases for Instant Web Publishing and Custom Web Publishing including PHP, XML, ODBC, and MySQL access. Use Promo Code dw0904S for FREE setup (a $25 value) when signing up for your FileMaker Hosting services. Offer expires 6/30/2009. http://macusa.net

FILEMAKER 10: Five Script Trigger Videos Online By Bartigé Mann

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

CHAPTER 17: Script Triggers


I had seen Brad submit a twitter post about five script trigger videos he did for his Sub's Tool Box (a FileMaker based application solution geared towards the glass and glazing industry).

Here is the link ...
http://www.bartigemann.com/Sneak_Peak.html


LET ME START OFF BY SAYING

I really enjoy and appreciate this type of content from my fellow FileMaker developers. It is one of the best ways to share the true craftsmanship of FileMaker design. It allows you to see more real world examples of technology. Some videos or leader led presentations are mostly a standard slideshow presentation with a little bit of FileMaker example file illustration.

Brad also does an excellent job in all five videos. This “Um - Ah” count is pratically zero and he does a great job of the classic presentation format of ...

- telling you what he is going to tell you
- telling you
- telling you what he told you

I have to admit, this is one of my chief complaints about my own video endeavors and I'm going to try and get better!

JUST BECAUSE I’M A BIT PARANOID
I'm a little concerned about how script triggers are going to be employed in the FileMaker community as a whole. I can see a possible future in which I turn down working on a customer project that was developed by a previous developer because of script triggers. Well, not script triggers themselves but the extensive and undocumented way they were implemented by the previous developer.

If I go to a layout and a massive amount of objects have script triggers assigned to them, it is possible that I would turn the project or the support session down. I know of developers that do the same thing as soon as they look at a clients relationship graph.

If too much of a layout has triggers applied to them, I cannot support the customer because I have no way of knowing what each of those triggers do. If one of them is wired improperly, I might be troubleshooting the problem for days until I isolate the problem down to a field on a layout that has a trigger applied to it.

WHAT THE REST OF THIS POST SAYS (basically)
I'm afraid I'm overly critical about videos 2 and 3. Then I sit up in my chair and praise the dickens out of video 4 and video 5. By the end of my video viewing session, Brad "almost" has me drinking the KoolAid on the first two videos.


MY PROBLEMS WITH TECHNIQUES FROM VIDEO 2 AND 3

In a nutshell, it comes down my opinion that the benefits do not support all the additional code. The benefits are a scripted go to edit layout and setup conditional formatting. There is a significant amount of ScriptMaker code involved and 44 layout objects have script triggers and conditional formatting assigned to them.

Don’t get me wrong, I did enjoy the end result but the cranky old man geek in me is on the front porch yelling “You kids, get off my lawn!” ... if you know what I mean. I just do not see the ROI for my projects. However, Bart starts to turn me around on this mindset towards the end of the video series.

ON TO VIDEO NUMBER 4
Ok, this one got me to sit up in my chair and take notice. Here is an example of great craftsmanship that I haven't seem displayed in script trigger videos from anyone thus far. This is because the example is highly layered and there lies its beauty. On the left side of the layout, Brad has a control panel for each record. This can change based upon a particular set of conditions, which are custom made for script trigger actions. Based upon typing one character in one field, the entire control panel changed to help support that user in data entry. All I can say is "BRILLIANT!".

I'm assuming the control panel is a tab panel that has its tabs hidden and the script trigger is going to the appropriate tab via its assigned object name. He is probably using a layout based trigger to maintain the correct control panel is shown as you go from record to record.

I take the pause off the video and see that he is ... ALSO ... setting portal filters based upon script triggers and these portals contain control panel buttons. Again, a very nice and elegant use of multiple techniques for a real world productivity benefit!

ON TO VIDEO NUMBER 5
His premise for this video is different than the one that is my personal comfort zone option. I tend to make my users create new invoices from going to the client record first and then clicking a button to create a new invoice.

Another method is to create the new invoice and then have the user select the client from there. In these videos, Brad has 4 different contacts for each contract record. He has to provide a client picker technique and I like it! I hope he takes this as a compliment, I will probably experiment with the techniques he has shown us in a new project I've just had a client sign off on.

WRAP UP
Do yourself a favor and go over to http://www.bartigemann.com/Sneak_Peak.html and check it out. I would bet that it will get your script trigger ambitions itching to be scratched.
=
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