1 Reply Latest reply on Apr 29, 2014 2:35 PM by philmodjunk

    Filter by Value in a Value List Contained in a Portal

    AlishaDenicola

      Title

      Filter by Value in a Value List Contained in a Portal

      Post

           Hello, 

           I'm working within a personnel database. I am trying to create a record of each employee's time off. To do so, I have a main layout called "Personnel" with tabs on it for different details about each employee. One of the tabs is titled "Time Off" and it has a portal on it which displays every set of time an employee takes off. The admin can add to that list by using an add button.

           Within the portal there is a field called "Type" which is a drop down menu from a value list called "Type of Time off". The value list has five options for types of time off. There are no special parameters to the value list, it only drops down and then displays the value chosen. 

           How can I filter the portal to only show vacation time off? I need this to be an interactive function so a user could choose vacation, see a total number of vacation days an employee took, then change the filter to "sick leave" and see the total sick leave days the employee took off. 

            

        • 1. Re: Filter by Value in a Value List Contained in a Portal
          philmodjunk

               The easiest approach is to include a text field formatted with that value list as a match field in the portal's relationship.

               Say your current relationship looks like this:

               Employee-----<TimeOffLog

               Employee::__pkEmployeeID = TimeOffLog::_fkEmployeeID

               if you change that relationship to be:

               Employee::__pkEmployeeID = TimeOffLog::_fkEmployeeID AND
               Employee::SelectedTimeOff = TimeOffLog::Type

               Then you can format SelectedTimeOff with your value list to filter your portal to show only records from TimeOffLog of the selected Type.

               If you set up SelectedTimeOff as a field with global storage, you can select this option on one employee record and see the same type of records in this portal as you move from employee to employee record without needing to reselect the desired value.

               Note: Since you may be using this relationship for more purposes than this portal. There is a good possibility that you'll need to create a new Tutorial: What are Table Occurrences? of TimeOffLog to use for this relationship and on which to base your portal.

               For an explanation of the notation that I am using, see the first post of: Common Forum Relationship and Field Notations Explained