3 Replies Latest reply on May 18, 2012 9:13 AM by philmodjunk

    Set Field in Script

    PatriciaSamuelsen

      Title

      Set Field in Script

      Post

      I'm sure I'm missing something really basic here, but what is wrong with this Script?

       

      If [Class Enrollments::TuitionType = "Full"]

        Set Field By Name [Class Enrollments:: Tuition Amt; Classes::ClTuition]

      Else If [CLass Enrollments::TUition Type= "TGC"]

        Set Field By Name [Class Enrollments::TUitionAmt; Classes:: ClTuitionPkg]

      End If

       

      Can I not specify a Field Name in the "Specify Calculation" box?

      If not, what Script function should I be using instead?

       

      Thanks

       

      Pat

        • 1. Re: Set Field in Script
          rgnant_1

          You have a capital "U" in th third line and the fifth line.   Try it with lower case letters.

          Also, using just "Set Field" would work better the way you have designed the script.

           

          • 2. Re: Set Field in Script
            PatriciaSamuelsen

            The capital U was a typo because for some reason I couldn't copy and past the Script and had to type it.

            I changed from Set Field By Name to Set Field and it worked!  I'm not sure I'm clear on the difference between those, and I thought I had trie dthem both. 

            In any event, it's working now.  Thanks!

            • 3. Re: Set Field in Script
              philmodjunk

              Set field by name assumes that the first term is a calculation that evaluates to the name of a field.

              Your script was telling filemaker "put the value stored in Classes::ClTuition into the field whose name is stored in Class Enrollments:: Tuition Amt". It's an indirect reference to a field. If you used this expression:

              Set Field By Name [ $FeldName ; Classes::ClTuition]

              and you had first stored the text: "Class Enrollments::Tuition Amt" in the $FieldName variable, it would then work just like the simpler Set Field step. If you put a different table::Field name in quotes as the value of $FieldName, the step would store the results into that field instead.