Karlos Fandango Posted April 21, 2015 Posted April 21, 2015 I'm writing a database to control quotes, the main related tables are... Customers Quotes [join table] Jobs I have also created one more table called "DASHBOARD" with one record and one ID field which is locked, i.e. you can't create anymore records. On the DASHBOARD layout I have a TAB CONTROL, each tab has a portal showing my quotes [pulled from join table] filtered by a statues field such as... Waiting to quote Chasing Lost Won Dead The Status of each quote is qualified by a drop-down, pulling from a defined list, additionally there is a date field informing me when to chase the customer again, which has another calculating days up to and passed the chase date. Thus when the user first opens the file in the morning, they are presented with the TAB CONTROL on the DASHBOARD, which flicking through can instantly know which jobs to quote, which to chase and the REST to analyse data as well as FOR other purposes. Thing is, I'm pretty new to filemaker but have through this forum managed to accomplish things well over my head, and learned quite a bit in the process.My problem here is, that when the user enters one of those five portals, they will have the option of clicking onto a button in a record, which will take them to a 'form view' of that individual record, there to edit and get more information. However I need to place a button on that 'Form View' that will not only take them back to the 'DASHBOARD LAYOUT' but to the very Portal they were first viewing before they clicked the button that took them to the 'Form view' of that record. I'm pretty sure, [though not absolutely] I can get them back to the right layout, tab and portal by using 'go to object' or something like that, I've done that before though on that occasion it was to a portal on a layout only, no tab control was involved.No my problem is... as there are five portals that the visitor come from, how will it know which to return to? I could just drop back to duplicating the 'Form View' until there are five versions, each with a button going to one of the five portals, but I've seen that scripts can change the value of a variable by passing on parameters?Thus when I click on a record in say the "Waiting to Quote" portal, it changes the value of a set variable called say "Status" to 1, then when I press the BACK BUTTON on the Form View, seeing the value of the variable called 'Status' is (1) will run one of five scripts via I guess an "If statement" which will take the user back to the portal called "Waiting to Quote"... and so on for each portal. Not knowing anything about variables, I keep thinking about using a field to do the same, setting within the script of the button that takes the user to the Form View, a script setting the value of a set field to say (1), then the back button having an "if statement" that looks of the value of the set field... and runs the right script to return the user to the right Portal [object]; Anyway, I hope you get where I'm coming from. Again... I'm new to Filemaker but through step by step instructions offered by this forum, have managed to accomplish things way over my head. Yet if you can help, assume you are instructing a child, a fifty two year old child but regards filemaker... a child all the same. I've attached the file in its present state, not styled, rough and no where near ready but it may help someone to help me. Thanks. Jobs-58.fmp12
comment Posted April 21, 2015 Posted April 21, 2015 The easy way to solve this - or more precisely, avoid it - would be to open a new window when going to the specific quote, then close it to get back to the dashboard exactly as you left it. Other than that, I'd suggest you learn about script parameters: http://www.filemaker.com/help/13/fmp/en/html/create_script.13.34.html#1046688 1
Newbies Tori_Red Posted April 21, 2015 Newbies Posted April 21, 2015 There's no way that I'd do this with anything *but* script parameters. If you need multiples, look at Six Fried Rice's multi-parameter technique.
Fitch Posted April 21, 2015 Posted April 21, 2015 (edited) Let's not over-think this. FileMaker 13 has a handy function: Get ( TriggerTargetPanel ) 1. In layout mode, click each tab in turn and assign it a Name using the Inspector. 2. Make a script, let's call it "Capture current tab" -- it's a one-line script:* Set Variable[ $$currentTab; GetValue( Get ( TriggerTargetPanel ) ; 2 ) ] 3. In layout mode, right-click on your tab panel and select "Set Script Triggers," then select "OnPanelSwitch" and choose your new "Capture current tab" script. 4. In your script that navigates back to the layout with tabs (or using an OnLayoutEnter script trigger), add this line: Go to Object( $$currentTab ) *Notes: - Be sure to use two $$ dollar signs in the variable name. This makes it a global variable, that will persist in memory after the script runs.- GetValue is used because Get ( TriggerTargetPanel ) gives us a 2-line list, first the tab number, then the name. We want just the name. Edited April 21, 2015 by Fitch
comment Posted April 21, 2015 Posted April 21, 2015 (edited) Let's not over-think this. Well, Go to Object [ $$currentTab ] is just as simple as: Go to Object [ Get ( ScriptParameter ) ] and since the object name is available as a value of a field in the originating table, you could easily do without the extra script, script trigger and the global $$variable (steps 2 and 3 in your post).. Edited April 21, 2015 by comment
comment Posted April 21, 2015 Posted April 21, 2015 There's no way that I'd do this with anything *but* script parameters. As opposed to what?
Karlos Fandango Posted April 21, 2015 Author Posted April 21, 2015 The easy way to solve this - or more precisely, avoid it - would be to open a new window when going to the specific quote, then close it to get back to the dashboard exactly as you left it. Other than that, I'd suggest you learn about script parameters: http://www.filemaker.com/help/13/fmp/en/html/create_script.13.34.html#1046688 Thanks comment, Thought about that, but I have a few layout triggers that name windows that other scripts rely on, so it could get tricky.
Karlos Fandango Posted April 21, 2015 Author Posted April 21, 2015 There's no way that I'd do this with anything *but* script parameters. If you need multiples, look at Six Fried Rice's multi-parameter technique. Thanks Tori, but "Six Fried Rice's multi-parameter technique." looks way over my head!
Karlos Fandango Posted April 21, 2015 Author Posted April 21, 2015 Let's not over-think this. FileMaker 13 has a handy function: Get ( TriggerTargetPanel ) 1. In layout mode, click each tab in turn and assign it a Name using the Inspector. 2. Make a script, let's call it "Capture current tab" -- it's a one-line script:* Set Variable[ $$currentTab; GetValue( Get ( TriggerTargetPanel ) ; 2 ) ] 3. In layout mode, right-click on your tab panel and select "Set Script Triggers," then select "OnPanelSwitch" and choose your new "Capture current tab" script. 4. In your script that navigates back to the layout with tabs (or using an OnLayoutEnter script trigger), add this line: Go to Object( $$currentTab ) *Notes: - Be sure to use two $$ dollar signs in the variable name. This makes it a global variable, that will persist in memory after the script runs.- GetValue is used because Get ( TriggerTargetPanel ) gives us a 2-line list, first the tab number, then the name. We want just the name. Thanks Fitch, that looks promising, I'll give it a go in the morning... if I can make it work that will be great!
Fitch Posted April 21, 2015 Posted April 21, 2015 ...since the object name is available as a value of a field in the originating table It wasn't clear to me whether each tab corresponded to a Status, or whether you could filter the portal by Status regardless of the tab. I got the impression that the issue was that he didn't have a way to know which tab was frontmost on exiting the layout. If the object name is inherent in the Status field, then I agree, no need for global variable and script trigger. (Although it would be resistant to failing if you changed the Status or tab names.)
Karlos Fandango Posted April 22, 2015 Author Posted April 22, 2015 Let's not over-think this. FileMaker 13 has a handy function: Get ( TriggerTargetPanel ) 1. In layout mode, click each tab in turn and assign it a Name using the Inspector. 2. Make a script, let's call it "Capture current tab" -- it's a one-line script:* Set Variable[ $$currentTab; GetValue( Get ( TriggerTargetPanel ) ; 2 ) ] 3. In layout mode, right-click on your tab panel and select "Set Script Triggers," then select "OnPanelSwitch" and choose your new "Capture current tab" script. 4. In your script that navigates back to the layout with tabs (or using an OnLayoutEnter script trigger), add this line: Go to Object( $$currentTab ) *Notes: - Be sure to use two $$ dollar signs in the variable name. This makes it a global variable, that will persist in memory after the script runs.- GetValue is used because Get ( TriggerTargetPanel ) gives us a 2-line list, first the tab number, then the name. We want just the name. Hey Fitch... Your 'Get ( TriggerTargetPanel )' solution worked great, thanks. Out of interest, after naming each tab I made a field called "delete" and assigned it with the value from the variable $$currentTab, I then added this field to my layout and expected it to change its value each time I clicked on a different tab, but although your solution worked fine, the value offered in my 'delete field' remained named after the first tab. "quote"'. I don't need it, just interested in seeing it work real time, maybe I assigned the value wrong, by just going to the field in 'manage database > Fields > Options > auto enter > calculated value > specify = $$currentTab Anyway, thanks again, moving forwards again. Jobs-62.fmp12
bruceR Posted April 22, 2015 Posted April 22, 2015 (edited) You need to set the storage options to "Unstored" and you need to refresh the window if you expect this calc to work. But since you can directly places a merge variable on a layout - why define a field for this? Â Â Edited April 22, 2015 by BruceR
Karlos Fandango Posted April 22, 2015 Author Posted April 22, 2015 You need to set the storage options to "Unstored" and you need to refresh the window if you expect this calc to work. But since you can directly places a merge variable on a layout - why define a field for this? Thanks BruceR I got rid of the field and inserted a 'merged variable' on the DASHBOARD layout as you suggested, it's value doesn't change when I click on different tabs, but when I return to the layout having viewed the 'Quote', then it does name the right tab in the 'merged variable'. This is helping me to understand variables, something I have tried before with limited time but the 'penny never dropped'... feeling a bit nearer to understanding them today, cheers.
Karlos Fandango Posted April 22, 2015 Author Posted April 22, 2015 (edited) "and you need to refresh the window" Please forgive me and excuse my ignorance, but being rather new to Filemaker... how do I 'refresh the window?" Edited April 22, 2015 by Karlos Fandango
comment Posted April 22, 2015 Posted April 22, 2015 and you need to refresh the window Wouldn't it be sufficient to refresh the object?
Karlos Fandango Posted April 22, 2015 Author Posted April 22, 2015 Got it... the variable is now updating visually in real time!
bruceR Posted April 22, 2015 Posted April 22, 2015 Refresh the object: yup, that would be sufficient. It will be useful for Karlos to understand both features.
Karlos Fandango Posted April 22, 2015 Author Posted April 22, 2015 I added 'Refresh Window [ ]' to the "Capture current tab" script, works well, and as said... is helping me understand these things. Jobs-63.fmp12
Recommended Posts
This topic is 3594 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 accountSign in
Already have an account? Sign in here.
Sign In Now