2 Replies Latest reply on Jun 30, 2011 8:40 AM by CaitlinM

    Creating a script trigger to enter data



      Creating a script trigger to enter data



      I am trying to create a script that will enter in a doctor's information (last name, first name, address, ph, fax, etc) into their respective fields when I click into the MD last name field. In a related table to the patients' data, are over 1400 referring doctors so I want my administrators to be able to easily find the referring MD without having to enter in all their information over again. 

      I understand I need to specify a script trigger, but I am having trouble figuring out what the script should be. Also, once I have performed the find for the script and found the correct referring MD, I am unsure on how to have that data get automatically inserted into the respective fields.

      Thank you for your help,


        • 1. Re: Creating a script trigger to enter data

          Shouldn't need a script trigger for this, but then you shouldn't try to link to a referring doctor name directly by name either as two doctors could have the same name (and even doctors might change their name on you).

          If you have a relationship to your table of referring doctors like this:

          YourTable::DoctorID = ReferringDoctors::DoctorID

          Then you can either place fields from ReferringDoctors directly on the YourTable layout and they will display the information from the selected doctor when you enter/select the Doctor's ID or you can define fields in your table that use this same relationship with looked up value auto-enter settings to copy this data from the other table. (You'll need to decide which works better for you.)

          Either way, no script trigger is required. The trick is to set up DoctorID with a value list of DoctorID's and names in order to select a doctor. Since you have a very large list of doctors to choose from, you'll likely need to set up either a conditional value list based on doctor specialties or some other category so that you can produce a shorter list of doctors, or use an enhanced value list selection technique that relies on a script to find the doctor record in the ReferringDoctors table and then enter the located record's DoctorID into the DoctorID field of your current record.

          Here's a demo file that illustrates 3 such methods. You'll need to modify the scripts to work with your file, but if you can figure out how they work, then you shouldn't have too much trouble doing so. (The scripts in the demo are set up to create new records in a portal which doesn't seem to be the case for you here.)


          Feel free to post back with questions if you can't figure out how the demo file works or how to adapt it's tricks to your system.

          • 2. Re: Creating a script trigger to enter data

            Thank you for your help, I'll play around with the different options and hopefully one will work out!

            Thanks again.