The QDV API

This is the reference for the API provided by QDV for macros and external applications.

The API consists of a set of interfaces. This means that you cannot instantiate any objects directly and you need to use some entry points to get them. The QDV itself is responsible for creation of the objects.

Accessing QDV Programmatically

There are two ways how you can interact with QDV.

  1. Macros, requests and events. Only macros provide the full access to the entire API. Requests and events use only a limited language with a limited set of functionality. The macros are available from a running instance of QDV or other module, such as Management module. They work as functions invoked directly by user or by requests or events. So macros cannot be used as standalone application.
  2. External clients, which are standalone applications, e.g. EXE. They link to the InterfaceQDV.dll which provides the access to the API. The clients then can use the QDV functionality without need to open a QDV application.

Main Objects

There are several main interfaces and classes that provide an access to all other objects. In general, there are two ways for obtaining these objects.

  1. As an entry method parameter in a QDV macro. This will provide you with the currently opened estimate, article or sets database.
  2. Via the factories provided by the QdvManager class. These factories allow for opening any estimate or an article database from a file. The QdvManager instance is accessible in two ways. In macros, you can get it from the macro's context parameter. In external clients, it's accessible in QdvUserApiManager property of the Qdv.QdvInterface.Qdv class, that you get after creating a QDV interface. See How to open an estime or database from a file.

 
IEstimate

The IEstimate interface is the single point which represents an entire estimate. You can obtain it in two ways:

  1. As an entry method parameter in an estimate macro.
  2. Via IEstimateFactory.GetEstimate(String) method. The factory can be obtained from the QdvManager instance, see How to open an estime or database from a file.

Once you have the IEstimate object, you can access all other data via its properties and methods. For example, you can get the IEstimateVersion object (which represents a single estimate version/progress) via IEstimate.CurrentVersion property. Then you can access the WBS via IEstimateVersion.Wbs property and so on. See How to traverse the estimate object hierarchy.

 
ISetDatabase

The ISetDatabase represents a sets database. You can obtain it as an entry method parameter in a set DB macro.

IArticleDatabase

The IArticleDatabase represens an article DB. You can obtain it via IArticleDatabaseFactory.GetArticleDatabase method. The factory can be obtained from the QdvManager instance, see How to open an estime or database from a file.

QdvManager

The QdvManager serves as an entry point for retrieveing QDV factories and other services. The QdvManager instance is accessible in two ways. In macros, you can get it from the macro's context parameter via ICommonCallingContext.QdvManager property. In external clients, it's accessible in QdvUserApiManager property of the Qdv.QdvInterface.Qdv class, that you get after creating a QDV interface. See How to open an estime or database from a file.

Error handling

All errors are reported with .NET exceptions. You can catch them with the Try...Catch statements. Methods throw QdvApiException in most cases. These exceptions contain detailed messages. If you need finer granularity, each exception type has its own unique number stored in the ID property. If exceptions of another type are thrown (e.g. ArgumentException), the ID related to the exception context may be set as a key/value pair in Exception.Data property in some cases. The key is "QdvExceptionID" string and the value is ID.

The error IDs are unique integers that you can test. They are defined in the ErrorIDs enumeration which is well documented.

In this article

Definition