Previous Topic

Next Topic

Book Contents

The Reporting COM object

No matter what format you choose for your report, your ASPs must reference the properties of the Reporting COM object defined in the InForm application. The object properties are described in the following table:

Property

Description

Example

Command

Specifies the query (string that specifies an SQL SELECT statement) used to generate a result for the report. The query is executed when this property is set.

rptobj.Command = “select * from patient”

XML

Returns the result of the query (Command property) as an XML string. The XML string returned may have to be parsed (via an XSL style sheet and/or the appropriate methods of the XML Document Object Model) to be viewable in browser.

xmlstr = rptobj.XML

HTML

Returns the result of query (Command property) as an HTML table. Result can be viewed directly in browser. Column headings of HTML table reflect column names specified in query (Command property).

Response.Write rptobj.HTML

RowCount

Returns the number of rows in the result (Command property) as a long integer.

numrows = rptobj.RowCount

ColCount

Returns the number of columns in the result (Command property) as a long integer.

numcols = rptobj.ColCount

GetData(Row, Column)

Returns the data for the specified row/column of the result (Command property) as a Variant data type. Row and Column indexes are long integers and the row/column index is 1-based. Specifying a zero value for a Row or Column index generates an error.

dataval = rptobj.GetData(1,1)

Filtering

Specifies whether filtering should be applied. Note that if you are not connecting to a CDD (you are using the trial database), this property is enabled by default. Conversely, if you connect to a CDD (with the SetCustomDB property) this property is disabled.

Filtering, if True, includes only data from sites that the current user has access privileges to view. Filtering should always be False when evaluating results from a CDD (i.e., user privileges are not considered, hence data from all sites is reflected in Result).

rptobj.Filtering = False

SetCustomDB

Specifies a custom DSN (CDD) for reporting. Three string arguments are required that specify the DSN, username, and password, respectively.

rptobj.SetCustomDB “democdd”, “democdduid”, “democddpid”

UserDate(Date)

Returns a date string formatted via the user’s Date format selection (as specified via the InForm application user rights). UserDate accepts a single Date argument.

datestr = rptobj.UserDate(Date)

CurrentUserDBUID

Returns the current user’s Database User ID (DBUID) as a long integer.

userid = rptobj.CurrentUserDBUID

FormatDate(Date, sFormat, sSeparator)

Returns a date string formatted according to the sFormat string argument with the separator character specified in the sSeparator string argument. The Date argument specifies the date to be converted.

sFormat may be any combination of mm, dd, and yyyy with a separator character in between the values. If the separator character used in sFormat does not match the character specified in sSeparator, the sFormat character prevails.

datestr = rptobj.FormatDate(Date, “dd-mm-yyyy”, “-”)

IDtoRefName(UserDBID)

Returns the user’s RefName given the user’s database ID (DBUID). RefName is returned as a string data type. Accepts a long integer as an argument that specifies the DBUID.

userid = rptobj.CurrentUserDBUID
refname = rptobj.IDtoRefName(userid)

MemberCount (UserDBID)

Returns the number of members in a manager’s group. Result is returned as a long data type. Accepts a long integer as an argument that specifies the user’s database ID.

userid = rptobj.CurrentUserDBUID
memcount = rptobj.MemberCount(userid)

GetMember(Index)

Returns a long integer that represents the user’s database ID pertaining to the index argument. The zero-based index is a long integer used to select a particular member from the list of members. The total number of members may be obtained through MemberCount.

mem = rptobj.GetMember(index)

SiteCount (UserDBID)

Returns the number of sites the user is allowed to access. Result is returned as a long data type. Accepts a long integer as an argument that specifies the user’s database ID.

userid = rptobj.CurrentUserDBUID
memcount = rptobj.SiteCount(userid)

GetSite(Index)

Returns a long integer that represents the SiteID pertaining to the index argument. The “Zero based” index is a long integer that is used to select a particular site from the list of sites. The total number of sites may be obtained through SiteCount.

mem = rptobj.GetSite(index)

SetCustomFilter strWhereClause

Specifies a WHERE clause to further refine the Result generated via the Connect property. Accepts a string as an argument that specifies the details of the WHERE clause.

