Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6249 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

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

Posted

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

Posted

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.

Posted

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

Posted

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...

This topic is 6249 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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