Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 2651 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi guys

Hoping for some intellectual input from those more experienced than I.

I am trying to create a "portable tick box"

By this I mean a script that I can attach to any field to make it a tick box

So far I have created a number field and set it to display all non zero values as a tick.
I have then attached a scriptrigger which runs a script on entering the field

The script is as follows:  Set Field by Name [Get (ActiveFieldTableName)& ::" & get (ActiveFieldName);Abs (Get (ActiveFieldName)& "::" & get (ActiveFieldName)-1)]

 

This way if the field is empty it will be set to 1 and if it isn't it will be set to zero.

So far, when I click into the field it correctly sets it to 1 and displays the tick but it remains at 1 and won't zero which I don't understand.

 

Can anyone see the flaw?

 

Joseph

Posted
Get (ActiveFieldName)

gets the field's name. You want to modify the field's value, so set the field to =

Abs ( Get ( ActiveFieldContents ) - 1 )

or simply =

not Get ( ActiveFieldContents )

 

Posted

Awesome. This works really well.

I notice though that by using this method, that the 1 or 0 becomes momentarily visible before seeing the tick

If I set the field directly ( set field rather than set fieldbyname) that the 1 or zero is not displayed

Posted
2 minutes ago, eyedoctor said:

I notice though that by using this method, that the 1 or 0 becomes momentarily visible before seeing the tick

That is the nature of the hack you have devised: a script triggered OnObjectEnter runs after entering the field - and while a field is active it will display its contents unformatted. If you use a button instead, the field won't be entered at all and you won't see the raw contents.

What is the purpose of these boxes?

 

Posted

They are just tick boxes.

Look better than the native Filemaker ones.

Problem with attaching a script, is that the field is not entered and so the Get(active fieldname) won't work because the field is never active

Posted
1 hour ago, eyedoctor said:

Problem with attaching a script, is that the field is not entered and so the Get(active fieldname) won't work because the field is never active

That is correct: you need to use a script parameter to identify the field. Or attach a single-step action to each button.

Posted

I think that in the end, this is probably a better and simpler approach.

Thank you for your advice

 

Joseph

This topic is 2651 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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