Jump to content

Recommended Posts

Posted (edited)

Hi all,

I have three buttons in a popover. Each button exports records as excel with the only difference among the three buttons is "which" records are to be exported:

  • Current Record (Always just one record)
  • Found Records (Always a varied quantity)
  • All Records (All records within the table)

Initially, I had three separate scripts (one for each button) and they all worked. Now, I want to consolidate these three scripts into one script.

I thought I could branch each of the three button's script steps by using each button's unique object name as the differentiator.

WHAT I DID

  • I created a variable to contain the selected "objects" unique name using Get(LayoutActiveObjectName).
  • I created branching logic in the script utilizing IF/ELSE IF/END IF
  • I created temporary dialog window to show me the results for "debugging" simplicity.

MY RESULT

In Script Debugger, I watch as the branching is completely ignored: it just goes right on pass the branching I put in place. 

MY RESEACH

It appears others have wanted the ability to pass a selected button's object name into a script and they approached it in a similar manner as I did: but it appears that "clicking" on a button does not qualify in FileMaker as "activating" the object, and therefore never returning the object's name.

MY HUNCH

Using Get(LayoutActiveObjectName) is not the right "tool" to obtaining the name of the selected button.

IMPORTANT NOTE

I am already using the "Optional Script Parameter" by using JSON to pass multiple parameters to the script - so I do not know if I can "add" the selected object's name in the JSON "bundle" I already have.

QUESTIONS

  1. Can Get(LayoutActiveObjectName be used in this situation?
  2. Am I implementing the Get(LayoutActiveObjectName incorrectly?
  3. Can I add the name of my button objects to the existing JSON info bundle that I have in the Optional Script Parameter?
  4. What method/technique should I be using to accomplish this branching that I need?

SCREENSHOTS ATTACHED

  • 01__3_buttons_in_popover.png
  • 02__set_variable_scrit_step.png
  • 03__relevant_script_steps_showing_branching.png

Any help appreciated - thanks.

01__3_buttons_in_popover.png

02__set_variable_scrit_step.png

03__relevant_script_steps_showing_branching.png

Edited by dmontano
grammer
Posted (edited)
36 minutes ago, dmontano said:

I thought I could branch each of the three button's script steps by using each button's unique object name as the differentiator.

That's not going to work.

36 minutes ago, dmontano said:

it appears that "clicking" on a button does not qualify in FileMaker as "activating" the object,

Exactly. A button activates only by tabbing into it.

36 minutes ago, dmontano said:

Using Get(LayoutActiveObjectName) is not the right "tool" to obtaining the name of the selected button.

Again, your hunch is correct.

36 minutes ago, dmontano said:

I am already using the "Optional Script Parameter" by using JSON to pass multiple parameters to the script - so I do not know if I can "add" the selected object's name in the JSON "bundle" I already have.

You don't need to add the selected button's object name to the script parameter. In fact, the buttons do not need to have object names at all (at least not for this). You only need to add a recognizable value to the script parameter of each button. It could be as simple as 1, 2 and 3 or perhaps something more explicit - say "current", "found" and "all". Then extract this value from the script parameter and use it to branch your script.

 

Edited by comment
  • Like 1
Posted

Hi Comment

Following your guidance, I got this to work - thank you!

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.