OSIS Cookbook – Adding a Quick Select List To a Report

Recently, while working on a feature for next release of OSIS I started thinking about how similar functionality could be achieved via existing versions of OSIS.  In this case I am refering to the ability to add a quick pick type filter to an OSIS report.  Here is what I came up with.

The Final Result

The Final Result

Requirements

  • OSIS 2.4 or greater
  • Experience in creating OSIS reports
  • Knowledge of Javascript and SQL would be helpfull

Overview

The basic method was to utilize two standard OSIS reports, using one for the content of the main report with the chart while using the other to drive the pick list.  I threw in a little html and Javascript kung-fu to make each work in conjunction with each other.

The Steps

The main report with chart
  1. Create an OSIS report utilizing the Work Request (wr) table as the basis for the report using the OSIS Create and Edit Reports tool
  2. On the Report Classification, Headers and Titles pane we will need to set both a custom Report Header and a custom Page Footer
    Editing The Report - Custom Headers and Footers

    Editing The Report - Custom Headers and Footers

    • The Report Header is a series of links (two in this case) using standard HTML that will provide a link to the pick list report (created later) and allow the user to clear any applied restrictions in the main report.  Take note of the report ID which in my example is 376 as this will need to be changed to the ID of the next report we will create.
         
      <ul>
      <li><a href="/osis/reports/rpt_mbody.cfm?rs=10&sr=1&ml=1&da=0&rpt_id=376&wca=" target="info">Select a Building To Filter This Report</a></li>
      <li><a href="/osis/reports/rpt_adv_main.cfm?ml=0&rpt_id=375&filt=0" target="reportframe">Clear Filter</a></li>
      </ul>
    • The Page footer contains a style definition to hide various parts of a standard OSIS report such as the title, footer, and header information.  I have included it in this sample in order to make a cleaner looking report.
         
      <style>
      #rpt_title_wrapper, #rpt_pageheader_wrapper, #rpt_pagefooter_wrapper, .rpt_chart_control_wrapper {
      display: none;}
      </style>
  3. Add three report fields one based on the prob_type field, one on the wr_id field and one on the bl_id field.  Once saved you can edit each based on the following settings
    Overall Field Layout

    Overall Field Layout

    • For Building Code Field
      Building Code Field

      Building Code Field

    • For Problem Type Field

      Problem Type Field

      Problem Type Field

      ISNULL(wr.prob_type,'None Assigned')
    • For Work Request Field

      Note: For this field I have used a UDF and named the field as a UDF.  The outcome would be equally as effective if you used the wr_id field directly.

      Work Request Field

      Work Request Field

      wr.wr_id
  4. Specify report features

    Report Features

    Report Features

The secondary report for the pick list
  1. Create an OSIS report utilizing the Building(bl) table as the basis for the report using the OSIS Create and Edit Reports tool
  2. Add a single field to the report based on the Building Code (bl_id). This field, after saving the report, will utilize the UDF statement contained in this file: udf_for_building_code_field

    Building Code Field

    Building Code Field

Leave a Reply

You must be logged in to post a comment.