1 Reply Latest reply on Apr 24, 2011 5:00 AM by LaRetta_1

    I need scripting for a button to hide records

    PhillipDziewior

      Title

      I need scripting for a button to hide records

      Post

      Hopefully someone can help me. I have a db of employees with a status field that includes 3-options, Full-time, Part-time and Resigned what I'm hoping to do is have a button that when selected in browse on a layout that would hide or omit the parent and all associated child records of a record with the status of resigned. I have to still keep these records but do not want to see them in the layouts or reports unless specifically requested. Is this possible? thanks for any suggestions.

        • 1. Re: I need scripting for a button to hide records
          LaRetta_1

          You need to omit the Resigned by scripting a find; I suggest using Constrain Found Set[] because it then can be used easily even if you are working with an existing found set.  Since you added 'unless specifically requested' you must include that option for your users.  I would provide a button called 'Exclude Resigned' or ask in a Custom Dialog whether to exclude Resigned and branch accordingly.  You would not need to worry about omitting the Parent's child records since, if their parents are omitted, those parents children won't be included either.

          Create a script called 'Omit Resigned' and it will be:

          Constrain found set  [ ] then click button 'Specify Find Requests' , New, at the top change from 'Find Records' to 'Omit Records' and below left, find your Status field and select it.  Then over in Criteria, type Resigned (don't put quotes around it).

          You can now script to include this sub-script in other scripts or place a button with it on layouts.  If you are on a child layout, this script will still work if the parent table occurrence is the same and, since it would be a primary relationship, it should be the same.  Here is one sample on using it within a script to generate a report:

          Go To Layout [ report layout ]
          ... here perform your regular find, such as finding records for a specific time period
          ... now with your found set, ask the question
          Show Custom Dialog [ Yes ; No ; "Do you want to exclude Resigned?" ]
          If [ Get ( LastMessage ) = 1 // user selected yes ]
          Perform Script [ Omit Resigned ]
          End If
          ... do anything else such as sorting your report etc.