Filtering a Grid with a Session Variable

Description

How to filter the contents of a list based on the user's ID or another value.

Many applications need to filter the contents of a list based on the user's ID or another value. To do this you need to add some code to the Inside of the component override section of the page. Assume that the unmodified code of the grid component looks like this:

with tmpl
componentName = "NewTask"
end with

There may be a different variable name than tmpl, but it does not matter. Assume that:

  • the control that you want to filter is the second one in the component

  • the control name is Prop_Owner_Id

  • you have placed the filter value into a session variable named session.Unique_User

The following code would filter the contents of the drop down list.

with tmpl
    componentName = "NewTask"
    field_info[2].DropDownBox.Filter = "Prop_Owner_Id="+session.Unique_User 
end with

If you were going to filter the drop down list with a date value (e.g. session.last_logon_date ), you would use.

with tmpl
    componentName = "NewTask"
    field_info[2].DropDownBox.Filter = "Prop_Owner_Id="+s_quote(session.last_logon_date)
end with

The same technique applies to dialog components.

Limitations

Web publishing applications only.

See Also