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.

Using Variables To Set File Paths

Featured Replies

Hi

I Have a script which exports a layout(Report) to a pdf file, and within the script I am using the set variable function to generate the file path of the exported file.

If I type in the file path manually all works fine:-

"filewin:/C:/Keibudo Karate/Reports/Grading History Reports/" & Students::c_Student Name & " " & Get ( LayoutName ) & ".pdf"

I have also created a separate table which I will use to set up the database default file locations, however when I use the following in the script it doesn't work:-

conf_File Locations::cGrading Reports & Students::c_Student Name & " " & Get ( LayoutName ) & ".pdf"

I am new to fmp so would greatly appreciate any advice on what i am doing wrong.

Regards

Dave

I think that you might be victim of a context issue. Your script runs from the context of whatever layout you specify. So, you need a relationship to your conf_File Locations TO in order to use the field cGrading Reports and Students::c_Student Name (that's two different TOs and without a relationship from where you are, FM will not be able to grab that data).

The idea of devoting a table to default export paths is terrific. In fact, I use a one record table SYS, and there I put all my system-wide defaults. Often, rather than building a relationship from every TO to SYS, I "publish" the preference values to global variables or global fields so that I can use that value from any context without a relationship. I name the fields in pairs, for example, p_exportPath and p_exportPath_g, so that they list together nicely in field definitions.

hth,

Barbara

  • Author

I think that you might be victim of a context issue. Your script runs from the context of whatever layout you specify. So, you need a relationship to your conf_File Locations TO in order to use the field cGrading Reports and Students::c_Student Name (that's two different TOs and without a relationship from where you are, FM will not be able to grab that data).

The idea of devoting a table to default export paths is terrific. In fact, I use a one record table SYS, and there I put all my system-wide defaults. Often, rather than building a relationship from every TO to SYS, I "publish" the preference values to global variables or global fields so that I can use that value from any context without a relationship. I name the fields in pairs, for example, p_exportPath and p_exportPath_g, so that they list together nicely in field definitions.

hth,

Barbara

Thank you for your response Barbara.

In my config table I have setup multiple fields for different parts of the file path and now set my filepath calculation field as global storage and it works perfectly!!!

Many Thanks

Dave

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.