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.

Layout name and go to field as a variable in a script

Featured Replies

I have a database with numerous layouts including a layout called "Notes"

I'm trying to write a script (Notes) which will let me open the "notes" layout from any of the other layouts by using a button make an entry, copy the record number and go back to the layout I came from and enter the record number in a field called "notenr".

So far no problem---as long as I always use the same layout to start with.

The problem is that scriptmaker forces me to write the "go to field" or "set field" command in the form: layout A::notenr meaning that whatever layout I came from, it will always return me to layout A, the layout written into the script.

But I want to be able to start from layout A,B,C,D..etc and return to whatever layout I started from.

This is a long story just to explain that I am trying to find out if there is a way to define a variable using the layout name which can be used in the script so that the script will read: go to field "$variable layout name":??? notenr

Thank you kindly,

yknot

Hi yknot

Don't know if this helps but there is a script step and option 'go to layout[original]' which will always return you to the layout that you were on when a script started.

Phil

  • Author

Thanks Phil,

Yes, I am aware of that, but if you take that one step further and then enter the "go to field" script step, scriptmaker forces you to enter: layout::field

It does not simply let me go to a field without forcing the layout name into the script.

And then I'm back where the script always goes to the layout from where I wrote the script.

Regards,

yknot

When I have a Notes table that is accessed from several other tables, I do kind of the opposite. I grab the ID from the table where I started, go to the Notes layout, then create a new note, then put the ID(s) into a dedicated field(s) in Notes, then return and go to the related notes field (in a portal), then to the 1st row of the portal (sorted descending by timestamp).

I say ID(s) because I might want to put more than one; I have multiple foreign ID fields in Notes. Say I'm on an Project, and I want a new note, I might want to put both the ClientID and the ProjectID into the note. That way it can be viewed from either the Client record, or the Project record.

Yes, if I want a singular "modular" script to do this, then I have to send a parameter saying where I'm coming from, then use Get ( ScriptParameter ) and If, If Else statements to branch.

In answer to your question, you can go to layout by calculation, but you can't go to field by calculation (in FileMaker 7). You can loop through the fields, using Go to Next Field, exit if Get ( ActiveFieldName ) = "some field". But I would only use that for going through forms. In FileMaker 8.5+ you can Go to Object [ "some field" ], if you've named it as a layout object.

Set Field [ ] does not actually require a target field; you can uncheck that. But you must be sure you're on the right field.

  • Author

Thanks Fenton --- you are a great help!!!

When I have a Notes table that is accessed from several other tables, I do kind of the opposite. I grab the ID from the table where I started, go to the Notes layout, then create a new note, then put the ID(s) into a dedicated field(s) in Notes, then return and go to the related notes field (in a portal), then to the 1st row of the portal (sorted descending by timestamp).

My problem is that I have no field which is unique to table A, B, C, D... and the Notes table. It is the serial field NoteNr which gets populated with each new record that is unique and I want to enter this number in the NoteNr field from wherever I came from. And I use this number later on for a quick search.

So I solved it with your suggestion to do the loop.

Thanks again,

yknot

No need to switch layouts. And copying information with a script is not good practice, you want to leave the clipboard alone.

Set the Notes relationship to allow related records to be created. Then just set field NoteNR to empty, and auto-create the new record by setting a value in the Notes table. NoteNR will now be populated automatically with the NoteNR of the new record.

  • 3 weeks later...
  • Author

Creating a new record by clicking on a field

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.