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.

Referring to a field from within a script

Featured Replies

  • Newbies

I thought I was quite good at problem solving but this one has me whacked…

I’m trying to write a script whereby I can refer to “the current field” without using its specific name.

The database is a school report for each student in which teachers will put “ticks” in fieldA, fieldB, fieldC etc by clicking on the relevant fields. So a simple script would be:

Allow user abort [Off]

Set error capture [On]

Insert text [select; S1 Reports::FieldA; ü]

# “ü” in “Wingdings” font converts to a “tick”.

However, this means I have to write individual scripts for each field.

Is there no way of introducing the equivalent of a “CurrentField” variable or some other solution to this?

Thanks for your help. :(

What exactly is each of the relevant fields... it sounds like you might be better dumping this in a related structure but hard to tell when you give examples like "fieldA", "fieldB", "fieldC" etc.

If you use set field [] or other script steps that ask you to specify a field, you can leave that part blank and not specify one.

Then the script step will act on the currently active field. You can script moving through fields on a layout to iterate through all the fields you want. I have attached an example file.

test.fp7.zip

  • Author
  • Newbies

Thanks for this. It allows me to identify the field alright but I'd have to write individual scripts for each field I want to insert a tick into..

I take genx's point that I'm not making myself very clear so I'm attaching the file to let you see the kind of thing I mean...

Thanks again.

Copy_of_S1_Reports.zip

The only way I know to run a script immediately upon entering a field is to use a plugin. I've attached a solution that uses such a plugin along with the plugin file. Eventscript is a free plugin and the readme file is included in the attachment. I excluded the demo files to save on attachment size but included a modified version of your file with the plugin function calls inserted.

You'll have to place the plugin file in the extensions folder of filemaker for the solution to work, and you'll have to be logged into the test account for the validation trigger to be active. (This is the default account now)

Now when you click in an empty field, the check mark is inserted, and when you click in a non-empty field the field is cleared.

Let me know if you have trouble getting this to work.

Dana

EventScript_v1_1_ForWindows.zip

Here is a slightly modified version of the file that will only run the script if the field clicked into starts with the characters "AD_S1"

Another option for this of course is to just make each of these fields into native checkbox fields and have users check and uncheck the fields that way.

Copy_of_S1_Reports.fp7.zip

  • Author
  • Newbies

Works a treat! So grateful because that has saved me hours of low level scripting. Thanks too for the second idea of narrowing the application of the script - that should come in handy too. Cheers!

Stuart

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.