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

$script $$Variables

Featured Replies

FileMaker now suports script variables

$local

$$global

These are going to save a ton of time!

Hot *******! Finally.

Also notice that scripts can now return values to calling scripts.

sweet :

aleluiaaaaaa

Filemaker's scripting is slowly approaching the power inherent in a proper scripting language. Just another big step in the right direction...

Hopefully the next step is FM just switching over to a real scripting language like JavaScript so we don't have to know Yet Another Scripting Language.

What's to know? All the commands are right there for us to point and click. I know a little JavaScript, and think it's pretty cool, but I like how flexible FileMaker is. It's not often that I have to check for typos in FM. It kind of protects me from myself.

Is Cool. I'm waiting this feature for long time.

I also like the drop down calendar and tab control feature.

It's about time! Jumping with joy!! Some of these new features have been available in plugins for a very long time (exporting pdf, menu, tabs). I can't wait to start developing with this. I love the tabs, the value lists (allowing you to choose which field to show), the tooltips, script variables, customized menus, email field contents, pdfs, excel, all of it. It's about ******* time. Although, why didn't they add the feature of being able to email directly from FileMaker without having to go through a third party program? In any case, great job FileMaker!

A variable with a script scope seems new.

I am still missing a variable with a window scope, as a session can have more than one window. The window variable problem can be solved but I find it very complex.

And now for more variable goodness: apparently they can be used in file paths, along with user-relative locations such as "Desktop" and "Documents" to save files with dynamic filenames.

Freakin Hallelujah! About time!

Does $$global take the value of none-global field and hand it to the another Table/Layout without using GoToLayout step?

I would assume that $$global variables are session-specific in a multi-user system, just like global fields?

Yup. $$variables only apply to a single session as far as I can tell.

I finally got the FM8 trial installed, so I can see what all the hub-bub is about. For those who don't have it yet, here's a screenshot of the new Set Variable script step that allows you to set a script variable.

Picture_1.gif

Oh sure ... you Mac people are all up and running. My system won't run 8 - says I need to upgrade my Windows XP Home Edition to SP2; which says I must perform full backup or possibly lose everything in the upgrade. And it says I may lose all my settings when I do so. Geez. I want a Mac!!!!!

Even trying to download SP2 wonked out. It insists I use IE Explorer instead of FireFox or it won't even let me download!!! How's THAT for Microsoft bull!! :frown:

Go figure with your SP2 issues.

You should be able to tell Automatic Updates (via Control Panel) to get SP2 which will allow you to bypass using a web browser entirely. I can't say I've had any issues getting 8 installed, and whoo boy is it worth making sure my WinXP box is up to date. Not to mention SP2 and subsequent critical patches should always be kept as current as possible to maintain integrity of your system.

Jeez, I can't belive this is my first post. I've been trolling this site for over a year and found wealths of informaiton. Guess it's time to make my contribution!

Edited by Guest

Despite the trouble, I'd make backups and install SP2 PDQ. Security holes galore without it. That alone is enough reason to go to SP2.

FMP8 is a nice added bonus, of course :

I updated (months ago) to SP2 without losing anything, by the way. Guess M$ are just making sure that you know that there is a risk, no matter how small.

My system won't run 8 - says I need to upgrade my Windows XP Home Edition to SP2; which says I must perform full backup or possibly lose everything in the upgrade. And it says I may lose all my settings when I do so.

I didn't have any trouble here with upgrading XP Pro to SP2. Went quite smoothly. MS even sent me a CD, so i don't believe that I even had to download.

This system came pre-configured. I never knew an SP2 was even out. I suppose I should frequent the MS site watching for updaters but, for the life of me, I can't muster the desire to do so. I don't want to wait for a CD and it's good to know others didn't have problems. However, every time I feel smug and assume 'things should go fine' then Capt. Eddie Murphy Jr. pops his head up. Good things are worth waiting for. I will upgrade this weekend when I can afford tweak-time if necessary. This solution is worked on all night and must be uploaded again by 7AM for use the next day ...I simply can't risk down time.

Besides, y'all are keeping me quite excited over what to expect. I won't be spending time designing things that I now know I'll handle differently in vs. 8, such as creating value lists based upon round-about methods, knowing we'll be free from that burdeon soon! :wink2:

FileMaker rocks!!! Thanks everyone for the great input! I was just disappointed this morning ... finally had some time to download and check it out and couldn't ... and felt a bit twirked. :smile2:

LaRetta

Hopefully it will install OK-ish while holding the Shift key (worked before). Cause I'm on XP without any SP (or trouble), and I'm not the least interested in SP2.

