10 Replies Latest reply on Jan 15, 2010 9:15 AM by philmodjunk

    New Record

    glotfi

      Title

      New Record

      Post

      I was Access user, now I am new to FM

      I have 2 tables related by Contact ID

      Table 1 Fields:

       Contact ID

       F name

       L name

       DOB

       Status.

       

      Table 2 Fields

       Contact ID

       F name

       L name

       Summ

       Post

      The 2 tables are related by contact ID. and fields F name are locked together.

       

      I made a button on table so, when pressed it shows related fileds of table 2. It works fine if there were records altready. By if I wanted to open a new record for table 2 by pressing on the button while i am on table 1, it does not work.

      I know how to do it by portals, by I want to do it by pressing a button to open a new record and type the Id number automatically. Access used to do that very easy. Any help please, this is very crucial 

       

        • 1. Re: New Record
          ninja
            

          glotfi wrote:

          and fields F name are locked together.

           


          Not sure what that means...

           

          I assume you want a new record in Table2 that is related to the the record you are viewing in Table1.  If this is the case...

          From your layout based on Table1, have your button run the following script:

           

          SetVariable [ $ID ; Table1::ContactID ]

          GotoLayout [ Table2layout ]  ###any layout based on Table2###

          New Record/Request

          SetField [ Table2::ContactID ; $ID ]

          GotoLayout [ original layout ]

           

          You didn't mention why you didn't want to do this through a portal, but you did mention that you didn't want to do it that way.  Through a portal is a pretty easy way to do this...but I assume there's a good reason why you choose not to.


          • 2. Re: New Record
            daveealex
              

            Hey glotfi, I am kind of working on the same thing. First i will tell you i am still learning filemaker, so i am sure there are many others have better ways. Try this and see if it works for you.

             

            I created a new script and named it. Then within the script i selected category Windows then New Window. Then select specify and enter the name, height, width, etc. Click ok. Next find category Navigation then Go to Layout. Then select under specify select the table you want to use. Next find category Records then New Record/Request. Save the script (ctrl-s on windows, mac i am not sure i think command-s). Go to the layout you want to put the button and edit layout, create the button using the tool bar(looks like a finger pushing a button). A menu will open and select perform script. Select the script you made. Select ok and then name the button. Save your layout and exit edit mode. Test the button. This works for me. If you need more help let me know.

             

            David

            • 3. Re: New Record
              ninja
                

              Howdy davealex,

               

              Thanks for sharing what you've learned.

               

              To clarify for the original poster: Does your method make the new record (Table2) related to the original record (Table1)?

              I don't see anything in your post that relates the records together.

              • 4. Re: New Record
                glotfi
                  

                Thank you Ninja

                The reason I want to do it by forms and not portal: The forms are more elaborate than Portals.

                 

                SetVariable [ $ID ; Table1::ContactID ]

                 

                 

                I did not know how to do that in the sript

                When I say setvariable from the script, it opens dialo with

                name

                variabe

                calculation

                 

                when I try to write: SetVariable [ $ID ; Table1::ContactID ]

                 

                It does not accept it, system says error

                 

                any tips

                thanks again 

                • 5. Re: New Record
                  ninja
                    

                  glotfi wrote:

                  SetVariable [ $ID ; Table1::ContactID ]

                   

                  I did not know how to do that in the sript

                  When I say setvariable from the script, it opens dialo with

                   

                  name

                  Type in "$ID" (without the quotes)

                   

                  variabe        

                  did you mean Value?

                  Click "Specify" and choose Table1 and ContactID field in the top left pane (double click).

                  The calculation "Table1::ContactID" or simply "ContactID" should show up in the calculation box below

                   

                  calculation

                  Please understand that I am on FMP8 while you might be on FMP10.  Some button labels might be a little different.  I do not get this button.

                   

                  Overall, it is asking you "What do I call this variable?" call it $ID.

                  It is asking "What should I set it to?" set it to Table1::ContactID.

                   

                  When you are done, the script line in Scriptmaker should look like what I posted initially.

                   

                  Let me know how you are doing...


                  • 6. Re: New Record
                    philmodjunk
                      

                    A very minor quibble but it has confused other new users in the past...

                     

                    SetVariable [ $ID ; Value: Table1::ContactID ]

                     

                    Is what you'll see. Filemaker adds that "Value:" tag after you enter a calculation and dismiss the dialogs.

                    • 7. Re: New Record
                      ninja
                         A minor quibble that I AGAIN mistyped.  Sorry you had to catch me for it again. :(
                      • 8. Re: New Record
                        RickWhitelaw
                          

                        I may be missing something here, but why do you have "F name" and L Name" in both tables? Are they not going to be the same in each? If I'm correct it begs the question "Do you really need two tables?" Or should you just add Summ and Post to the first table?

                         

                        RW 

                        • 9. Re: New Record
                          glotfi
                            

                          Dear Ninja

                          thanks again.

                          I am using FM 9

                          I managed the variable step

                           

                          when I tried the set feiled. It ask me to specify, I clicked Table2, Contact ID but no way to add $ID. It does not take it. so I could not write

                           

                          SetField [ Table2::ContactID ; $ID 

                           

                          Waiting, and thanks again

                          glotfi 

                          • 10. Re: New Record
                            philmodjunk
                              

                            Many new users get confused the first time they try to add Set Field to a script. See the following link for step by step instructions: (Scroll down towards the end of the thread.)

                            Selecting an "All" option with checkboxes