1 Reply Latest reply on Apr 19, 2012 2:26 PM by philmodjunk

    Exit Loop when field is reached



      Exit Loop when field is reached



      I am running FMP 11 Advanced connected to a FMP 11 Advanced Server and am trying to create a script that will clear fields but when it sees the Comments field, don't clear it.  I have student records that indicate their course information per term, and at the bottom is a comment field that I want to always keep.  How do I ask my Loop function to clear all information in the term fields (to prepare for the next school year), but don't clear the Comments field?  I could not find exactly what I wanted with the Exit Loop function.  Thanks!

        • 1. Re: Exit Loop when field is reached

          Do you really need a loop at all?

          A series of set field steps:

          Set field [Yourtable::yourFIeld ; "" ]

          Will clear all your fields and you simply do not include a step to clear the comments field.

          If you are using a looping script that puts the cursor in each field with go to next field, then

          exit Loop If [ get ( activeFieldName ) = "comments"]

          should serve to exit the field. (be sure to use your exact name for this field as entered in Manage | database | fields.)

          Note also that in some situations, using either global fields or a related record for the fields where this data needs to be cleared could either eliminate the need for such a script or it could possibly be replaced by a single delete record step. Much depends on why you want to enable people to enter data into fields only to delete it instead of retaining it in a record.