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

FileMaker Deals

Video Browser

Scriptology Video Browser

Tools & Resources

Scripting

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:

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:

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