mid.gif (2241 bytes)
FormMenuStart.gif (2069 bytes) FormMenuEnd.gif (441 bytes)
Knowledgebase Article 1025
FormHorizontalLine.gif
QUESTION:

We have an in-house application program that we want to integrate with PR-Tracker. In particular, we want this program to be able to add problem reports to the PR-Tracker database. How can we do this.

ANSWER:

This answer applies to versions 5.xx

If you want to add data to PR-Tracker automatically from another application, there are two important details that must be taken into consideration:

1) PR-Tracker stores all data redundantly. The data is stored in XML files (one for each problem report) and a database file (either Access 2000 or SQL Server).

2) A checksum field is used to coordinate updates to data cached in client computers.

Because of these two issue, we recommend using the method AddNewProblemReport() to insert data into the PR-Tracker database. This function will handle issues (1) and (2) above for you. This method is in file PRTRACK.DLL which is an ActiveX DLL.

INTERFACE

Function AddNewProblemReport(vntPathname As Variant, vntProjectSubdir, vntOriginator As Variant) As Variant

where

vntPathname -- This is the pathname of a file containing the XML for the problem report. This file should be formated just like the XML files in the PR-Tracker database. This file should not be located in the place where PR-Tracker stores the XML data.

vntProjectSubdir -- Each PR-Tracker project is stored in its own subdiectory. If PR-Tracker was installed with the database in the default location, this folder would be located under c:\Program Files\PR-Tracker\PRTRACKERDB. Note that vntProjectSubdir does not include the who pathname, just the subdirectory name.

vntOriginator -- This value will be placed in the Originator field of the Problem Report.

Return value:

If there is an error, a string will be returned contains an error message beginning with "Error".

If the function succeed, a string will be returned which represents a transaction. This transaction string will contain the problem report number given to the new problem report. It will be formated like the transaction strings at the end of problem report XML files. For example: #2002-01-29 21:28:28#;3;1;1;Tracy Tester


EXAMPLE VISUAL BASIC CODE

Dim objPrtrackerInterface As Object
'Note: strServerName is an optional argument in the following function call
Set objPrtrackerInterface = CreateObject("prtrack.clsPrtrackerInterface", strServerName)
strReturnValue = objPrtrackerInterface.AddNewProblemReport("c:\temp\newproblem.xml","MyProject","Tom Tester")
'Get problem number from strReturnValue if needed.
Set objPrtrackerInterface = Nothing

EXAMPLE VBSCRIPT

Dim objPrtrackerInterface
Set objPrtrackerInterface = Server.CreateObject("prtrack.clsPrtrackerInterface")
vntReturnValue = objPrtrackerInterface.AddNewProblemReport(vstrXmlFileName,vstrProjectSubrir,vstrOriginator)
Set objPrtrackerInterface = Nothing

MORE EXAMPLES

PR-Tracker ships with three .ASP files that use the interface prwebsvr.clsPrTrackerDBFiles interface. This interface is from PRWEBSVR.DLL which have the same method calls as in PRTRACK.DLL. The .ASP files are prtracker.asp, ProblemReport.asp and EmailProblemReport.asp. The default location of these files is in folder c:\Program Files\PR-Tracker\ASP
CornerLeft.gif (244 bytes) CornerRight.gif (244 bytes)

 

endln.gif (223 bytes)
Nine tips for effective bug tracking | Home | Site Map | Search Knowledgebase