Ok, back to script variables.

Since we can now use variables in import/export script steps, are there any other places we can use them that would be extremely helpful?

Maybe like the print dialog, or find requests?

Yes, naming/saving PDFs from FMP, naming/saving excel sheets from FMP, (on the fly) and a whole bunch more. Save on clutter by reducing (not totally eliminating) a great number of global fields.

So how does script variables work? Do you just name it with a $ or $$ and you can then pull data from it for any calculation or script?

See my screen shot above.

Yes, naming/saving PDFs from FMP, naming/saving excel sheets from FMP, (on the fly) and a whole bunch more. Save on clutter by reducing (not totally eliminating) a great number of global fields.

Yes, but saving PDFs and Excel docs is pretty much exporting, right?

Can we use variables anywhere else? Inside AppleScripts?

I suppose that making a pdf or excel would be considered exporting, although I look at pdf making as printing specific (and dynamic naming of pdf's has been a sought after feature). Another thought is placing the result of a script into a $$variable for use elsewhere could be interesting or using them in conjunction with the new tooltips mightbe marginally useful. I am sure that there will be many things come up over the next few months. It might be worth noting that one should be careful using the global variable variety in relation to potential security holes as they can be viewed in the data viewer in 8 Advanced.

Edited by Guest
clarification

Is there a limit on how many $$ globals you can have at the same time?

presumably a script with "script variables" falls into a heap if a v7 user tries to access an updated script?

Is this handled gracefully or will the user just get an error number message?

Yes it will fall in a heap. You will get and some strange stuff. You will get for the script step Set Veriable.

Edited by Guest
Typo

What if you try to host a script with script variables on FMS 7 and run it on FMP8?

And now for more variable goodness: apparently they can be used in file paths, along with user-relative locations such as "Desktop" and "Documents" to save files with dynamic filenames.

Is there any way to choose a path (other than Desktop, etc.) with a dialog and have the path written to a script variable or a field? I know that i can hard code the path in a field, but it would be nice to be able to select it as needed from a dialog.

James

That would be awesome. Especially saving a path into a user preference table.

Does anyone know how to release a global variable, clear it from memory?

Does anyone know how to release a global variable, clear it from memory?

I don't see what this has to do with this thread.

Well I do... :

Raymanj, to release a global variable, simply set it to a null value. It's as simple as that. :

Is there any way to choose a path (other than Desktop, etc.) with a dialog and have the path written to a script variable or a field? I know that i can hard code the path in a field, but it would be nice to be able to select it as needed from a dialog.

Yes, there is. Script a process where the user is selecting a file to insert into a global container field. Once they have done that, you will be able to retrieve the full path to the selected file by using GetAsText(GlobalContainerField), parse the path (everything but the file name) and place the result into a text field, then clear the global container.

Not quite as neat as the job you can do with some of the 3rd party plug-ins (because you cannot select an empty folder by this method) but workable. :

Yes, there is. Script a process where the user is selecting a file to insert into a global container field. Once they have done that, you will be able to retrieve the full path to the selected file by using GetAsText(GlobalContainerField), parse the path (everything but the file name) and place the result into a text field, then clear the global container.

I'll give this a try! May even be able to write a custom function for the parsing.

Thanks!

I was excited about variables until I actually tried to use them today. I want to capture the input from a custom dialog to variables instead of temp global fields. It doesn't look like that's possible (not without capturing to a global and then setting the variable to the contents of the global, which seems... counter-productive). Am I correct here?

On the other hand, it does appear you can use variables with the Troi plugin -- instead of using a Set Field step to display the dialog you can use Set Variable; the variable will be set to the dialog result.

It would also be nice if you could use variables like merge fields on layouts for button labels etc.

Stephen,

Can global variables be displayed on a layout?

I am getting a date range and storing in a variable and want to display it at the top of my report.

Thanks in advance for your help.

FM Forums is a great resource. :

Can global variables be displayed on a layout?

I guess Stephen is busy. :

The answer to your question is no, not directly.

It can be done indirectly - eg if you set up an unstored calculation field that references the global, you could include that on the layout (either as a field box or in a merge field). Or alternatively, you could script the placement of the variable into a field (eg a global field).

However depending on what you're trying to achieve (and why thinking of using variables), it may just be simpler to just put the value directly into a field in the first place...

As I found, it's not possible to display variables on layouts by themself. If you store the value of variable to the field placed on layout, then it works out. I'm not pleased with this solution because have expected variables being same or similar as they are in other script languages such as php.

Create an account or sign in to comment

Important Information

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

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.