rptobj.SetCustomFilter “t_frmae.visitid = visitmap.id”

SetManagerFilter

Specifies in the WHERE clause only users that report to the manager. The user executing this property must be a manager and should have users reporting to him/her. No arguments are required as the WHERE clause is generated automatically.

rptobj.SetManagerFilter “t_frmae.visitid = visitmap.id”

SetGraphDisplay ChartType, AxisStyle, Width, Height

Sets up the graphic engine to generate a particular graphic output style.

Arguments are:

ChartType—Long data type that defines the type of chart to be produced:

  • 0x00020000 (13107210)—Horizontal bar chart
  • 0x00030000 (19660810)—Vertical bar chart
  • 0x00040000 (26214410)—Pie chart

    AxisStyle—Long data type that defines axes
    0x01000000 (1677721610)—Style chosen from graph

    Width—Long data type that defines width of pie chart (in pixels)

    Height—Long data type that defines height of pie chart (in pixels)

rptobj. SetGraphDisplay 0x0040000, 0x01000000, 1000, 1000

ImageHTML(Width, Height)

Returns a string that specifies an HTML image tag. This property is used to generate the finished graphic image. Accepts two long integer arguments that represent the desired width and height of the image, respectively, in pixels.

strimage = rptobj.ImageHTML(500, 500)
Response.Write strimage

GetGraphBits Bits, Width, Height

Returns a binary array that specifies the graphic image. This property is used to generate the finished graphic. Accepts an argument to hold the binary array and two long integer arguments that represent the desired width and height of the image, respectively, in pixels.

rptobj.GetGraphBits Bits, Width, Height
Response.BinaryWrite Bits

PieColumns

Set to specify the number of columns of pie charts spaced horizontally across a page to display before wrapping to a new line. For example, assume that data in a report is segregated by site, there are four sites, and each pie chart represents a site. If PieColumns is set to 1 then the resulting chart will consist of four vertically oriented (rows of) pie charts. If PieColumns is set to 2, the output will consist of two rows with two pie charts per row.

rptobj.PieColumns = 2

SetTitle strReportTitle

Set to specify the title of the report. Accepts a single string argument that specifies the report title.

rptobj.SetTitle “Title of My Report”

AddLegend Group, Label

Bar Chart—AddLegend associates a text label with a GROUP number. The charting software will also assign a color to the GROUP number.

Pie Chart—AddLegend defines the title of the pie specified by the GROUP number.
AddLegend accepts two arguments. A long integer (Group) that specifies GROUP number and a string that represents a title (pie chart) or a legend (bar chart).

rptobj.AddLegend 0, “Bar Chart Legend or Pie Chart Title”

SetGroupLabel Label, Index

Bar Chart—SetGroupLabel defines the text description associated with an INDEX (i.e., a group of bars).

Pie Chart—SetGroupLabel defines the text label, used in the legend. The charting software will also assign a color to the INDEX number.

SetGroupLabel accepts two arguments:

  • A string that represents a legend (pie chart) or an INDEX description (bar chart)
  • A long integer (INDEX) that specifies an INDEX number.

rptobj.SetGroupLabel “Index description (Bar) or legend (Pie)”, 0

SetGraphValue Index, Group, Value

Specifies a single data value for the pie chart or bar chart. The INDEX argument, a long integer, correlates to the Index value in the SetGroupLabel property, and the GROUP argument, also a long integer, correlates to the Group value in the AddLegend property. The Value argument, a Double numeric type, specifies the data value.

rptobj.SetGraphValue 1, 0, GetData(row, col)

SetLegendRect Left, Top, Right, Bottom

Sets the size of the legend rectangle by specifying its left, top, right, and bottom coordinates. The graphing software uses these parameters to determine the size and position of the legend. The actual position and size are somewhat dependent on a number of software and computer parameters. Make sure the legend that appears is appropriately displayed and scale these parameters as needed.

rptobj.SetLegendRect 1, 1, 100, 100

Note: To perform multiple queries, you must define a separate SQL statement for each Report object instance.

Send Feedback