Jump to content

Go to Record/Request..by calculation: using variable

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

Recommended Posts

Hi. i have a script that sets two variables. I would like to later go to a record where those variables equal a fields value (there will only be one record that equals those values. For instance:

Set Variable [$year value:"98/99"]

Set Variable [$test value:"01"]


Go to Record/Request/Page [MyYearfield = $year and MyTestfield = $test]

This does not seem to work. I have tried a couple of variations, but nothing has worked so far.

Can someone please help? Thanks!

Link to comment
Share on other sites

I suggest that you either 1) Perform a Find or 2) a. provide globals that your Users can enter these two values or b. use your variables to set global fields which establish the proper relationship to a table occurrence of the records you want to end up with. You will join on two fields:

1) Perform a Find which would look like this:

Enter Find Mode [ ] ... uncheck Pause

Set Field [ YearField ; $year ]

Set Field [ testField ; $test ]

Perform Find [ ]

2) Create two globals (gYear and gField) and establish a new table occurrence as:

gYear = new table occurrence::Year


gField = new table occurrence::Field

Then let your variables set the relationship to the globals. Script would be:

Set Field [ gYear ; $year ]

Set Field [ gField ; $test ]

Commit Records/Requests

Go To Related Record [ Only Related Values ; "new table occurrence" ]

If you need more details on either approach, let us know. Since you are only finding one record, a search might be better. But the GTRR (Go To Related Records) approach has merit as well. It would depend upon your purpose which you haven't explained.

LaRetta :wink2:

Link to comment
Share on other sites

Hi LaRetta-

Yeah i actually ended up nixing the variables and just hard coding a find for the field values. It works as i need it to.

Question though - Why can't Filemaker perform a find on a variable? It takes the variable name as a literal text string. I think that would have easily solved my problem

Link to comment
Share on other sites

Finds are performed on fields. A variable isn't a field. Globals are still very-much workhorses in FileMaker ... establishing relationships and accepting User input are two of the primary uses. Of course you already knew the values (they are in variables after all). :wink2:

I'm not much for hardcoding in scripts or calculations; I'd prefer allowing as much flexibility and change for a business as I possibly can and I'll use script parameters, globals, and variables whenever possible. For instance, I'd rather use those variables in your find rather than hardcoding the variable values ... that's why they're called variables.


Link to comment
Share on other sites

This topic is 6471 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.