ISO FileMaker Magazine: FileMaker Video Tutorials, Templates, Help & More

FileMaker Deals

Video Browser

Scriptology Video Browser

Tools & Resources

MaxR's Blog

Get (ActiveLayoutObjectName)

Posted by: MaxR / Wednesday, May 16, 2007 – 6:19pm

Using Object Info I assigned a name to a graphic button but Get(ActiveLayoutObjectName) wasn't getting it.

FMPV8.5 Online Help under Get (ActiveLayoutObjectName) says:

"Example
There is a named button on the current layout called cancelButton. When the cursor is on the button, Get(ActiveLayoutObjectName) returns cancelButton."

Further, under Notes "Naming Objects", the rules state:

"You can assign a name to an individual object or to a grouped object, but not to multiple objects. "

There is a difference between the mouse pointer and the cursor. The cursor is where the text insertion cursor is located; the object that has the "focus". So for instance if the insertion point was in field "first name" then this is the *active* layout object. A button can only become an active object if it is in the tab order and you have tabbed to it; or if a script action "go to object" has taken place.

Here is a solution:

Create two dummy fields: One, and Two (they could be globals, so you can use them anywhere) and use field One as the button, and assign whatever name you want.

Make the field a button and script as follows:

Go to Field [One]
Set Variable [ $$object; Value:Get ( ActiveLayoutObjectName ) ]
Go to Field [Two]

Field two is not on the layout so the effect of the third step is to exit the One field. Now $$Object contains the object name and the script can continue.

You can place a passive text block on top to name the "button."

------
Max Rogalsky
Melbourne, Australia
www.maxiwyse.com.au

Filed under:

Delete Record/Request removing data from related records

Posted by: MaxR / Wednesday, May 16, 2007 – 6:03pm

I had a looping script which took imported data and created new records of different types via relationships in an imported data table. Initially, I scripted this "takeon" loop on the basis of Next Record/Request, exit at end. All tested out OK. Then instead of the Next, I put in a Delete Record/Request with an if to exit when no records remained so that at the end of the process, all Imported data in the Takeon table would be removed. The loop worked fine. The functions also worked fine. But then I discovered the Delete Record/Request would not only delete the imported data record, it performed what seems to be a Revert Record function removing data from record(s) recently created and updated
with SetField statements. The related records however remained - just the data was removed.

The cause of this was that in some situations the script would change layouts. Changing layouts forced a commit. But in other instances, a commit wasn't getting executed. No commit, no data retained. Simple.

------

Max Rogalsky
Melbourne, Australia
www.maxiwyse.com.au

Understanding If

Posted by: MaxR / Wednesday, May 16, 2007 – 5:43pm

I was performing a number script steps like:

If (Contact_Phone) // perform when Contact Phone is present
do
do
do
End If

If (Contact_Email) // perform when Contact Email is present
do
do
do
do
End If

Normally in this scenario I would use If not IsEmpty(Contact-Phone) but was too lazy to type.

The If (Contact_Phone) performs the same as for an If not IsEmpty(Contact-Phone) but not for the likes of If (Contact_Email).

Both Contact_Phone and Contact_Email are text fields (no calcs, validation or the like)

I ran some tests and found that if the content of the field had numeric chars anywhere within it, I'd get the right result but not when the field contained only non numeric characters.

---- How Come? ----

The test for an If() statement must result in a boolean, where zero is false and a value greater or less than zero is true.

Text fields get evaluated as a number for a boolean result, thus the phone number results in a non-zero number and the email address with no numerals results in 'not true'.

-------
Max Rogalsky
Melbourne, Australia
www.maxiwyse.com.au

Filed under:

Getting to the right tab in a multi-tab set up

Posted by: MaxR / Wednesday, May 16, 2007 – 5:34pm

Let's say you have a master tab structure comprising Tabs: A, B and C and within the Tab A, a subtab structure comprising Tabs; D, E and F. Now, the operations:

User clicks A.
User clicks sub-tab E.
User clicks B.
User clicks A.

Now on A sub-tab D should be showing, not E.

---- Here's how ------

1. Install EventScript plugin

2. Create an unstored calculation = "" & EventScript (Get(filename) ; "GoToTabD" ; "")

3. Create a GoToTabD script = Go To Layout Object ("Tab D")

4. Using Object Info in Layout mode, double-click Tab D so that it's selected and name it Tab D.

