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.

Featured Replies

One of my most favorite tidbits of knowledge that I gained while at Devcon (thanks to Andy Le Cates) was a very elegant method of setting fields by indirection.

As you know the Set Field command requires you to manually choose a field in order to set it. But sometimes you may have a layer of abstraction or have a large number of fields to set based upon data contained in your records. Thus your script will be rather lengthy because you need to target each respected field.

Well with a new feature of FMP 8.5 script step Goto Object and use of Layout Object names you can effectively set a ton of fields via indirection...


Go to Layout [ “DEV - art” (art) ] 

Show All Records 

Go to Record/Request/Page 

[ First ] 

Loop 

Go to Object [ Object Name: art::name; Repetition: art::rep ] 

Set Field [ art::graphic ] 

Go to Record/Request/Page 

[ Next; Exit after last ] 

End Loop 

Go to Layout [ original layout ] 

[float:right]

[/float]In this example i need to set a bunch of fields to the value of the records in the table.

By NOT specifying a target field with the Set Field command and placing the Go to Object just before the possibility unfolds allow my script to be simple and understandable.

Each field on the layout was given a name using the Object info pallet, corresponding to the a record in the art::name field. Some fields on my layout have repetitions and the second repetition parameter of Go to Object allows me to target that repetition.

Nifty! Maybe this will placate some of those poor souls who've been begging for a dynamic Set Field[] for so long.

But I wonder...is LaCates going to hunt you down for sharing his intimate secrets with the rest of us? :) Maybe you can send him a poster!

  • Author

:)

I am sure he can recite each function and its definition and a dozen examples upside down & blindfolded in no less than 90 seconds.

- one caveat to this is if you run your DDR thru Inspector it feels Set Field with out a field specified is an error, and it will report as such.

It also requires the field to be on a layout, and the script to be on that layout.

All things considered, it's not that much different from looping thru the fields on a layout.

Yes, it is not all the much different from a properly done loop. However, if you cannot be sure of the order of the data coming in; ie., your loop in pre-8.5 would have to start over at the 1st field for each Set Field. Going directly to the object is much faster. Only 1 split-second instead of 10 :)-]

:laugh2: :laugh2: :laugh2:

You don't happen to have a small demo file of this do you? That would most helpful to one (me) who is not so skilled. :frown:

Thanks!!

James

www.james-mc.com

Here is a small file that parses web-submitted forms. It uses Go To Object on the Form layout.

ParseEmailLoop8_5.zip

Thanks, Fenton! I'll have a look!

  • 2 weeks later...

I like the parsing web forms example since I use it in a class I teach. I've tried to make it as adaptive as possible over the years. I'd be interested in seeing other examples of what people are doing with loops and Go to Object or just Layout Object Naming in general.

Yes, I'd like to see those same examples myself.

Here are a couple of of object based examples ive been playing with ... my favourite is the calculation based on the merge field :)

best

Stuart

DynamicTickbox.fp7.zip

Hi Stephen,

thanks for the feedback...

--- [color:red]Retract request ...see below (I must remember to think before i speak/post :)

[color:#cccccc]Do you think its worth starting an Objects or Objects, Parameters & Variables Forum as i think they are pretty major for developers and would love to be able to have a focused response on these kind of questions when they arise and i dont quite have a place to put them at the moment.

---

These things really really excite me (don't meant to sound odd, but they are changing the way i work fundamentally).

Maybe I'm alone on this one and you may not feel their major enough, so just a thought. :(

best

Stuart

Edited by Guest

Actually on reflection turning objects into a forum would not quite work as they are so dynamic and refer to pretty much all of the other forums anyway. Having an Objects forum would probably be more confusing in terms of posting than a help.

Having a forum for a script step or function is extreme... it would just be nice to stimulate more discussion and focus people on opening up the possibilities ...

Which i suppose is what you are doing with this post so thank you for that.

best

Stuart

  • Author

Stuart, thanks for the feedback. I did get your request but that got me thinking about the forums and exactly where to put it as it affects so many areas. I ended up reorganizing some forums in hopes that people will choose a forum to better target their issue. Right now there are so many posts that have little to do with the forum they are in. - Our moderators are doing what they can to move them to where they should be filed.

Many thanks for your reply,

Its good to see Define Fields back on the top level.

Although also a bit off topic, I have posted a file that takes advantage of 8.5 and its new features ... my hope is that it could be a good open source project with small contributions ... and hope that yourself and John Mark may take a moment to look at it.

http://fmforums.com/forum/showtopic.php?tid/180252/

Best

Stuart

Hi John Mark,

Here is a little object trick just for you Portal Visibility http://fmforums.com/forum/showtopic.php?tid/180353/ :beer:

best

Stuart

  • 1 month later...

Hi, nice!

Just a helpful tip for people debugging when they have problems with go to object for dynamic field-setting...

Go to object[ objectNameOfField ] doesn't work if the field you wish to go to has a button attached to it!

In that case the button is selected with a thick border instead of the field being selected...

...that caught me out for a while.

Have fun everybody!

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.