Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

Can global variables be used to provide an auto-entered text string during a record create?

I've tried every combination I can think of to specify the Auto-Enter of a predetermined value ($$CurrentText). Simply placing $$CurrentText in the Data option indeed causes "$$CurrentText" to be placed in the field, but not the contents of the variable. Placing it in a calculation doesn't work either, nor with any combination of "replace existing". If I make the calculation read: $$CurrentText & "TEST" the word TEST shows up, so the evaluation is taking place. BTW, Data Viewer displays the proper text string in the variable before and after the record create.

Is this a limitation in the use of global variables? -- or have I just missed something?

Thanks in advance for any help.

Posted

Hi

AE $$CurrentText as calculation works with me, but the global variable must be definited before creating a new record.

I can only think to suggest you to check the name of the variable.

Edit: you can even force the re-evaluation with something like:

Evaluate( Quote ( $$CurrentText ); AutoEnterField )

Posted

Thanks for the response. I've double-checked the name. And I've even tried wrapping the field in a GetAsText[] operation just to do something different, but nothing is returned in the field (... which, BTW, is indexed. I wonder ... )

Maybe tomorrow I can prepare a test file to try on other systems (v7 and v8).

Thanks again.

Posted

$$Variables only exists for fm8+ and works only within the jurisdiction of one file. Use Get Script Result from an Exit Script to deal with trespassing.

--sd

Posted

I am using the separation model -- and the record that's being created from the GUI is in the database file. Could that explain why it doesn't work for me? In other words, does this situation qualify as the two files you referred to?

Posted

So is there a way to bypass this limitation? -- or is it considered a brick wall? (BTW, I did not understand what Soren was suggesting.)

Posted

It's not quite clear when, where and why you set your variable/s. Here's one possible way:

Script in file Main:

Set Variable [ $$myVar; Value:"whatever" ]

Perform Script [ “Receive Variable” from file: "Data"; Parameter: $$myVar ]

Script “Receive Variable” in file Data:

Set Variable [ $$myVar; Value:Get ( ScriptParameter ) ]

Now both files have the same variable, with the same value.

Posted

Some cool trickery can be observed here:

http://www.fmforums.com/forum/attachment.php?attid/5922/

...however does it undermine the rigidness of separation model, when having scripts in both are becoming manditory :nahnah:

--sd

Posted

Since $$global variables can't be referenced outside the file they're defined in, you can either pass the variable with a script as mentioned above, or simply use a global field instead. Global fields still have their uses.

Posted

Thank you each for your replies. Since my usage is fairly simple (tag each created record with a machine-dependent value) I'll just drop back to placing it in a global field (which, ironically, is where it started out). Variables are so "cool" that I began using them for all kinds of little things -- which led me across a line I didn't know existed.

I'll explore the other examples you provided to gain more insight.

Thanks again.

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