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

Storing long (>253) text in global field

Featured Replies

I want for a global field to contain an Applescript template that I can copy and modify at runtime with a FM script. How can I initialize this field? SetField doesn't like its being >253 characters. And I don't think I should simply initialize it once, manually, because it could possibly be deleted.

Thanks!

Chap

You should be able to store up to 64K characters in a text field. Are you sure it isn't set to number?

  • Author

Sorry, I wasn't really clear - the problem is how to *initialize* the field to contain the script text.

One option is using SetField, but the value of the calculation to which the field is set is limited to 253 chars. I suppose I could build the value by using a series of SetFields to concatenate the full text, but I'm hoping there's an easier way.

The other is to manually paste the text in via a field on a layout, but I fear losing the contents of the global somehow (like Delete All Records... I understood that globals are meaningless when there are no records).

I hope that clears up my question...?

You could make it an auto-enter calculation so the default text is entered whenever a new record is created. Or you could make it a global and set the default value in single-user mode. When the file is opened in multi-user mode, it will revert to its default even if changes have been made to it by users, as long as it wasn't in single-user mode when the changes were made. You can delete all records and the global will still contain its value. As long as you don't save as a clone, globals always retain their default values.

  • Author

Auto-enter calculations (or data specifications) are limited to 255 chars. And I do use cloning in order to distribute updates. I think the best way would be for me to manually set the global once (it's not a user-changeable value) and use something other than cloning to distribute the "shell" of a database.

Thanks for your help,

Chap

Each group of textual data is limited to 253 characters, but the calculation itself is not. So "<253 chars>" & "<253 chars>" & "<253 chars>" will work.

"Sorry, I wasn't really clear - the problem is how to *initialize* the field to contain the script text."

No, I don't think that's the problem. I think you are on completely the wrong track.

Put the script in a perform applescript script step. Making scripts out of concatenated text is just a big mess. Capture record data at the top of the script.

Simple example:

property messageField: "SomeFieldName"

display dialog (cell messageField of current record)

  • Author

<whacking self on side of head>

Right. I really just needed a way to "pass parameters" to a Filemaker Applescript (to recall an earlier discussion), and _that's_ how to do it.

Thanks a million -- the box I was thinking inside of was getting smaller and smaller. B)-)

(Edit: hey, I'm a journeyman!)

simply set the result of your calculation to text, not number.

just have a look at the lower left corner of the define calc window .... ;_)

  • Author

Maybe I should start another thread, but to follow up on BruceR's suggestion:

Here's the code I've got now. It's part of a Perform Applescript step in a FM script which is stored in the file Enrollments.fp5. And it works fine when I run it from Enrollments. But when I run it as an external script from a script in People.fp5, I get a FM error "Object not found" at the point where it tries to access cells in the "current record". Where *is* that dang object?!

People has a layout with a portal into Enrollments. When you click on a portal row, it runs a script that begins, roughly:

-----

Goto Related Record[EnrollmentsByPeopleID] // same rel.ship used by the portal

Perform Script[subscripts, External: Enrollments.fp5] // namely, the following script...

-----

Here's how the FM script in Enrollments begins (as you can see I wasn't quite certain how specific I had to be about what app/database I was referring to).

-----

property debugParameterName: "c_Debug"

property fileNameParameterName: "g_ScratchFileName"

global debugSwitch

global scratchFileName

try

--tell application "Filemaker Pro"

--tell database "Enrollment.fp5"

set debugSwitch to (cell debugParameterName of current record)

set scratchFileName to (cell fileNameParameterName of current record)

--end tell

-- end tell

on error errMsg

display dialog "BUG - couldn't fetch cells '" & debugParameterName & "' or '" & fileNameParameterName & "' from current record." & return & return & "Error=" & errMsg

error

end try

-----

You have not specified a window. Therefore your applescript is acting on window 1, which is NOT Enrollment.fp5. Either put a window refresh/bring to front statement in the Enrollment.fp5 script before the perform applescript statement; or do something like this:

set debugSwitch to (cell debugParameterName of current record of database "Enrollment.fp5")

  • Author

Rog. Thanks, that was the problem.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.