Previous Topic

Next Topic

Book Contents

Filtering data queries

The InForm application automatically filters the data returned to any query by limiting it to information that the current user is allowed to access. In other words, if a site manager asks to see all patient data for all sites, the information returned will be filtered by the manager’s predefined rights. A nurse might have different rights, and would see different results from the same query.

Any custom filters that you define will be applied on top of the built-in InForm application filter, unless you turn filtering off. To do that, and thereby allow any user to see all information returned, add this statement to the ASP:

'Turn off filtering
obj.Filtering = false

The basic InForm application filtering algorithm expects a column in the SQL query that can be referenced as PF_Site.SiteID. Filtering is performed by altering the SQL with further conditions upon this column. If this column does not exist, an error occurs.

Now let us add some custom filters. One common report request might be to see specific data for all users associated with a particular manager. The InForm application contains a predefined WHERE clause that you can add to apply this filter easily:

'Filter the data based on Manager ID by adding the
'following predefined WHERE clause:
'"DCV_REPCRAUSERS.MANAGERID = CurrentUserID"
obj.SetManagerFilter()\

As another exercise, let us specify a custom WHERE clause to filter data based on a patient’s current state (screening, enrolling, etc.). The following statement specifies patients who have been screened but not yet enrolled:

'Set a custom WHERE clause
obj.SetCustomFilter "DCV_PatientState.STATE < 4"

Send Feedback