9 Replies Latest reply on Oct 26, 2015 8:12 PM by planteg

    Create records in a table not displayed, possible ?

    planteg

      Hi,

       

      I am designing a small database to do some tests. The solution will receive by network messages that will be saved to a table and will create records from these messages. On top of that various reports and layouts will be created.

       

      Hence my question: how can I create in a script records in table not displayed currently without having to shift what the user is currently seeing to a different layout ?

       

      Thanks

        • 1. Re: Create records in a table not displayed, possible ?
          Nehme

          If the current layout is based on the table in which you want to create new records, simply use the script step:

          New record/request

           

          Otherwise, if the table is different from the layout's table, but is a related table, I suggest that you use a portal (that you can even hide on the right), in which you can create new records (go to field --> go to last row --> insert value)

           

          Otherwise, if the table is not even related, I suggest that you open an off-screen small window (far to the right or to the button), add the records and re-close it (it will go quickly and unnoticed by the user.

          • 2. Re: Create records in a table not displayed, possible ?
            Extensitech

            A common method is to spawn a New Window at the beginning of the script, then close that window at the end, so the user is dropped back exactly where they were.

             

            Another is to create a portal, off the layout space if necessary, and have your script work through this portal. This has the added and significant advantage that, should you run into errors and need to revert, all your changes in the portal will be reverted.

             

            HTH

             

            Chris Cain

            Extensitech

            • 3. Re: Create records in a table not displayed, possible ?
              planteg

              Nehme and Extensitech,

               

              I hoped there was some other method than the offscreen portal or window... I consider it not a very elegant solution . But it's a limitation that come with FileMaker.

               

              In fact that solution will:

              • receive messages and accept or not the transaction
              • the user will create rules about accepting transactions or not and report on the transactions

               

              The receiving part has to be done in 'the background' not disturbing the user.

               

              The only other way that comes to my mind is using a plugin that allows doing SQL INSERTs in a table.

               

              Gilles Plante

              • 4. Re: Create records in a table not displayed, possible ?
                Nehme

                Yes, this is another , but not free , possibility: user plugins

                 

                But , for sure, the user won't notice any change during his work because the process will go really quickly

                 

                Where do you want to insert a new record: same table as the layout, another table ( related or unrelated )?

                • 5. Re: Create records in a table not displayed, possible ?
                  planteg

                  For my test db, the Layout is set on a table with all Global Field, and I insert records into portals.

                   

                  I am also thinking about a two files solution:

                  • one would get messages and apply rules about accepting messages, with only one layout with the needed  portals (minimalist interface). Messages comes in via TelNet, I use 24U SimpleTalk that calls back scripts
                  • the other one would be what the user would use to create rules, display reports, etc.

                   

                  Being able to do INSERTs, UPDATEs an DELETEs is nice .

                  • 6. Re: Create records in a table not displayed, possible ?
                    Todd Geist

                    You do not need to use a portal to Create Records in a different table than the one you are on

                     

                    Here is how:

                     

                    Setup

                    1. Create a relationship between a utility field (can be a global ) in your local table, and the primary ID of the target table.
                    2. Set the relationship to "allow creation of related records

                     

                    now in your script

                    1. Make sure the "utility field" is empty with a set field script step
                    2. then set any field, except the primary field in the target table with a set field step.

                     

                    Presto record created!  This is sometimes called Pop Back, as the new record's primary key "Pops Back" across relationship and populates the "Utility Field".

                     

                    BTW. You can create Records and edit any Record in Table, but If you want to delete any record, you will need a portal so you can use the Delete Portal Row script step.

                     

                    Hope that helps

                     

                    Todd

                    • 7. Re: Create records in a table not displayed, possible ?
                      Nehme

                      In this case, if you want to create a new record in your portal that is located on your layout, simply do the following in your script

                       

                      suppose you a field called test in your portal

                       

                      Go to field (test)

                      Go to portal row (last)

                      Set field ( test ; your value that you need )

                       

                      And your record will be created

                      • 8. Re: Create records in a table not displayed, possible ?
                        RussW

                        Interesting idea to link 2 unrelated tables using a utility field. This might solve my issue of no offscreen layouts in Go.

                        But I disagree that offscreen windows is not an elegant solution. The window is created with a negative position (I use -5000 for both top and left) and is completely invisible to the user. No screen blinking or anything bad. The window can remain open for however long you need it and you can access the table without any issues including no cosmetic issues or screen glitches. I use them a lot.

                        Unfortunately, they don't work in Go or WebDirect.

                        • 9. Re: Create records in a table not displayed, possible ?
                          planteg

                          Hi Todd,

                           

                          sorry for the late reply. Your suggestion works well, thanks !

                           

                          For those looking for this method, search for magic key.

                           

                          Gilles Plante