7 Replies Latest reply on Sep 16, 2013 11:34 AM by philmodjunk

    Choose from existing records in script?

    ChrisJohnston

      Title

      Choose from existing records in script?

      Post

           I have the need to create new or link to existing records.  A ONE that needs creation of a new MANY record or to use an existing MANY record. Are there any recommended ways to do this in a script? I am reviewing through the script steps and don’t know of any that can let you choose from existing records. My script knowledge is not that strong yet. I am I imagining it is a script because I managed to write one that could create a new linked record. Is a script the way to do this or are there other recommendations?

        • 1. Re: Choose from existing records in script?
          SteveMartino

               I am having a little trouble understanding exactly what you're asking.   Could you rephrase your question to state exactly what you're trying to do?  Are you trying to create a new related related record based on an existing record (or many related records based on existing record)?  Or do you need an option to check for an existing record, and if not create a new record?  

               More info should get some more response/help.

          • 2. Re: Choose from existing records in script?
            ChrisJohnston

                 Simply need a mechanism for choosing from existing records. Is there any way to get a drop down list in the script dialogs? That would be optimum but which ever way is conventional would just be fine for now.

            • 3. Re: Choose from existing records in script?
              ChrisJohnston

                   Now that I think of it the dropdown list might sound hilarious to experienced FileMaker users I am laughing myself, because if someone had thousands of records that would be a mess. Took me a moment to think of it that way not having wrote many scripts. So would a pause with a trigger once the record you want is found be the way to go? In my script the first part set a new record as the linked record to the Information for a Task, the second choice is what I need to find the best practice for. I would even like suggestions for making the first part better/efficient/correct but that part works for now. Thanks

              • 4. Re: Choose from existing records in script?
                SteveMartino

                     I don't know for sure, which is why I asked the questions. I wonder if you could set up a layout so when you choose "2" you would go to a modal window with your records in a list-each line has a button over it.  When the user selects the record a trigger fires a script that grabs that record as a variable, and does the rest of what you need happen.

                     Essential the first script ends after the user chooses 2 and goes to the modal window. The selection fires a script to complete the process.

                     Side note: you have a typo in line 4 of your script 'Inforamtion' instead of 'Information'

                • 5. Re: Choose from existing records in script?
                  ChrisJohnston

                       Thanks for noticing the typo, I am so anxious when I get in front of this fantastic piece software. Well put, I am getting the variable part of the current record, found set, here I am in the Task part of my database which is a Task that needs to be assigned a piece of Information. The Information can be a new record or come from existing records. I might just be thinking about this my way (which is not good) and need more understanding of the flow (it is called in other forms of programing I have leaned). That is why I am looking for suggestions. Thanks.

                  • 6. Re: Choose from existing records in script?
                    ChrisJohnston

                         When I am pausing the script can a found record be the trigger?

                    • 7. Re: Choose from existing records in script?
                      philmodjunk

                           Yes but how are you finding the correct record?

                           In your script you ask the user if they want to select an existing record, but then don't collect any info that a script could use to FIND that specific record?

                           And if that record already exists, might it already be linked to a different "one" record in your table? What should happen then?

                           Is it possible that you really have a "many to many" relationship instead of "one to many"?

                           When your user selects "existing record" from the dialog, you may want your script to go to a search layout where they can specify info for finding that record (possibly in a newly opened window) and then just quits. Buttons on that search layout can then perform a new script that performs a scripted find and links the record thus found to your original "one" record. And this scripted search can be implemented via a number of different methods.

                           Here's one thread on scripted finds that you may find a good source of ideas: Scripted Find Examples