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

Getting Active Field Contents from a button field...

Featured Replies

Greetings Fellow FileMakers -

I have a field, call it Field1, it's a Container Field (albeit, the same thing happens with a text or any other type field...). When I turn that field into a button, and attach a script to it to look at itself - it doesn't see the data (I run a Show Dialogue after Get(ActiveFileContents) it shows nothing) (or I Set some other field to it and nothing shows up...). I subsequently noticed that there are two tab numbers attached to each buttion field in the layout.... hmmmmm. Side point: If I make one of the two (the first) buttons active from a tab perspective, it seems to get the field contents. When I make both, neither or the second tab only active, it does NOT get the field contents... not sure what is going on with tabs...]

Anyway, what I WANT is to toggle a container field back and forth with an on and off image, but I first must test for what is there to put the other one there... How do I get what is there to test? I can hardwire it for each field I want to do this with and it works. But I want to make a single script that will test the button I am currently pressing, pass that variable to the script, test it and bring back the appropriate icon (image - actually, a green on button or a red off button). I have 50 buttons on the layout so I don't want to write a script for each button (and a button is a container field1 through container field50).

The Logic part seems to work - even with a container comparison! it's just getting the data in and out that I'm having trouble with...

If[Table::ContainerField1 = Table::RedButton]

Set Field [Table::ContainerField1; Table::GreenButton]

Exit Script

End If

If[Table::ContainerField1 = Table::GreenButton]

Set Field [Table::ContainerField1; Table::RedButton]

Exit Script

End If

I can test container fields fine.

Any thoughts on geting the data from the field with a button on it?

Thanks in advance,

Royce

Only if the Table::GreenButton or ::RedButton are globally defined can you expect correct behaviour sans relational links with according ID's primary as well as foreign.

The usual way is btw to have one single global repeating containerfield which you then can use all over the place via:

http://www.filemaker.com/help/FunctionsRef-338.html

....via a field recieving numbers to pull the correct one. However is a neater tecnique to fill or build a button with stings of unicode chars in mergefields - because it then is based on the operating system behind each client tool instead of a value stored on server side of the matter - gives less chatter in the network.

But the newest tecnique is to preload all these images references into $$variables in the init-scripting.

--sd

  • Author

Hey - I like ABS technique...that was smart...

I can do these things okay - the trick is passing WHAT field I am clicking on to the script....how to grab that info... (ActiveFieldName)...It doesn't want to give the name from the fieldthat is also a button.... and I have 50 field/buttons to choose from, yet use the same script... Does that make sense? Am I being clear or muddy...

Thank,

Royce

You can't so it the way you describe. When the field is a button, it doesn't activate. I am not sure what purpose do 50 on/off buttons serve, but perhaps you could use repeating fields here. Then you could pass the repetition via script parameter (you would still need to define each button separately, but the script would be the same).

  • Author

Hello Michael -

I am laying out an anolog Mixing console for people to keep settings visually for manual recall (they do not have a digital console).

I got it to work sometimes....field will activate when I only set the first Tab Order button (which activates the field...) but not always...

Maybe I can better do it with a custom function...

I do agree with you about being able to do it...but something tells me there's a way...it's that feeling you get when you just can't let it go.... Royce

I didn't say it couldn't be done - just not the way you describe. So what are these 50 settings? Is it just 50 channels mute on/off, or are there multiple buttons per channel?

  • Author

25 buttons per channel...usually 24 - 56 different channels. Each channel is a Record...all the settings are stored in fields. I have recreated the look of the mixer to make it easier for them and I want them to be able to hit the particular switch as it actually appears on the console...the knobs are going to be even more fun!

Thanks for the help,

Royce

Here's a sketch of how it could be done with repeating fields.

Another option is outlined here - but I think setting 25 script parameters might be easier in this case.

MultiToggle.fp7.zip

Hey comment - I don't get how

not Channels::StatusR [ Get ( ScriptParameter ) ]

returns 1 or 0

infact i don't get that statement at all, its foreign to me?

True is 1, False is 0.

Therefore:

not True = 0

not False = 1

also:

not 0 = 1

not (any number other than zero) = 0

great didn't realise you could use

[ ]

as a boolean if test

brilliant as usual Michael

Thanks

Ahem... I don't think you CAN use [] as a boolean test.

not Channels::StatusR [ Get ( ScriptParameter ) ]

is the same as:

not GetRepetition ( Channels::StatusR ; Get ( ScriptParameter ) )

The "not" part refers to the CONTENTS of the specified repetition.

Ahem indeed, Thanks for the clearification.

That would have hurt my brain if you had not told me.

have not utilized either parts of your calculation to there full potential before.

I will use these often now.

It's sometimes hard to change when you have been doing things in similar ways for so long.

This is exactly why the forums are so great for me.

:

Take a look at the field format for the repeater, it's a number boolean formatted with a = for "true" and nothing for "false"

--sd

Check out this topic and the link on this post its pointed too for other uses of this useful trick.

Link

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.