Can a button (or button bar?) find it's name when not active?

I have a collection of buttons which all behave the same, but they change based on which portal row and layout they're in and I want to make the object self-aware somehow.

image

So when you're on engagement layout on the phone button I have the following code:

  • Button Perform Script: Set the field Engagement::Type = "phone"
  • Conditional Formatting: If the field Engagement::Type = "phone" change icon color

On the student layout engagements are related to student so within the engagement portal I have the following code:

  • Button Perform Script: Set the field Student_Engagement::Type = "phone"
  • Conditional Formatting: If the field Student_Engagement::Type = "phone" change icon color

There are about 5 different portals and layouts which show this information, and I want to generalize my code so I can just copy-paste the buttons.

Is there a reasonable way to do this?

Is there a way to find out the context of an object? For example if I could find out that a button is within the portal "Student_Engagement" I could do everything very easily.

Alternately, is there some way that Filemaker can find the name of itself? It seems to be able to find the name of the active object, but to get the conditional formatting to work it needs to know that name of "self" sort of... but does a button even have a concept of "self"?

1 Like

On a button bar, you can perform calculations directly in the active segment, in the button label, in the script parameter dialog box. You can use calculations via conditional formatting on a button bar segment and on the button bar. You can use the hide object calculation on a button segment and on the button bar.

You can modify the button bar indirectly by using variables as text placeholders. You can use variables in calculations which control the appearance, display characteristics, and label of the button bar and its segments.

And finally, the script that is triggered can be coded to be context aware. For example, if the layout table name is Student, then use the "Student_Engagement" portal, else behave differently.

2 Likes

If you hide a button bar segment, the size of the button bar does not changes, but the size of the remaining segments DO. In this case, add additional button segments, with the opposite HIDE condition, and IF you are using icons in the button bar segments, set the segment conditional formatting to "true" and the icon to transparent, so that when it does show (as a placeholder to maintain spatial integrity of the button bar), it will be completely transparent to the user.

1 Like

If you have FileMaker Pro Advanced, explore the DDR - Database Design Report. It provides extensive cross reference information of almost everything within a FM solution. 3rd party tools - all in the $500 range - do an awesome job with the DDR, but the native (free) HTML version in a browser is quite useful as well. You can cross reference where anything is in FM from anything else through the DDR