Introduction | ||||||||||||||||||||||||
Think of a client application for the Exact Venice SDK as a regular
user of Venice. A user starts Venice, logs on, selects a dossier and if desired
a financial year and starts a module like customers or sales. The SDK client application performs similar actions by creating objects. First it creates the Venice-object (i.e. starting Venice). The newly created Venice object has several logon methods: Logon, LogonSecure , LogonDialog and LogonCurrent . One of these methods must be called by the client application to log on into the Venice object. The next step is to select a dossier. This is done by creating a DossierContext object (CreateDossierContext). In that DossierContext object, a module is launched by calling the create method of the corresponding interface, e.g. launching the customer module is done by creating a Customer object (CreateCustm). Done! The customer module is started and is ready to accept your commands. Most commands which are available in the customer module have equivalent methods in the customer object. You can e.g. browse the customer file (Browse), start a dialog to insert a new customer (Insert) or import new customers from a text file (Import). Each object can only be created in its appropriate context. The Venice object must be created first. This Venice object contains methods which are only meaningful at the root level (e.g. Logon) and cannot create other objects than the DossierContext object. The Dossier context has a few properties (the name, the last financial year,...) and can create many objects that run on the dossier level (customers, articles,...). It can also create a YearContext object (CreateYearContext). That object has some properties too (begin and end date of the financial year), and can create many objects that run on the year level (sales, purchase, invoice...) |
||||||||||||||||||||||||
Schematically | ||||||||||||||||||||||||
CreateVenice Properties WindowsUser LogonID ... Methods Logon IsActionAllowed ... CreateDossierContext Properties Name Path ... Methods IsActionAllowed CreateCustomer CreateSupplier ... CreateYearContext Properties Begin End ... Methods CreateSales CreatePurchase ... |
||||||||||||||||||||||||
Pseudocode | ||||||||||||||||||||||||
' Start Venice ...and with the object viewer of your development tool, you get an overview of all objects and methods in the Exact Venice SDK. But, before we get to the examples with real code, read on: there is a bit more to know... |
||||||||||||||||||||||||
Languages and data types | ||||||||||||||||||||||||
Since we wanted the Exact Venicer SDK to be usable from VB Script
(important for ASP webpages), the data types that can be used are limited to
those that exist in VB Script. This is important information for developers
familiar with more advanced languages which have many more data types: they
should keep this limitations in mind. VB Script has no 'unsigned' short or long integers, so pay attention when casting unsigned types to signed types! VB Script can handle the normal data types only for [in] parameters. When using [out] parameters (references), only VARIANTs are supported. An example of a method that uses VARIANTs as reference is GetFieldVal. It returns a VARIANT, not the data type you would expect for a particular field. Also properties are often implemented as a GetFieldVal-method and that is why it are mostly VARIANTs too. Other methods return a VARIANT_BOOL, but be aware that this is true when its value is -1! In C++, don't compare a VARIANT_BOOL with true/false but with VARIANT_TRUE/VARIANT_FALSE. We refer to the documentation of your development tool to learn more about converting VARIANTs to traditional data types and vice versa. We also refer to the manual of VB Script to learn more about data types supported by VBS. A good VBS editor 'MSE7.EXE' which includes the VBS help file is shipped with Microsoft Office©. Another important limitation of VB Script is its lack of support for enumerations. Although the SDK defines them, VB Script can't 'see' or use them. Therefore the include file 'ClSdkConstants.inc' is provided that lists all the enumerations as constants. If you want to make use of these constants, this file must be included in your script. It can be found in the SDK-directory in the root of your Venice installation. |
||||||||||||||||||||||||
The SDK has (for the moment) been successfully tested in the following programming languages: | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
Restricting the number of 'active' objects | ||||||||||||||||||||||||
Due to a limited number of database connections and the fact that each SDK-object uses one
or more database instances, it is important to restrict the number of 'active' objects. You can find more info on how to destroy an object in the help of the Create-topic of each interface (f.i. Venice::Create). Keeping objects alive (for too long) can lead to the following error: 'errTooManyObjects: Too many objects created. Destroy the unneeded objects ASAP.'. |
||||||||||||||||||||||||
Version control | ||||||||||||||||||||||||
The rules for COM prescribe that the objects of every version of a COM server
should have an interface, compatible with previous versions. If this cannot be
achieved, a new interface for the object must be created, while maintaining the
old compatible interface. If you want an automatic system for checking incompatibilities when installing a new version of Venice, you should use the method Venice::RegisterApp in your application. |
||||||||||||||||||||||||
A word on security | ||||||||||||||||||||||||
If Venice has the 'Access Management' option enabled, it makes sense to create
one or more special SDK users and add them to groups that grant them just
enough rights to use the objects your client application creates. Suppose you have created a client application in VB Script and another programmer can read your script. If you haven't created a special SDK user, you have to use a regular Venice user for the script, betraying his password to the other (less talented than you of course) developer! Suppose you have created a special SDK user, and gave him administrative rights. That opens the door to everything the other developer might think of (and remember he is less talented than you)! With compiled languages, this isn't an issue. But when using scripts, the source code is human readable, including the user identifiers and passwords. Try to hide the passwords in one of the two ways we describe here: |
||||||||||||||||||||||||
|