5 Replies Latest reply on Dec 20, 2010 4:12 PM by philmodjunk

    Filters

    Mitch

      Title

      Filters

      Post

      I know there is going to be a simple answer t this, but at the moment it escapes me.

      I would like to create a field in my parent records  "Archive_Record" for which the values would be "Yes or No" with the default for all records set at "No".   I would the like the main layouts to only show records that are not archived: Archive_Record = "No".  With another layout showing "Archive_Record = Yes" when required.

      How do I create this filter in the main layout?

        • 1. Re: Filters
          philmodjunk

          You can use On layout load and on ModeExit [Find] to trigger a script that uses constrain found set to omit records that don't match the filter. And you can use the same layout for both filter settings. Just change a value in a global field or variable to change the "filter" setting.

          Say you have a global field formatted with a value list were you can specify values of either "yes" or "no".

          Enter Find Mode []
          Set Field [YourTable::Archive_Record ; YourTable::gArchive_Record] //gArchive_Record must have global storage enabled
          Constrain Found set []

          If gArchive_Record = "Yes", you are filtering for records with "yes" in Archive_Record. If it's "no", you'll get the opposite.

          • 2. Re: Filters
            Mitch

            Thanks Phil,

            I am thinking to keep it simple by having the default setting for "Archive_Records" for newly created records set as "No".  Therfore I only need the script:

            Enter Find Mode []
            Set Field [Main_Page::Archive_Record ; "Yes"] 
            Constrain Found set []

            Is there anyway I can set the "Archive_Record" field on all newly imported records as "No".  

            • 3. Re: Filters
              philmodjunk

              You can use the Auto-enter data field option to enter No into all new records.

              • 4. Re: Filters
                Mitch

                Wouldn't that require the "perform auto calc's" in the import script to be enabled to work.  At the moment it is disabled so the serial increments can be re-set...

                • 5. Re: Filters
                  philmodjunk

                  Yes, or you can use Replace Field contents with the calculation option to update ths field  with "no" immediately after Import.