1 2 Previous Next 29 Replies Latest reply on Mar 21, 2014 2:29 PM by philmodjunk

    Auto-Populate Fields in Parent Record by Evaluating Multiple Records from Related Children Records

    evanscl

      Title

      Auto-Populate Fields in Parent Record by Evaluating Multiple Records from Related Children Records

      Post

           I have 12 fields on a parent page that I would like to auto-populate based on the values in fields from multiplerecords in a related record.

           For example, I have six fields that I want to auto-populate:

             
      1.           Serum1Collected [AcuteSerumCollected] = Yes or No
      2.      
      3.           Serum1CollectedDate [AcuteSerumCollectedDate] = Date when the acute serum was collected
      4.      
      5.           Serum2Collected [ConvalescentSerumCollected] = Yes or No
      6.      
      7.           Serum2CollectedDate [AcuteSerumCollectedDate] = Date when the convalescent serum was collected
      8.      
      9.           CSFCollected = Yes or No
      10.      
      11.           CSFCollectedDate = Date when the CSF was collected

           The criteria for auto-populating these two fields occur in two fields of the children records. These two fields are:

             
      1.           IllnessPhase
      2.      
      3.           SampleType 

           Over 20 records (children) may exist for each parent. I need to search for a key word in the child fields above. A script will run when the button is clicked. The script should go to the related child page and search all of the records there to see if any of the following statements are true:

                  In any of the child records ....

             
      1.           If IllnessPhase = "Acute" AND SampleType = "Serum", THEN Serum1Collected = "Yes" AND Serum1Collected Date = DateCollected
      2.      
      3.           If IllnessPhase = "Convalescent" AND SampleType = "Serum", THEN Serum2Collected = "Yes" AND Serum2Collected Date = DateCollected
      4.      
      5.           If SampleType = "CSF", THEN CSFCollected = "Yes" AND CSFCollected Date = DateCollected

           I don't know how to make the script evaluate all of the records in the child page, especially when the child records are updated or more child records (tests) are added. How would the script be written?

           Thank you.

      TestResultsPage.jpg

        1 2 Previous Next