9 Replies Latest reply on Aug 11, 2013 4:24 PM by RichardBrown

    Display data in related field from related table in different layout whilst in browse mode

    RichardBrown

      Title

      Display data in related field from related table in different layout whilst in browse mode

      Post

           I have joined the Lynda.com tutorials and browsed this forum but can't find the answer to my problem so I apologise if this has been posted before. I am very new to Filemaker and am trying to make a content management system for my fitness studio. I would basically like to store the information of my clients and what and when they have paid for their memberships. I have therefore created 4 tables: Clients, Product, Line Items & Invoices. I would like the User to be able to switch from the home screen (related to the client table) via a button to the Create Invoice Screen/layout (related to the Invoice table) but have the name of the client still visible in the field / box which was in the Home screen to make it easy to create the invoice for the person whose details were in the Home Screen. I have created a relationship between the field 'Client Id' from the Client Table (__pkClientID) and a field in the Invoice Table (_fkClientId). On the Invoice layout I have related the layout to the Invoice table and placed a field on it from the Client table simply labeled 'Client ID'. I thought that when in browse mode this would give me the same client id in both layouts however the field in the Invoice layout is blank and it it driving me nuts trying to work this out ! I'm pretty sure it will be something simple so I hope all of this makes sense to someone as I find it hard to just even explain what I would like - far less find the answer ! If anyone out there can answer this I would be ever so grateful. Regards - Richard.

        • 1. Re: Display data in related field from related table in different layout whilst in browse mode
          SteveMartino

               I think you may be looking for something like this:

               From your client table

               Set Variable  (click "specify" button, lower right hand corner)

               Under Name, pick name of your variable, ie   ClientIdMatch.

               Under Value pick TableYourOn::FieldYouWantToMatch, ie  Client Table::__pkClientID

               Repetition stays as 1, hit ok.

               So the script will look like:

               Set Variable [everything you picked will end up here]

               Go To Layout [You select layout in 'specify']

               New Record/Request

               Set Field [you specify Invoice::__fkClientID and for calculated result, you select your variable ($ClientIdMatch).

               Attach it to a button.

               Here's what the script looks like in my database.  It checks to see if the customer has a related record, if it does, it goes to the related record, if it doesnt, it asks if you want to create one.  If so, it goes to the correct table, opens new record, and put the key in, which populates the name field with the correct name.

                

          • 2. Re: Display data in related field from related table in different layout whilst in browse mode
            SteveMartino

                 I also selected the button and added this tooltip.  When you roll over the button for that customer it will tell you how many related records the customer has--in my case, how many pieces of equipment.

            • 3. Re: Display data in related field from related table in different layout whilst in browse mode
              RichardBrown

                   Wow ! Thanks so much Steve for taking the time to answer. I really appreciate it. It's getting late over here in Shanghai and the brain refuses to work any more right now so I will take time to look over and study all the info you posted here tomorrow. I'll let you know how I get on. Once again thanks very much ! - Richard

              • 4. Re: Display data in related field from related table in different layout whilst in browse mode
                RichardBrown

                      

                     Hi Steve -
                     Thanks so much for the help and I think I have some of it understood - am I creating a 'Script' ? . Sorry that my knowledge of terminology is so limited. Also  from your reply : 
                      
                From your client table Set Variable  (click "specify" button, lower right hand corner) 
                      
                     Where do I find the 'specify' button ? - I don't see anything like this in any any views - should this be in the Manage Database section under Layout View ?  - As I can't find this option I have looked up a few things and tried to set the button as follows :
                     To try and set the button to invoke/run a script : (is this the correct thing to do ?)
                     Right click button in layout mode,
                     Selected 'button set up'
                     Selected 'Perform Script' - then on the right side 'Current Script - Pause' - then clicked 'Specify'
                     Then in the box I selected 'New Script' and clicked the little arrow next to the + & - sign and chose 'edit'.
                     From these options I selected 'Set Variable', 'Go to Layout', 'New Record/Request' and Set Field.
                     Under Set Variable - I gave the name $ClientIDMatch, for Value I specified Clients::_pkClientID, and for Repetitions I chose 1
                     Under Go to Layout I specified 'Invoice'
                     Under New Record/Request there are no options
                     Under Set Field - I specified Invoice::__fkClientID (after which the 'specify target field box became checked). However under the 'Calculated Result' option I have no idea what to choose. I'm sorry but I don't understand the last part of your help where you state :
                      
                Set Field [you specify Invoice::__fkClientID and for calculated result, you select your variable ($ClientIdMatch).
                      
                     I can choose as follows : Set Field[Invoice::_fkClientId; $clientID]  BUT I can not find the $ClientIDMatch value anywhere under the options available when I click the 'Calculated Result' 'Specify' button .......
                      
                     I think I've nearly got it but at the moment when I go to browse mode and click the button Filemaker freezes and then closes after a couple of minutes.
                      
                     Please refer to this screen cast: http://screencast.com/t/hrNTWvi9RQI
                      
                     Thanks very much for your patience and I hope that you can help clarify things for me  - Regards: Richard
                • 5. Re: Display data in related field from related table in different layout whilst in browse mode
                  SteveMartino

                       Yes you are creating a script, and attaching it to a button.  I think you're just about there.  The screen is freezing probably because you didnt finish the script.

                       I think you answered your first question about finding 'Specify'.  Whenever you're creating a script, in the Edit Script box (where you're assembling the script) if there is an option to Specify, it will show up in the lower right hand corner. 

                       You were tripped up by something that probably gets everyone at first and took me a lonnnnnnng time to figure out.  A variable is not a field, so you probably wont find it anywhere. 

                       When you select 'Set Field' in the Edit script box, it will highlight.  Under 'Calculated Result' you just type in the variable (or to make sure you dont make a typo, copy and paste from the script).

                       That should do it.  Post back if you need more help. 

                       edit:  Forgot to mention, if you have FM Pro Advanced, you can open up Script Debugger, and Data Viewer.  When you run your script, you can step through each step of your script, to make sure it's working properly.  and the Data Viewer will show you whats getting passed  for the variable.

                  • 6. Re: Display data in related field from related table in different layout whilst in browse mode
                    RichardBrown

                         Fantastic - I just did it and it worked straight away ! Thank you so very much Steve - I really appreciate your help and taking the time and effort to reply to my problem. I have no idea what I could have done if it wasn't for your help and this forum. Much appreciated.

                         Best regards, Richard

                    • 7. Re: Display data in related field from related table in different layout whilst in browse mode
                      RichardBrown

                           Oh and now I can have a go at the 'Tooltip' you suggested :)

                      • 8. Re: Display data in related field from related table in different layout whilst in browse mode
                        SteveMartino

                             Go for it!!!

                             I'm still only a beginner.  When it gets harder, the experts will have to help you :)

                             I've only been at it for a little over a year now.  I would  recommend the following 2 books, with their related tutorials.  They really explain things rather well, and offer sample files. 

                             FileMaker Pro 12:  the missing manual.      http://search.oreilly.com/?q=filemaker

                             FileMaker Training Series (available on this site). Now go have some  frustrating, angry, let-me-try-this, almost-got-it, what-else-can-I-do.......fun!

                        • 9. Re: Display data in related field from related table in different layout whilst in browse mode
                          RichardBrown

                               Thanks again Steve - I'm most certainly getting the Filemaker Pro 12 : Missing Manual. Gonna carry on with the Lynda.com for a while as well. Best regards - Richard