5. Place the unstored calc field (make it small square) on top of Tab A. Nothing will show.

When you click on tab A, the unstored calc field comes to surface, activating the calc, launching the script, taking you to Tab D.

------
Max Rogalsky
Melbourne, Australia
www.maxiwyse.com.au

Filed under: |

System Dates

Posted by: MaxR / Wednesday, May 16, 2007 – 5:20pm

Quite often people start with an application template which they have sourced elsewhere typically, from the USA where dates are formatted mm/dd/yyyy. But in many other countries (e.g. Australia, New Zealand, UK) dates are formatted: dd/mm/yyyy.

When opening the application, a pesky dialogue window appears asking whether one wants to use System Format Dates.

Ever wondered how to get rid of this dialogue?

Simple, go to File | FileOptions | Text and set the file to "Always use system formats" under. This happens to be the default for new files created using 8.5.

-----

Max Rogalsky
Melbourne, Australia
www.maxiwyse.com.au

FMP V8.5 Validation and its Revert Dialogues

Posted by: MaxR / Wednesday, May 16, 2007 – 5:09pm

Native FMP validation provides a quite extensive range of quite useful options. However, its method for managing invalid conditions is quite poor.

You have the option to specify a custom message but after that you have little choice as to how invalid conditions are managed.

Filemaker shows your custom message (or its message) and offers a dialogue popup with OK and Revert buttons. Regardless whether the user selects OK or Revert, another dialogue popup is displayed with Revert and Cancel.

For example, in an items portal of an Order, I'm validating that the Received Qty cannot exceed the Ordered Qty using:
- Validate by Calculation with
- Only during Data Entry and
- Display Custom Message if Validation Fails.
When the user enters a Received Qty greater than the Ordered Qty AND clicks in a blank area of the screen, the Custom message displays with two buttons: Revert and OK.

The problem with this is that the user could have previously entered several Received Qty's in several line items. Then when Revert is used, all data entry including the wrong entry is lost. Having to start over from scratch on a long list of items for just one typo would be most annoying. The user can click OK and fix the last typo. But you cannot prevent the Revert button from showing.

The second problem is that when Revert is used to the first dialogue,another dialogue box opens saying "Revert all changes to this record since it was last entered" with two buttons Revert and Cancel. At this point, the user has no idea what "Record" it's talking about.

So how does one handle the problems:

1. To avoid having to click in a blank area of the screen in oder to check for any validation messages. This breaks the natural data entry sequence. Ideally, one just needs to be warned immediately on release of the entry into the field without having to click on a blank area of the screen.

2. To the Custom Message display, show only the OK button.

3. To avoid having a second Revert dialogue appear.

A simple solution is to replace the FMP Validation by Calculation with Auto-Enter by Calculation on the entry field so that if it's invalid, you can change its color to red.
e.g.

If (Qty_Received > Qty_Balance ; // the validation test
TextColor ( Qty_Received ;RGB ( 251 ; 51 ; 51 ) ) ; // the error response
Qty_Received ) // the valid response

This gets rid of the Revert dialogues, having to click on a blank piece of the screen and (unfortunately) the audible beep.

Many people opt to avoid FMP validation altogether and instead use either ZippScript or EventScript plugins.

I've studied other quite sophisticated solutions using a combination of Plugins and Custom Functions combined with Audit Logging but which still (unfortunately) allow for the possibility of Filemaker Validation cropping up.

No matter how extensively we go about validating data that users supply is valid, there's always a situation where a user can inadvertently or consciously, sabotage the data. A visual highlight is normally sufficient.

------
Max Rogalsky
Melbourne, Australia
www.maxiwyse.com.au

Go To Related Record (GTRR)

Posted by: MaxR / Wednesday, May 16, 2007 – 4:39pm

In a typical Commercial Application of FMP, Contacts, Orders, Invoices, etc. you'll probably need many GTRR scripts so putting all of them into the one common script is preferable.

Unfortunately however, powerful as it is, the GTRR script step in V8.5 doesn't provide for dynamic setting of the To.

For this reason, to use a common GTRR script, you'll need to specify script parameters to indicate the required To and set up your script steps like:

SetVariable $Link = Get(ScriptParameter)
If $Link =
GTRR
Else If $Link =
GTRR
Else If $Link =
GTRR
etc.
End If

------
Max Rogalsky
Melbourne, Australia
www.maxiwyse.com.au

Filed under: |
Syndicate content