Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

fm5-"go to field" by field value?

Featured Replies

I'd like to find a way of using a script step that would have the same effect as "go to field" but without having to specify which field to go to.

The name of the field to go to would be in a global.

In the same way you can specify this in "go to record"

This would save me about 70 scripts...

Any idea how I can do this?

As I'm at it, I'd also like to use "set field" in the same way - the field to be set is the one which's name is in a global.

This must be a tough (or impossible) one, but I really hope a genius among you knows how to do what I'm asking for in filemaker 5.0., well I don't even know if it's possible in 5.5, is it?

Thankyou for reading and eventually answering my question.

In FileMaker Pro 5.5 you can modify the "GetField" ScriptMaker step to do some of this.

HTH

Old Advance Man

  • 3 weeks later...
  • Author

Very nice...thanks.

  • Newbies

michele,

It's certainly possible, and not too tough.

Heres one way to do it:

I set up a test file with 5 data fields

field1 (text)

field2 (text)

field3 (text)

field4 (text)

field5 (global text)

and 3 script function fields

loop stop (global text)

field count (global number)

loop count (global number)

The following script will enter "Strawberry" into whichever of field1 - field4 that you specify in field5. The script exits if field5 is left blank or the contents of field5 does not match any of the field names on the layout (based on the tab order you have set for the layout).

----------------

#Do Nothing if field5 is empty

If["IsEmpty(field5)"]

Exit Script

End If

#Count the fields on the current layout

Exit Record/Request

Go to Next Field

Set Field["Loop Stop", "Status(CurrentFieldName)"]

Set Field["field count", "0"]

Loop

Go to Next field

Set Field["field count", "field count + 1"]

Exit Loop If["Status(CurrentFieldName) = loop stop"]

End Loop

#Find the field specified in the global field

Set Field["loop count", "0"]

Exit Record/Request

Loop

Go to Next field

Set Field["loop count", "loop count + 1"]

Exit Loop If["Status(CurrentFieldName) = filed5 or field count = loop count"]

End Loop

#If the selected field's name matches the data in the global, set that field with whatever data you need.

If["Status(CurrentFieldName) = field5"]

Set Field[""Strawberry""]

End If

Exit Record/Request

-----------------------

You could set this up as a "Go to Field" script and just call it from any other scripts that need this type of function.

There's a different way to do this that doesn't need the loop/count structure, or script function fields. It works in 5.0 and uses PatternCount and the FieldNames design function to test if the field name in Field5 exists on your layout:

If[PatternCount(FieldNames("YourDbaseName.fp5" , "YourLayoutName"), Field5) = 0 or IsEmpty(Field5)]

Exit Script

Else

Go to Field [the first in your tab order of those to be tested]

Loop

Exit Loop If [ Status(CurrentFieldName) = Field5]

Go to Next Field

End Loop

Set Field ["Strawberry"]

End If

Go to Field[ ]

BTW, the first time I used the FieldNames function, I just couldn't get it to work. Turns out you must include the ".fp5" suffix in the dbase name. The Help file uses a sample name "Customers" without the suffix and doesn't make this clear.

HTH

  • Newbies

I was hoping somebody would come along and show a nice, clean way to do it. Gotta remember those design functions smile.gif

[ April 17, 2002, 10:50 AM: Message edited by: fwl ]

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.