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

Hello,

I have a tab control panel with four tabs, and I would like to achieve that when I change tabs a script is triggered and would set the value of a global field called "zzz_g_collection_type" according to the tab name which is active.

I need this field to dynamically filter the products that are shown on 1_row portals that I have put into each tab panel space.

I have followed Elishree Dey tip on http://burnignorance.com/filemaker-pro-tips/trigger-a-script-when-user-changes-the-tabs-in-filemaker/ but I cant make it work, it only changes the value of "collection_type" field once and only to show that the first condition is not met.

I have attached the picture of my script.

My initial idea was to place on each tab space a picture-field of a product as a 1 row portal and then duplicate as much as products I have so when I click on the picture a script is triggered and the product is added to the invoice.

Morever, I have set an Object name to each tab Control so it would work, and also the desired value for zzz_g_collection_type comes from another related table with only one record that I use as preferences, this is on Preferences Table I have three fields called "Product_Type_Short_#" and those match on Elishree Day script tutorial.

Any ideas what I could be doing wrong?

Screen Shot 2016-10-07 at 22.19.34.png

Edited by docasar

You have FileMaker Advanced. Have you tried stepping through it with the script debugger?

You could probably do this more simply:

If [ Get ( TriggerTargetPanel ) = "Bottles"]
	etc.

 

What would work:

If [ getValue( Get( TriggerTargetPanel ); 2 ) = "Bottles" ]

  • Author

Hi BruceR,

Many thanks for your tip. I am still quite new to filemaker scripting, and dont understand very well your suggestion. Could you please guide me a little be more about where to put the function within my script? I put it instead of  If ( $isBottlesInFronTab = 1 ) but it is not working... any further ideas?

Thanks a lot in advance for your help

Sorry, no. Why not use what has already been given to you quite clearly by Tom and myself?

When asking for help it is very important to give enough information to make the helper's job easier. Saying "I tried something and it didn't work"; well; doesn't work. Better to post a complete copy of your script; or your file; or a simplified version of your file which you have gone to the effort to construct in order to demonstrate the problem.

On 10/7/2016 at 7:57 PM, BruceR said:

What would work:

If [ getValue( Get( TriggerTargetPanel ); 2 ) = "Bottles" ]

Yes, sorry about that. Thanks for catching that, Bruce!

On 10/7/2016 at 1:23 PM, docasar said:

I have a tab control panel with four tabs, and I would like to achieve that when I change tabs a script is triggered and would set the value of a global field called "zzz_g_collection_type" according to the tab name which is active.

My initial idea was to place on each tab space a picture-field of a product as a 1 row portal and then duplicate as much as products I have so when I click on the picture a script is triggered and the product is added to the invoice.

Reading over your initial post, I may have misinterpreted what you're asking. First you say you want to set a field when you change tabs. That's where TriggerTargetPanel would make sense. 

Then you say you want to click on a field and trigger a script At that point you're already on the tab panel, so TriggerTargetPanel wouldn't apply.

So... what do you see when you step through with the debugger? Do the variables get set as expected? Do the tab names match your script?

  • Author
15 hours ago, Fitch said:

Yes, sorry about that. Thanks for catching that, Bruce!

Reading over your initial post, I may have misinterpreted what you're asking. First you say you want to set a field when you change tabs. That's where TriggerTargetPanel would make sense. 

Then you say you want to click on a field and trigger a script At that point you're already on the tab panel, so TriggerTargetPanel wouldn't apply.

So... what do you see when you step through with the debugger? Do the variables get set as expected? Do the tab names match your script?

Hi Fitch,

Many many thanks for going back to my initial post. I am sorry for the confusion regarding my goal. I will try to reexplain :)

The whole purpose of this is to build a POS. Graphically it would look like a 5x5 grid that will display all our products, and when you click on the product (represented by a picture of the product itself thanks to a 1row portal for each product ) it will add that product to an invoice as a line_item. Since we have four categories of products the idea would be that I would place the 5x5 grid on each tabpanel and the products shown by the 1row portals would be related to the category that match the tab name. In order to make this work, my initial approach was to filter the portals according to the value of one field (zzz_g_collection_type) that would dynamically change when the user click on each tab.

So what I need to achieve is that the value of the field "zzz_g_collection_type" changes accordingly to the active tab.

Reading through Elishree Dey tip I tried again and "magically" now the script is working. I am attaching a sample file with the script in case this might help anybody else in the future.

I cant stress enough how grateful I am for you guys putting your effort and time to help us newbies when we struggle so much...

Thanks a lot again.

Luis

TabPanelControl.fmp12

Here's a data-driven extension of the technique.

Uses the originally discussed on OnPanelSwitch technique, not on object modify.

TabPanelControlMOD.fmp12

Edited by BruceR

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.