AnsweredAssumed Answered

Script won't run as expected

Question asked by NancyFJentzsch on Apr 24, 2010
Latest reply on Apr 25, 2010 by NancyFJentzsch

Title

Script won't run as expected

Post

I'm building a database in FM Pro 10. I have 2 tables: Family and Student. I've identified each family 'unit' with a Family ID. I have entered all the students in the Student Table and all the Families in the Family Table. My script correctly copies the student information from the Student table to the Family table for the *1st* child in the family. The script does NOT work for the 2nd or 3rd child. Obviously I'm overlooking something. I hope someone can give me an idea why it doesn't work. I use to be fairly expert at FM 5, but haven't had a job that required me to flex my FM skills in about 10 years. Im scrambling to catch up.

 

Here's the script:

Go to Related Record [ From table: “Family”; Using layout: “Family” (Family)

If [ Family::Child in Family1 = Student::First Name & " " & Student::Last Name ]
     Exit Script [ ]

   Else If [ Family::Child in Family1 = "" ]
      Set Field [ Family::Child in Family1; Student::First Name & " " & Student::Last Name ]
      Set Field [ Family::Child1 Gender; Student::Gender ]
      Set Field [ Family::Child1 DOB; Student::DOB ]
      Set Field [ Family::Child1 Current Sch/Occ; "McClelland" ]
  Else If [ Family::Child in Family2 = "" ]

      Set Field [ Family::Child in Family2; Student::First Name & " " & Student::Last Name ]
      Set Field [ Family::Child2 Gender; Student::Gender ]
      Set Field [ Family::Child2 DOB; Student::DOB ]
      Set Field [ Family::Child2 Current Sch/Occ; "McClelland" ]
  Else If [ Family::Child in Family3 = "" and not Family::Child in Family1 = Student::First Name &" " & Student::Last Name and not Family::Child in Family2 = Student::First Name &" " & Student::Last Name ]
      Set Field [ Family::Child in Family3; Student::First Name & " " & Student::Last Name ]
      Set Field [ Family::Child3 Gender = Student::Gender ]

      Set Field [ Family::Child3 DOB = Student::DOB ]

      Set Field [ Family::Child3 Current Sch/Occ; "McClelland" ]
End If

 

It fails at the 2nd Else if.

 

Thanks in advance for any help.

 

NJentzsch






Outcomes