Jump to content
Monarch

Trigger on tabs, for changing global field

Recommended Posts

Is it possible to set a trigger on the tabs that sets one global field/one variable?

For example: I have seven tabs: Monday, Tuesday....Sunday.

Clicking each tab would set a variable: Mon, Tue... and so on accordingly.

But I can't assign script parameter to each tab - it sees it as one script with one parameter.

I can name each tab as object, but how do I extract object name and use it for changing data in the field/variable?

I hope it's clear...

Share this post


Link to post
Share on other sites

Hi Monarch

You can use the Get ( TriggerTargetPanel) function to give you the index number and object name of the panel that you are switching to, and you use the OnPanelChange trigger to run a script to make use of that.

I've done a simple test file for you to take a look at if that helps?

 

TEST.fmp12

Share this post


Link to post
Share on other sites
2 hours ago, Monarch said:

I have seven tabs: Monday, Tuesday....Sunday.

Are you sure you need to have seven different tabs? I would suspect seven buttons (possibly arranged to look like tabs) would be sufficient.

Share this post


Link to post
Share on other sites
16 hours ago, rwoods said:

Hi Monarch

You can use the Get ( TriggerTargetPanel) function to give you the index number and object name of the panel that you are switching to, and you use the OnPanelChange trigger to run a script to make use of that.

I've done a simple test file for you to take a look at if that helps?

 

TEST.fmp12

Thank you rwoods!

As always - it's simple... These "get" functions can really get me.

Thanks again!

14 hours ago, comment said:

Are you sure you need to have seven different tabs? I would suspect seven buttons (possibly arranged to look like tabs) would be sufficient.

Thank you comment.

Yeah, I am considering the same thing - buttons vs. tabs...

Not sure what would be more efficient:

a. multi tabs with same portals in each tab, but different filtering.

or

b. buttons, as you said, with one portal, but more complex dynamic filtering.

But here my concern is - if I have thousands records in the portal to filter, would it slow it down filtering if I use buttons?

Share this post


Link to post
Share on other sites

If you have thousands of records, then you probably don't want to use portal filtering at all. In any case, this is a separate issue. My point was that you probably don't want (and don't need) to replicate every object shown in the tab control 7 times. And have to carry out every design change 7 times.

Share this post


Link to post
Share on other sites
On 2/11/2017 at 3:02 AM, comment said:

If you have thousands of records, then you probably don't want to use portal filtering at all.

Well, then how do I do it, if not filtering, thru relationship?

And yeah, you are right about 7 tabs. It didn't feel right, so I am going to do it with seven buttons.

Share this post


Link to post
Share on other sites
9 hours ago, Monarch said:

Well, then how do I do it, if not filtering, thru relationship?

I can only guess (since you never explained what exactly your filtering does), but in general you would have the buttons set a global field instead of a variable, and instead of filtering the portals, you would filter the underlying relationship by adding the global field as a matchfield.

Share this post


Link to post
Share on other sites

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

  • Similar Content

    • By wedgeman
      I've been searching for some clear answers on db vulnerability, specifically related to scripting.
      We have a particular solution running in FMP13, with EAR. This is a peer-shared file design, which has hundreds of installations in peer-shared environments.
      User access accounts have been severely limited in released versions (no admin, no [full access]), limited menus, etc..
      Users are heavily striated by account privilege set.
       
      I've read bits here & there mentioning that initial opening scripts (onwindowopen, etc) at startup are particularly vulnerable, but haven't found anything definitive.
      1. is an opening script trigger a legitimate security flaw?? We use it to determine layout paths, check/confirm licensing, etc, so if it is 'hackable', what alternate option is there?
      2. I noticed that even attempting to bypass script triggers, the system requires a full access name/password.. BUT it also displays the name of the particular script (seems like a point of weakness to me)... Is there a way to prevent this?
    • By Joel Shapiro
      Hiya
      Can FMPerception show the elements that have script triggers that call a specific script?
      Thanks,
      -Joel
       
    • By michael3785
      I have avery big solution that was built in FM7 originally and it needs a UI overhaul. So, no themes are as good as they are I am rolling up my sleeves and putting together a reference design. have been looking around at design templates to lift (speaking frankly) and I like the FM Starting Point design. However there are a few things I need to tweak that I can't readily see how to do it in Inspector. The main one is the height of the tabs in the tab controls. They are too high for my layouts. As far I can see I either have to hack the CSS somehow or I have to use a conditional fomatting workaround, set the text size really small to reduce the height of the tab, then conditional format the text back up to the correct size, which is a bit yuck, seeing as I have lots of tabs.
      Any advice much appreciated. Many thanks.
    • By docasar
      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?

    • By Scott Pon
      Environment: FM13 with FM13 Server, mix of Windows 7 and 10.
      Is there a way to set a script trigger on if this portal row is new? IE, a script to run if this new child/portal record is new.  
      We have a parent record, and portal to Children records.  The children records have 2 fields: Profile Name and Process type.  Our user would like to enter a new child record (profile name and process type).  if the process type already exists, we will need to archive the existing record (matching the profile type).  There is more bI want to start with this first.
      I see script triggers to the layout "OnRecordCommit", but no similar script trigger for portals.  Any ideas on how to handle this?  Or am I going to have to add a button to go to another screen to accomplish this?
      Thanks.  I hope i gave enough info for you to help me.
       
×

Important Information

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