2 Replies Latest reply on Oct 4, 2011 2:36 PM by philmodjunk

    filter records, before/after problem



      filter records, before/after problem


      I am using a portal to display client expenses, would like to include only those "unpaid", but then mark some "paid" as I bill clients for them.  (I don't want to charge a client twice for the same expense.)

      I've looked around and don't think I want to make the paid expenses inactive (I'd still like them to appear in a search, but be marked inactive).

      In a nutshell I think I want to have: "Display this record on this layout, but when x occurs, don't display it on this layout again."  I am using these in a calculation of "total expenses" (being the total amount the client should be charged), so I'd like "paid" expenses not to appear in that total, too.

      I do need the ability to search back through charged expenses, however, in case at some point in the future there's a question about a charge.

      Does that make sense?

      Is this just a portal filter?  Do I need a script?  Any help in the right direction would be appreciated.

        • 1. Re: filter records, before/after problem

          using a portal filter sound like it should work.  If you have a field called "paid"  you can filter the portal to show only those where yourtable::paid =""

          You could also have a portal next to it filtered by yourtable::paid ="X" to show those that have been marked and see a line item move from one the the other as it is marked.

          Then to see all just have a layout with a list of all related records to that client.

          • 2. Re: filter records, before/after problem

            A portal filter or a relationship based filter could easily exclude records where the status is "paid" for that expense record.

            Say you have this relationship:

            clients::ClientID = Expenses::ClientID

            If you have a number field called "Paid" formatted with a single value check that enters 1 when the box is clicked, you can use this expression to filter out the paid expense records:

            Not Expenses::Paid

            Clicking the check box for an expense record will remove it from the portal, but not delete the record the next time the window is refreshed using a script such as:

            Commit Record
            Refresh Window [Flush cached Join results]

            This can be performed with an OnObjectMOdify trigger on the check box field if you want the record to disappear from the portal the instant the box is checked.

            It's also possible to set up a portal filter expression that includes a reference to a second field that you'd locate on the layout. That would make it possible to control whether or not "paid" expenses are visible--which would make it easier to correct an error if you click this check box for a given expense record by mistake.