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

    Set Field in Script



      Set Field in Script


      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?





        • 1. Re: Set Field in Script

          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

            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

              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.