Setting up Sample

Navigation:  Interfacing QDV > Contextual Databases >

Setting up Sample

Previous pageReturn to chapter overviewNext page

A typical example is provided with QDV7 to illustrate how to interface a contextual database.

You'll find the example in \SDK\Custom_Articles folder, below installation folder.

 

The example is made up of:

▪an SQL Server database which is the contextual database. It contains rebates, currencies and prices according to a context made of Country and Type of Business

▪a QDV7 database named Ackerman.qdb which is the calling database

▪a program named Custom_Articles.dll which interfaces both databases

▪the program source code intended to be compiled using Microsoft Visual Studio 2010 or later.

 

Setting up Contextual Database

The SQL Server contextual database should look like this:

 

SQLServerContextual

 

To install it, just restore the archive provided in the \SDK>Custom_Articles folder and named Contextual_Prices_Db.bak. This archive was created using SQL Server Management Studio on SQL Server 2008 R2.

In order to run this sample, you must create a user named sample_user on your server. Name and password are hard-coded in the program. So you must use SQL Server authentication and give:

▪login: sample_user

▪password: sample_password.

Give this user enough rights on the database (owner is perfect).

 

Installing QDV Database

In the \SDK>Custom_Articles folder, you'll find a file named Ackerman.qdb. Copy it to any location and set a numeric path to this location using Data>Paths Manager.

 

Open

 

Open the database under QDV7, set edit mode and check that QDV7 will query an external program when the database is called. Select Behavior>Query Data from Foreign Program; then the gear wheel shows in a colored square (this flag is already set in the sample database).

 

BehaviorDb


←

 

Testing

Under QDV7 open the sample estimate Multi-Langages_Sample_With_Documents.qdv. This estimate contains 2 global variables used to set the context: GLV_Country and GLV_Business.

 

VarsContext

 

The content of these variables can be changed in the overhead workbook>Sheet of Sales.

Options for contextual prices (see \SDK):


Country  

UNITED KINGDOM          

V


 

 

 


Context  

LARGE_BUSINESS            

V

 

Open Ackerman.qdb under QDV7 and import some articles, in this context they should appear in GBP. Prices, rebates and currencies coming from the contextual database.

 

UKContext

 

Change context to USA / Small Business for example. You should get this:

 

USDContext

 

Select lines imported in UK context, and update them using Data>Update Rows.

 

Open

 

Then, the rows are adapted to the USA context.