Vous êtes sur la page 1sur 217

TRAINING MANUAL

CCLAS EL v1.4
Advanced

Prepared by:
Mincom Ltd
11 Autumn Road
Rivonia, RSA
South Africa
Tel:
Fax:
Web:
Version:
Date:

+27 (11) 807 4750


+27 (11) 807 4759
www.mincom.com
3.0
26 June 2007

Copyright 2007 MincomLtd


All rights reserved
No part of this document may be reproduced, transferred, sold or otherwise disposed of without the written permission of Mincom Ltd

Table Of Contents
General Information.......................................................................................................................................... 6
Overview...................................................................................................................................................... 6
Classes........................................................................................................................................................ 6
Getting started with SQL................................................................................................................................... 6
Overview...................................................................................................................................................... 6
Opening SQL2005........................................................................................................................................ 7
Creating Users in SQL2005.......................................................................................................................... 9
Creating a CCLAS DB in SQL 2005........................................................................................................... 11
Installing CCLAS on the Server.................................................................................................................. 15
Installing CCLAS on a Workstation............................................................................................................. 25
Back Up and Restore................................................................................................................................. 31
Backup the Database............................................................................................................................. 31
Restoring a Database............................................................................................................................ 36
Database diagram...................................................................................................................................... 43
SQL Queries............................................................................................................................................... 46
DBCC DROPCLEANBUFFERS............................................................................................................. 46
SELECT queries.................................................................................................................................... 47
INSERT queries..................................................................................................................................... 48
UPDATE queries.................................................................................................................................... 48
Using the Query Designer.......................................................................................................................... 48
Getting started with CCLAS............................................................................................................................ 56
CCLAS.INI.................................................................................................................................................. 57
Running CCLAS the first time..................................................................................................................... 58
Running CCLAS with a new Laboratory Code............................................................................................ 60
GlobalSettings............................................................................................................................................ 61
Look at the Menu:....................................................................................................................................... 64
Diagrams................................................................................................................................................ 64
CCLASEL Module Relationship............................................................................................................. 67
Program Settings and the Programs They Relate To.................................................................................67
Settings...................................................................................................................................................... 72
GlobalSettings........................................................................................................................................ 72
Initialization Variable Settings................................................................................................................. 79
General....................................................................................................................................................... 80
Directories.............................................................................................................................................. 80
Setting up Tip files...................................................................................................................................... 81
Staff................................................................................................................................................................ 81
Settings...................................................................................................................................................... 82
Profile Screen Files................................................................................................................................ 84
Runn Files.............................................................................................................................................. 88
Other Modules........................................................................................................................................ 89
Setup.............................................................................................................................................................. 89
ii

Table Of Contents
Unique Numbers........................................................................................................................................ 89
Rounding Codes......................................................................................................................................... 93
Where may all the Setup settings used?.................................................................................................... 94
Laboratory Sections............................................................................................................................... 94
Holidays................................................................................................................................................. 95
Unit Codes............................................................................................................................................. 95
CCLAS API..................................................................................................................................................... 96
Intrinsic Controls in CCLAS scripting.......................................................................................................... 96
Customised Controls With Limited Events................................................................................................ 103
Standalone scripts.................................................................................................................................... 106
Integrated scripts...................................................................................................................................... 106
Setup scripts........................................................................................................................................ 106
Processing scripts................................................................................................................................ 107
Management scripts............................................................................................................................. 107
Customizing the Logon Screen............................................................................................................ 108
User Screens............................................................................................................................................ 108
<module>UserQuery.SCR........................................................................................................................ 126
ClientUserQuery.SCR.......................................................................................................................... 130
ClientCostUserQuery.SCR................................................................................................................... 131
ClientGroupUserQuery.SCR................................................................................................................ 131
ProcRegUserQuery.SCR..................................................................................................................... 131
ProductUserQuery.SCR....................................................................................................................... 132
QCUserQuery.SCR.............................................................................................................................. 133
ProfileUserQuery.SCR......................................................................................................................... 133
SchemeUserQuery.SCR...................................................................................................................... 134
MDEUserQuery.SCR........................................................................................................................... 134
MDESampleUserQuery.SCR............................................................................................................... 135
RepUserQuery.SCR............................................................................................................................. 135
InvoiceUserQuery.SCR........................................................................................................................ 136
AuditJobUserQuery.scr........................................................................................................................ 136
SamTrackUserQuery.SCR................................................................................................................... 137
SamTrackAddUserQuery.scr................................................................................................................ 137
<module>User.SCR................................................................................................................................. 138
GroupingUser.SCR.............................................................................................................................. 140
GroupSectionUser.SCR....................................................................................................................... 140
InstrumentUser.SCR............................................................................................................................ 141
LabUser.SCR....................................................................................................................................... 141
LobUser.SCR....................................................................................................................................... 141
SectionUser.SCR................................................................................................................................. 142
StatusCodesUser.SCR......................................................................................................................... 142
UnitUser.SCR....................................................................................................................................... 143
CannedCommentsUser.SCR............................................................................................................... 143
ClientContactUser.SCR........................................................................................................................ 143
iii

CCLASEL 1.4
ClientProjectUser.SCR......................................................................................................................... 144
ClientQuoteUser.SCR.......................................................................................................................... 144
ClientUser.SCR.................................................................................................................................... 144
CostCentreUser.SCR........................................................................................................................... 145
GroupClientUser.SCR.......................................................................................................................... 145
ProcRegSchemeAnalyteUser.SCR...................................................................................................... 146
ProcRegSchemeUser.SCR.................................................................................................................. 146
ProcRegUser.SCR............................................................................................................................... 146
ProductAnalyteUser.SCR..................................................................................................................... 147
ProductUser.SCR................................................................................................................................. 147
QControlUser.SCR............................................................................................................................... 147
SchemeAnalyteUser.SCR.................................................................................................................... 148
SchemeUser.SCR................................................................................................................................ 148
ProfJobCuidUser.SCR......................................................................................................................... 149
ProfJobSchemeAnalyteUser.SCR........................................................................................................ 149
ProfJobSchemeUser.SCR.................................................................................................................... 149
ProfJobUser.SCR................................................................................................................................. 150
STJobUser.SCR................................................................................................................................... 150
STJobSampleUser.SCR....................................................................................................................... 151
STPhysicalTypeUser.SCR................................................................................................................... 151
InvoiceUser.SCR.................................................................................................................................. 151
LabMaintScheduleUser.SCR............................................................................................................... 152
LabMaintUser.SCR.............................................................................................................................. 152
CMConsumeUser.SCR........................................................................................................................ 153
CMConsumeTypeUser.SCR................................................................................................................ 153
CMConsumeSupplier.SCR................................................................................................................... 154
*UDF.VBS................................................................................................................................................. 154
LabUDF.VBS........................................................................................................................................ 155
ProcRegUDF.VBS................................................................................................................................ 156
ProSchemeAnalyteUDF.VBS............................................................................................................... 157
ProSchemeUDF.VBS........................................................................................................................... 157
ProUDF.VBS........................................................................................................................................ 158
DBCUDF.VBS...................................................................................................................................... 168
BatchUDF.VBS..................................................................................................................................... 169
RepUDF.VBS....................................................................................................................................... 171
PRepUDF.VBS..................................................................................................................................... 173
InvUDF.VBS......................................................................................................................................... 175
StatUDF.VBS....................................................................................................................................... 180
PrfUDF.VBS......................................................................................................................................... 181
LabMaintUDF.VBS............................................................................................................................... 184
*Runn Settings......................................................................................................................................... 185
ConsumablesRunn............................................................................................................................... 185
MDERunn............................................................................................................................................ 185
iv

Table Of Contents
SamanaRunn....................................................................................................................................... 185
Profile - ScreenFilen............................................................................................................................. 186
SamReg - ScreenFilen......................................................................................................................... 186
Taskman - AutoRunn............................................................................................................................ 187
LabMaintenanceRunn.......................................................................................................................... 187
SampleTrackRunn............................................................................................................................... 188
ConsumablesRunn............................................................................................................................... 188
*AddNew.SCR.......................................................................................................................................... 189
ProcregSchemeAddNew.scr................................................................................................................ 189
ProductSchemeAddNew.scr................................................................................................................ 189
ProfjobAddNew.scr............................................................................................................................... 189
ProfjobProcedureAddNew.scr.............................................................................................................. 190
ProfjobSchemeAddNew.scr................................................................................................................. 190
ProfjobAnalyteAddNew.scr................................................................................................................... 191
BatchProcedureAddNew.scr................................................................................................................ 191
BatchSchemeAddNew.scr.................................................................................................................... 191
QuoteProcedureAddNew.scr................................................................................................................ 192
QuoteSchemeAddNew.scr................................................................................................................... 192
Module Specific scripts............................................................................................................................. 193
Profile................................................................................................................................................... 193
SamReg............................................................................................................................................... 195
Samana (Online).................................................................................................................................. 195
MDE..................................................................................................................................................... 196
ccComm01.dll...................................................................................................................................... 200
IFF Scripting............................................................................................................................................. 203
Properties............................................................................................................................................. 203
Methods............................................................................................................................................... 208
What is wrong when ................................................................................................................................. 217

General Information
Overview
CCLAS 1.4 Advanced Training is for those of you that know CCLAS from a user perspective, very well. In
this course we will be dealing with all those things that happen behind CCLAS, the things you cannot see or
are not obvious to the normal CCLAS user.
We will review every module very quickly, just to refresh your memory. For each module, we will be looking
at the setting you may find in the Staff module. For this, it is essential that you understand how the settings
and programs link with each other, and which classes to use.

Classes
Classes are pieces of code that is written in source, in the case of CCLAS with Visual Basic 6, where you
cannot see the code. A class is a category of things; an object is a specific instance of a class. A class
definition is a set of program statements that tell you the characteristics of the classs objects and the
methods that can be applied to its objects.
We are not going to learn here how to create classes, as it is beyond the scope of this course.
The classes that exist in CCLAS, will be discussed later in this document.

Getting started with SQL


Overview
For this course, we are using SQL2005. We are going to create a new CCLAS database in SQL 2005,
assign the owner to it and install the CCLAS database.
A Fresh CCLAS installation will show you how to get CCLAS database installed for the first time.
We will look at how to backup and restore a database.
The database diagram, which we will pull from the CCLAS database, will give you a good idea of the
structure of the database. To write effective SQL queries, it is essential to know the DB structure.
The SQLOLEBD is the most popular connection we use in our scripts you are free to use other connectors
as well.
The Server and Client installations of CCLAS are somewhat different, we will look at the installation of both
and how the CCLAS.INI file really works.
For the purposes of this course, we are assuming that you have SQL2005 installed on your server. You are
going to treat the installation as if it is the only CCLAS installation on your server in some cases during
these courses, each student will have his or her own PC which will double as a server and in some cases
we will use a real server to do these installations, and our PCs as normal CCLAS workstations. It all
depends on the setup of the classroom.

CCLAS 1.4

Opening SQL2005
Click on Start All Programs Microsoft SQL Server 2005 SQL Server Management Studio, as in the
screen capture below:

The following screen appears:

Make sure that the selections in the dropdown boxes are as follows:
Server Type:

Database Engine

Server Name:

The name of the server where you will install your database. In some cases, it
would be a networked server, in some cases we will treat our PCs as servers. If we
use a network server, the tutor will supply you with a server name. Else, your
computer name will be the server name. How can I find the name of my PC?

Authentication:

We will start off using Windows Authentication, since we are going to create the
Database Owners name first.

Click on the Connect button.


The following screen will appear:

CCLAS 1.4

Creating Users in SQL2005


To create the name of the Database Owner, expand the Security option in the pane on the left. Underneath
that, expand the Logins option:

If the SQL2005 instance has never been used, you will only see logins which have been created during the
SQL installation. Else, as is in the case of the above screen shot, you will see users who have been created
by the DBA.
To create your own user / owner, right-click on Logins and select the New Login item on the floating menu:

The following screen appears:

For the purposes of this course, we will enter the following:


Login name:

CCLS

SQL Server authentication:

Check this option

Password:

CCLS (make sure it is exactly like this, in caps)

Enforce password policy:

Uncheck this

Leave the other settings on the screen as they are, and click the OK button.
The user you have created, will now appear under the Logins option on the screen:

10

CCLAS 1.4

Now collapse the Security option by clicking on the minus (-) to the left of Security.

Creating a CCLAS DB in SQL 2005.


We are going to create our database now:

When you expand the Databases option, you will see a list of all databases which have been created on this
server / PC. Else, those that have the red icon to the left of them, will not exist.
To create a new database, right-click on Databases, and select the New Database option on the floating
menu, as in the screen shot below:

11

The following screen appears:

12

CCLAS 1.4

Database name:

Type a name for your database. For purposes of this course, use your own
discretion of what you want to call the database. Let us all enter it in caps, one short
word.

Owner:

Select the CCLS user you have created under Security. How do I find the user?

When a database is created, it creates an MDF file and an LDF file. The MDF file holds all the information
which exists in the database, and the LDF file is a log file. We are not going into an in-depth explanation of
these two files, but we will see how to change the location of these files.
Scroll to the right of the screen by clicking on the vertical scroll bar. You will see something similar to what
appears on the following screen. By default, when you create a database, SQL will place the MDF and LDF
files in SQLs Data location.

Click on the ellipse button (). The following screen will appear:

13

On this screen above, you will see the path which SQL has selected by default. We are going to leave it like
that. Mostly, the DBA or your IT department has separate drives or directories which will hold data, and thus
the path to that directory would be selected.
Click on Cancel to close this screen, and click on OK on the previous screen to create the database.
Now you will see the database you have just created, in the database list, as in the screen capture below:

14

CCLAS 1.4

Installing CCLAS on the Server


Before installing CCLAS, make sure that you have saved everything you have been working on, and closed
all other programs. The PC or Server will need to reboot after CCLAS installation.
The first installation of CCLAS on the server, has to be done directly on the server. You can access the
server by some utility supplied by your IT department, like VNC.
To install CCLAS on both the Server and a Workstation, you will need Administrator rights. One can expect
an IT department to choose to do the installation themselves, with some assistance from the CCLAS
administrator, as it is normally against policy to provide non-IT personnel with Administrator rights.
Click on Start Run to open the following screen. Browse to the directory where the CCLAS installation
files have been placed. In the case of the customer, the installation files may either be on a CD or in a
directory on the server.

Click on the OK button to start the installation.

15

Click on the Next button.

Read the License Agreement and click on the Yes button.

16

CCLAS 1.4

On this screen, you will set the Destination Folder. This is where the EXE will be installed to. The EXE
directory holds the program files.
If you wish to do the CCLAS Server installation to another directory than the default C:\CCLASEL directory,
click on the Browse button to navigate to another directory, as in the following screen capture:

If you each have your own PC that will double as a Server and a Workstation, leave it as the default, i.e.
C:\CCLASEL. Else, your tutor will tell you where to install CCLAS to (for this, you will use a utility like VNC).
Click on OK.
Click on the Next button.

17

Since we are busy doing a server installation, select the Full option. This will take you to the following
screen:

Select the options you want to install to the server.


Program:

All EXEs, DLLs and OCXs will be installed. If you are doing a fresh installation of
CCLAS, it is essential that you select this option.

Database:

18

Installs the database files on the SQL server.

CCLAS 1.4

Directories:

Will place sub-directories in the folder you have selected on a previous screen, in
this case C:\CCLASEL.

Sentinel:

If your CCLAS licences are installed by using a Sentinel, you will select this option.
Your CCLAS provider will tell you to use or not use the Sentinel option. For training
purposes, we will not use it.

Help:

Installs Help files to the Help sub-directory.

Click on the Next button.

The option you select on the above screen, will place the CCLAS.INI file in the corresponding directory. In
this case, we select the Windows directory.
Click the Next button.

19

Select the language you prefer.


Click Next.

Since we are using SQL2005, select the SQL Server Unicode (2000) option.
Click the Next button.

20

CCLAS 1.4

Remember the Username, Password and Database you have created in SQL2005? It is essential that, what
you filled in on this form, is exactly the same as what you have created in SQL.
Username:

CCLS

Password:

CCLS

DSN:

<ServerName>;<DB Name>
Make sure that the ServerName is the name of the Server you have installed the
Database to. How do I find the Server / PC name? The DB Name is the name you
have assigned to your CCLAS database when you created it in SQL2005. These
two names are separated by a semi-colon.

Click on the Next button.

21

On this screen, you will select the main directory where the other sub-directories will be installed to. As you
can see, the program files do not have to reside in the same parent directory as the other directories. For
purposes of this training, we will leave the Data Directory as CCLAS sets the default.
Click the Next button:

Click on the Next button.

22

CCLAS 1.4

Check if your directories are correct as intended to be, and click the Next button.
If the program warns you that information will be added to the Registry, click on OK. We will not study the
registry during this course.

The screen capture above shows the installation taking place.


The following two screen captures appears during database installation. The first one appear when the
database is being installed for the first time:

23

If you see the following screen appearing, it means that the database already exists, and you are re-installing
it. It may happen, at times, that you need to do this, should the database have been damaged for some
reason or an update has been released. Keep in mind that any original fields which have been changed to
suit the users requirements, will be updated to suit the default CCLAS installation. It is safer to let a CCLAS
consultant help you through the process of updating your database.

As soon as the database have been installed, the following screen might appear.

Click on OK.

24

CCLAS 1.4

The InstallShield Wizard will show that the installation is complete, so click Finish to restart your computer.

Installing CCLAS on a Workstation


Make sure that all your work has been saved and all programs closed before you start installation. Your
Workstation will need to reboot after installation.
Browse to the directory where the CCLAS installation files have been copied to:

The following steps are the same as for the Server installation:

25

Click the Next button.

Read the licence agreement and click the Yes button.


Be careful on this next screen!

26

CCLAS 1.4

Normally, the Destination folder should point to the directory on the Server where the EXEs, OCXs and DLLs
(i.e. the Program Files), have been installed. You can change it by clicking the Browse button, and browsing
to the Servers CCLASEL directory.

In some cases, one might choose to run the Program files directly from the PC. It is very important to
remember that this is an administration nightmare for the client, and should be avoided at all costs.
Click on the Next button:

27

On the above screen, select the Workstation installation, and click the Next button.

Select the directory where the local CCLAS.INI file will be copied to.

28

CCLAS 1.4

Select your language of preference.

Check that your Program Folders option is correct. Click the Next button.

29

On the screen above, check that files will be copied to the directories as was intended, and click the Next
button.

After CCLASEL has been installed, the message as above might appear, just click on the OK button.

30

CCLAS 1.4

Click on Finish to restart your Workstation.

Back Up and Restore


Backup the Database
We are going to make a backup of the database we have just created. Normally, your IT department will
have a system in place which will cater for this but from time to time it will be necessary for you to know ho
to back your database up.
Open SQL2005 where you expand the Databases option.

31

Highlight the Database you need to created a Backup for.


Right-click, highlight the Tasks option on the next floating menu.
On the subsequent floating menu that appears, click on Back Up.

The following screen will appear:

32

CCLAS 1.4

Make sure that the following are correct:


Database:

The name of the database you want to back up.

Backup Type:

If your consultant requests a backup of your database, select the Full option. For
routine backup purposes, your DBA will decide which backup option should be done.

Backup component:

Also, if you make a backup to send to your consultant, you will select the Database
option.

Name:

A default name will be created, you may change it here.

Destination:

Here we may select a destination where our backup files will be placed. For
purposes of this course, click on the Remove button to remove the default path.
Now click on the Add button to add another backup location. The following screen
will appear:

33

Scroll to the Backup directory under your CCLASEL main directory. If you have installed CCLAS for the first
time, the Backup directory will not exist, so go ahead and create it.
Selected Path:

Directory path where the backup will be saved to.

File Name:

Name of the backup file.

34

CCLAS 1.4

Make sure that your path and filename are what you intended them to be.
Click OK

If all settings are correct in the screen like above, click on OK.
When the backup has been completed, the next screen will appear:

35

Restoring a Database
For the purposes of this training, we are not going to use the database we have just created. From now on,
we will use an existing database, since it contains Staff, Clients, Methods, Jobs and more which has been
set up during the CCLAS Basic Training Course.
So, let us restore an existing database to the one we have just created.

Right-click on your Database name.


Move the mouse-pointer to Tasks on the floating menu.
On the next floating menu, move the mouse pointer to Restore, and thereafter, to Database.
Click on Database
The following screen will appear:

36

CCLAS 1.4

The General item in the left pane is selected by default. Make sure that the following are correct:
To database:

The name of the database you have created earlier.

From device:

Using the ellipse button, browse to the backup you need to restore. Your tutor will
tell you which backup to restore. How do I browse to the backup I need to restore?

Select :

After you have browsed to the backup you want to restore, the name of the
database will appear in the explored-like box at the bottom of the screen. Select the
tick box next to it.

In the left pane, select the Options item:

37

Make sure that the following are selected correctly:


Overwrite :

Select the Overwrite the existing database option by ticking the square.

Restore the :

For the first Original File Name, browse to the MDF file that you have created earlier
by clicking on the ellipse button. How do I do that?
For the second Original File Name, browse to the LDF file that you have created
earlier by clicking on the ellipse button. How do I do that?

Click on OK.
As soon as the database has been restored, the following screen will appear:

Click on OK.
Remember, since you have restored an existing Database over the one you have created, the owner of the
database will not be the same as the original owner. You will either have to change the owner, or you will
have to add the user you have created (CCLS in this case), in the Security setup of the database.

38

CCLAS 1.4

Changing the owner


To change the owner of a database, right-click on the database name, and select Properties from the floating
menu.

The following screen will appear:

39

In the left pane, select the Files option. In the right pane, change the Owner to the one you have created
earlier CCLS.

Adding a User
In some cases, it will be necessary to add more users to your database. That will only happen if another
system connects directly to the database, and they have their own logon. Keep in mind that this will be a
security concern, as in all instances of SQL databases the more users have access to your database, the
greater the chances of unauthorized changes are.
You do not need to create a database user for the CCLAS Staff Codes loggin on to your database this is
handled by the CCLAS Security model.
The add the CCLS user to your database, is not necessary in this case, since it is the owner of your
database. But for illustration purposes, we are going to add CCLS as a user.
Expanding Security and then Logins, you will see the CCLS user:

40

CCLAS 1.4

Double-click on CCLS to open its properties pages, and select the User Mapping option in the left pane.

41

If the user you have double-clicked, was set to be the Owner of the database, the acronym dbo will appear
in the second column, as well as in the third column.
Suppose we want to add another user to the database let us create the user CCLASMGR.
Double-click on the CCLASMGR user to set it as a user to the database:

42

CCLAS 1.4

Select the database to attach CCLASMGR to. The user will now show as CCLASMGR. In the Default
Schema column, change it to dbo. How do I do that?
In the Database role membership list box, select the db_owner setting. It will allow CCLASMGR a great
amount of access to the CCLAS database.
Click on OK.
Now you may use either CCLS or CCLASMGR for CCLAS to be able to log onto the database.

Database diagram
The database diagram will show how the tables in the database are connected to each other. Explaining this
is beyond the scope of this course, but you will need to know how they are connected to be able to write
queries.
The first time you click on the Database Diagrams option under the database you have created and restored,
you might get the following message:

43

Simply click on the Yes button to add the support objects.


To create a database diagram, right-click on Database Diagrams, and select the New Database Diagram
option on the floating menu:

A screen which contains all the tables in the database, will appear:

44

CCLAS 1.4

I have selected the ProfJob group of tables, since these are the tables we will use most often during this
course. You can create a diagram of the entire database by selecting all the tables which belong to this
database.
Click on the Add button.
The tables you have selected, are added to the diagram, as is demonstrated in the following screen capture:

After you have created the database diagram, right-click on the tab and select the Save option.

45

Click on OK.
The screen will now have your diagram available:

SQL Queries
It is beyond the scope of this course to teach you how to write SQL queries. Only the basic principles of SQL
SELECT queries will be covered. We will not cover DELETE queries at all, a quick overview of UPDATE and
INSERT queries will be done.

DBCC DROPCLEANBUFFERS
Use DBCC DROPCLEANBUFFERS to test queries with a cold buffer cache without shutting down and
restarting the server.
This is useful when running huge queries.

46

CCLAS 1.4

SELECT queries
SELECT queries are used to pull data out of the database it works on the same principle as filters do in
Excel, for example, but you do not set it up the same way.
SELECT queries have the following structure:
SELECT

<fieldname1>, <fieldname2>

FROM

<tablename1>, <tablename2>

WHERE

<statement>
ORDER BY
<order statement>
Let us use the Profjob group of tables we have earlier created a database diagram for:
Assume we want to get a list of Samples which have been registered in CCLAS.
SELECT

SampleIdent

FROM

ProfJob_Cuid

Now assume we are looking for all Samples which have been registered for the Client Coal_Mine.
Remember, all Sample Ids appear in the ProfJob_Cuid table. But the Client Codes only appear in the
ProfJob table.
So, we have to join these two tables to get sensible data out of them:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.

SELECT

FROM

Cli_Code,
ProfJob.Pro_Job,
SampleIdent
ProfJob_Cuid,
ProfJob

WHERE

ProfJob.Pro_Job = ProfJob_Cuid.Pro_Job
AND ProfJob.Cli_Code = 'Coal_Mine'

The above query will now show, in tabular form, the Client Code which is only Coal_Mine, all Jobs that exist
for that client, and Samples that appear in those jobs.
But in line 10, it reads: ProfJob.Pro_Job = ProfJob_Cuid.Pro_Job. Why? Because the Pro_Job
field exist in both tables, and they should be equal to each other to retrieve the correct data.
Let us view all the Schemes (analytical methods) that belong to the Jobs that appear in the tabular list:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.

47

SELECT

Cli_Code,
ProfJob.Pro_Job,
SampleIdent

FROM

WHERE

ProfJob_Cuid,
ProfJob,
ProfJob_Cuid_Scheme
ProfJob.Pro_Job = ProfJob_Cuid.Pro_Job
AND ProfJob_Cuid_Scheme.Pro_Job = ProfJob_Cuid.Pro_Job
AND ProfJob_Cuid_Scheme.Cuid = ProfJob_Cuid.Cuid
AND ProfJob.Cli_Code = 'Coal_Mine'

In line 8, we have selected another table that has to be queried it is the table that contains the Schemes
that are linked to the Sample ID in the ProfJob_Cuid table, as well as to the Job in either the ProfJob or
ProfJob_Cuid table. Look at line 11 and 12 this is where we set some fields on the ProfJob_Cuid_Scheme
table equal to some fiels in the ProfJob_Cuid table. Both the Pro_Job and the Cuid field appears in both,
and they have to be the same throughout, hence this connection.

INSERT queries
The basic construction of INSERT queries are as follows:
INSERT INTO
<tablename>
VALUES (
<Fieldname1>,<Fieldname2>

UPDATE queries
The basic construction of UPDATE queries are as follows:
UPDATE
SET
WHERE

<tablename>
<fieldname> = <value>
<statement>

Queries get a lot more complicated than this. This will be evident when we look at some scripts nearly all
CCLAS scripts contain queries that either: query data, insert data or delete data from the database.

Using the Query Designer


With your database highlighted, select the New Query icon on the top, left of the screen:

48

CCLAS 1.4

A blank query screen will appear on the right:

Click on the Query menu item, and select the Design Query in Editor item:

49

The following screen will appear:

50

CCLAS 1.4

Note that we have a blank screen in the background, and a list box with all the tables that exist in the
database in the foreground.
Let us do the exact queries that we have done previously, when we typed up the queries manually so
select only the ProfJob_Cuid table and click the Add button. Drag the SampleIdent field into the middle part
of the screen, where it says Column Name:

51

At the bottom of the screen, you can see the query which has been built the syntax is the same as the one
we have typed manually.
Now we want to see the Jobs and the Clients as well, where the Client is Coal_Mine.
Right-click on the white space, and select Add Table:

52

CCLAS 1.4

The following screen appears, so select the ProfJob table:

Now look at this:

53

There is not only ONE link as we have typed up in our manual query, but TWO! Why? Because all the 1.4
versions of CCLAS is about multi-lab databases. We can have data for more than one laboratory in the
same database.
If we do not set the LabCodes equal to each other, and it so happens that the Precious Metals Laboratory
and the Base Metals Laboratory by chance have the same Clients, we are going to return a result which is
not accurate!
Note that the bottom screen shows the query that has automatically been built and it uses INNER JOINS.
That is a SQL connection between two tables but the recordset will be exactly the same as what we would
find in the manual query, if we did in fact use LabCodes.
Joins can get much more complicated than this and there are times that one cannot get past using joins
but that is beyond the scope of this course.
OK, so let us add the Scheme, or analytical method, to our result set. Once again, add another table, this
time select the ProfJob_Cuid_Scheme table:

54

CCLAS 1.4

Once again, the links are automatically added, and the query is automatically being built when you drag the
fields you need to see, into the Column of the middle part of the screen.
As soon as you are happy that you have all the desired fields included in the query, click on the OK button.
The query is transferred onto the query screen, just as it would have been if we typed it manually:

55

If your query is complete, you may now copy it, and use it in a script.

Getting started with CCLAS

56

CCLAS 1.4

CCLAS.INI
After you have installed CCLAS, the CCLAS.INI file was written to the directory you have specified during
installation. The CCLAS.INI file exist both on the Application / Database server, as well as on each
Workstation CCLAS was installed to. For the purposes of this course, the CCLAS.INI file was installed to the
Windows directory.
Before running CCLAS for this first time, the CCLAS.INI file looks like this:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.

[CCLAS]
ErrorDLL=C:\CCLASEL\EXE\CCERRES.DLL
MessageDLL=C:\CCLASEL\EXE\CCMESSES.DLL
ExtendedErrorMessage=Enabled
Language=0
ForceODBC=Disabled
Debug=Disabled
ConnectionName=CCLAS EL Version 1.3
ConnectionPoolMinimumSize=0
ConnectionPoolTimerRefresh=0

We will look at the meaning of few of the lines:


Line 2 and line 3 determine where the CCERRES.DLL and the CCMESSES.DLL files are located. If the path
is not correct, some icons and menus will not be visible. Let us assume both lines 2 and 3 points to a
location on the G: drive (which in this case, does not exist). Look at what the Staff module, for instance,
looks like:

Line 6, if ForceODBC is Enabled, the screen that forces the connection to the database will appear each
time you start up CCLAS.
The first time you execute CCLAS, the CCLAS.INI file will change to add the connection string. The file will
look like this:
1.
2.
3.
4.
5.
6.

57

[CCLAS]
ErrorDLL=C:\CCLASEL\EXE\CCERRES.DLL
MessageDLL=C:\CCLASEL\EXE\CCMESSES.DLL
ExtendedErrorMessage=Enabled
Language=0
ForceODBC=Disabled

7.
8.
9.
10.
11.
12.
13.
14.

Debug=Disabled
ConnectionName=CCLAS EL Version 1.3
ConnectionPoolMinimumSize=0
ConnectionPoolTimerRefresh=0
DSN=LENOVO-B582864C;COURSE
UID=CCLS
PROVIDER=SQLOLEDB
PWD=fry~!

Note that line 11 to 14 have been added to the CCLAS.INI file. Where do these lines come from?

Running CCLAS the first time


When you double-click on the CCLAS icon, the following screen appears:

Manually fill in the following:


DSN:

<servername>;<databasename> - the servername is the name of the Server you


have installed CCLS to, for training purposes it could be the name of the current PC
you are working on. The databasename is the name you gave to the database
when you set it up in SQL. The servername and the databasename are separated
by a semi-colon.

Provider:

The type of Database program you are using

UID:

User ID as you have entered when you created the database in SQL

PWD:

The Password you have entered when you created the database.

What happens when you fill one of these incorrectly?


The CCLAS.INI file will be updated incorrectly! And you will get the following message:

58

CCLAS 1.4

To fix this, you may either delete the last four rows that have been added to the CCLAS.INI file, or you may
set Line 6, where it refers to ForceODBC, to enabled. Enabling line 6 will force the ODBC screen to appear
again with your next attempt to log on to CCLAS.
When all the data in the ODBC screen have been entered correctly, and the CCLAS.INI file has thus been
updated correctly, the following screen will appear:

Now you are ready to use CCLAS.


Note that, in the Username field, we have typed CCLASMGR. The Username you type in here, is a Staff
Code that exists in the Staff table of CCLAS it is not the User ID you have created in SQL. During
installation, only the one Staff Code, CCLASMGR, for the GLOBAL laboratory, is created automatically.
From here on, it is up to you to create a laboratory code, and new Staff Codes inside your new Lab Code.
How to create a new laboratory code, is explained in the Basic Training Course, under the Setup section.
To create a new Staff Code, is explained in the Basic Training Course under the Staff section.

59

Running CCLAS with a new Laboratory Code


For the purposes of this course, we have already created a Lab Code named DEMO. So you may log in
using CCLASMGR as a Username, and select DEMO in the Labcode:

The menu will appear.


But the menu may look like this:

no icons appear! Why does this happen and how do you fix this?
Remember, we have restored an already existing database to the ones we have created. Which means, the
database was originally created on another Server / PC, and may thus point to a different path as to where
you have installed your program files.
The URLs to EXEs are stored in the Staff_Program_CFG table. So, we will run the Staff program directly,
bypassing the menu:

60

CCLAS 1.4

Double-click on Staff.EXE to run the Staff module.

GlobalSettings
All settings that apply to the Laboratory Code you have logged into, appear under the Global Settings. Only
one Staff Code has access to the Global Settings the CCLASMGR.
So in the Staff Module, you will double-click on CCLASMGR, and click on the Settings tab to access the
Global Settings. How to do this, is explained in the Basic Training material under the Staff section.
Let us look at the Root directory for CCLAS:

61

No that the CCLASRootDirectory points to the path C:\MMQ\DEMO\. Obviously this path is not the one we
have installed our directories to, we have to change it.
You can either change it by double-clicking on the CCLASRootDirectory setting:

or by pressing Ctrl+Enter:

Next, let us look at the EXEDirectory:

62

CCLAS 1.4

Suppose you have installed the Program Files to the same main directory as where you have installed the
other directories, you may choose to enter %CCLASRootDirectory%EXE\. But what if the EXEs have been
installed to a different directory than the Root? You will need to enter the true path of where the EXEs are,
as in the screen shot above.
So, when you log in again, the correct menu will appear:

63

Look at the Menu:


You will notice that, on the CCLAS menu, there are many icons. Each of these icons represent a Program
from now on we call them Modules - or a Script. Programs are inherent to CCLAS, we cannot change them.
Scripts are pieces of programs written by your consultant, and they can be changed we will look at scripts
later.
As we all have learned from the Basic Training Course, one Modules input depends very much on another
Modules input. The following diagrams will show you how they fit in together:
(The Modules name is in caps, the settings inside the modules are in mixed case)

Diagrams
Setup Modules

64

CCLAS 1.4

Analysis Modules

65

Setup and Analysis Modules

66

CCLAS 1.4

CCLASEL Module Relationship


Note that the Modules may be selected into groups. The following table shows which Modules belong to
which groups:
Configuration Modules

Processing Modules

Management Modules

Licence

Job

Status

Staff

Sample Type (SamReg)

QC (PerfAna)

Setup

Batch

SPC (StatPC)

Client

On-Line (Samana)

Dashboard

Method

Data Entry (MDE)

Audit

Analytical Report

Job Audit

Invoice

SamTrack

Taskman

LabMaint
Revenue
Consumables

The Modules existing in the Configuration group, first have to contain all data for Modules in the Processing
group to work correctly; and Modules in the Processing group have to contain all information for the Modules
in the Management group to work correctly.
How to set up or use of all these Modules are explained in the Basic Training Course.

Program Settings and the Programs They Relate To


Let us open the Staff module once again, with the Setting tab for CCLASMGR exposed. In the left pane, you
will see a whole list of items. Every one of these items controls something, somewhere in CCLAS. Some of
these items work in conjunction with other items, some control parts of CCLAS on their own.
We have quickly gone over these settings during the Basic Training Course, during this course, we will look
at them more closely.
The following table shows how these settings fit in with each other:

Module
Licence

Table or Function
LICENCE

Relating Description
Controls the Licence program settings which perform
the function of adjusting the workstation licensing
recorded. User can add/delete workstations from this
table.

67

Module
CCLAS Menu

Table or Function
CCLAS

Relating Description
This is the CCLAS Main menu application. Normally
all users will be able to run this application (ie 1 or 2),
but not all users should be able to adjust their own
menu (access 3).

Staff

STAFFAPP

Controls the Staff program and what settings are


required.

STAFF

Controls the Staff Code access and settings and


whether the staff settings against individual users can
be adjusted.

GROUPING

Control the Staff Group settings and whether the staff


groups can be adjusted

Setup

CONFIG

Controls the Setup program and what settings are


required.

LAB

Controls the settings of the LabCodes.

LOB

Controls the settings of the LOB (Line of Business


Codes.)

GROUPLAB

Controls the settings of the Lab Groups (groups of


LabCodes).

SECTION

Controls the settings of the Lab Sections

GROUPSECTION

Controls the settings of the Lab Section Groups

HOLIDAYS

Controls the settings of the working holidays

UNIQUENO

Controls the settings of the unique counter numbers (ie


auto job, sample, reports etc)

IDENTRULES

Controls the settings of the Automatic Sample


Identification rules (not used with this lab).

UNIT

Controls the settings of the Units and Conversions.

ROUNDING

Controls the setting of the Rounding Tables

STATUSCODES

Controls the settings of the definable Status Codes.

INSTRUMENT

Controls the settings of the Instruments

TAX

Controls the settings of the Tax codes

INVCONVERSION

Controls the settings of the Price Books (Invoice


conversion groups)

PRICE

Controls the settings of the Price Codes

GROUPPRICE

Controls the settings of the Price Code Groups (ie


quotes)

68

CCLAS 1.4

Module

Table or Function
CANNEDCOMMENTS

Relating Description
Controls the settings of the Canned Comments that
can be recorded and used in custom programs/scripts
etc.

Client

CLIENTAPP

Controls the Client program and what settings are


required.

Method

CLIENT

Controls the settings of the Client codes

GROUPCLIENT

Controls the settings of the Client groups

COSTCENTRE

Controls the settings of the Cost Centres

SCHEMEAPP

Controls the Method (Scheme) program and what


settings are required.

SCHEME

Controls the settings of the Scheme & Analyte codes

PRODUCT

Controls the settings of the Product codes

PROCREG

Controls the settings of the Procedures

QCONTROL

Controls the settings of the QC Samples (Stds, Blanks


etc)

Job

PROFILE

Controls the settings of the Job registration tasks.

PROFILEAPP

Controls the Profile program and what settings are


required.

Sample Type

SAMREG

Controls the Sample Type (SamReg) program and the


settings when it runs.

Batch

BATCH

Controls the Batch program and the settings when it


runs.

On-Line

SAMANA

Controls the Online (Samana) program (used to


capture data from instrument ASCII files) and the
settings when it runs.

Data Entry

MDE

Controls the Manual Data Entry (MDE) program and


the settings when it runs.

Analytical Report

REPORT

Controls the Report program and the settings when it


runs.

Invoice

INVOICE

Controls the Invoice program and the settings when it


runs.

Audit

AUDIT

Controls the Audit program and the settings when it


runs. Audit keeps track of the changes to the Client
and Method applications.

Job Audit

AUDITJOB

Controls the Job Audit program and the settings when


it runs. Job Audit keeps track of the changes made to
all jobs.

69

Module
Status

Table or Function
STATREP

Relating Description
Controls the Status Report program and the settings
when it runs.

Revenue

REVENUE

Controls the Revenue Report program and the settings


when it runs. (Revenue reports based on the
information recorded during the Invoice processes.)

QC

PERFANA

Controls the QC program and the settings when it


runs. (QC can generate charts and statistics on QC
samples like standards, blanks etc)

SPC

STATPC

Controls the Statistical Process Control program and


the settings when it runs. SPC allows for multiple
charts of the results of QC samples, customer samples
against specifications etc.

Sample Track

SAMPLETRACK

Controls the Sample Tracking program and the


settings when it runs.

STLOCATION

Controls the settings of the Locations that are used in


Sample Tracking.

STCONTAINER

Controls the settings of the Containers that are used in


Sample Tracking.

STPHYSICALTYPE

Controls the settings of the Sample splits/portions that


are used in Sample Tracking.

STACTION

Controls the settings of the Actions (ie dump, return)


that are used in Sample Tracking.

STJOB

Controls the settings of the Job and Sample


information that are used in Sample Tracking.

Lab Maintenance

LABMAINTENANCE

Controls the Laboratory Maintenance program and the


settings when it runs.

LABMAINT

Controls the settings of the Lab Maintenance tasks and


groups of tasks.

LABMAINTAUDIT

Controls the settings of the Lab Maintenance audit


histories.

Consumables

CONSUMABLES

Controls the Consumables program and the settings


when it runs.

CMCONSUME

Controls the settings of the Consumable codes


(chemicals etc used in the lab).

CMSUPPLIER

Controls the settings of the Suppliers of consumables


(ie Chemical suppliers).

70

CCLAS 1.4

Module

Table or Function
CMCONSUMETYPE

Relating Description
Controls the settings of the types (categories) of
Consumables used in the lab.

Dashboard

DASHBOARD

Controls the Dashboard program and the settings


when it runs. Dashboard can be used to design
customised screens/forms, as well as host the
Management Dashboard screens.

Communication

COMMVIEW

View

Controls the CommView program and the settings


when it runs. CommView is a multiple Com Port
(RS232) logging program able to log the RS232
transmissions of multiple instruments. Not likely to be
used in the lab.

General Utilities

GENUTIL

Controls the GenUtil program and the settings when it


runs. GenUtil allows access to view the structures of
the CCLAS tables, as well as prompt translations, as
well as to look at the CCLAS Scripting Object Models.

Global Laboratory

GLOBALSETTINGS

This section stores all the default laboratory (LabCode)


wide general CCLAS settings that may not be program
specific or across multiple programs. This section is
only available under the CCLASMGR staff code.
(Each LabCode will have its own CCLASMGR master
settings.)
These settings will apply to all users.

USERGLOBALSETTINGS

This section stores all the default laboratory (LabCode)


wide general (non-Standard or Customised) settings
that may not be program specific or across multiple
programs. These settings will allow to all users.
ONLY USED AS PART OF CUSTOMISED
SOLUTIONS NOT USED IN STANDARD CCLAS.

USERSETTINGS

This section stores all the default user settings for nonstandard or customised settings that may no be
program specific or across multiple programs. These
settings can be user specific.
ONLY USED AS PART OF CUSTOMISED
SOLUTIONS NOT USED IN STANDARD CCLAS.

Task Scheduler

TASKMAN

Controls the TaskScheduler program which is for


automated tasks that are performed by this module.

71

Settings
GlobalSettings
As we have seen earlier, the Global Settings control the settings that apply globally throughout the whole of
CCLAS, for the selected Lab Code. The GlobalSettings setting is only available to CCLASMGR.
Next is an explanation of what every Global Setting does and mean:
Setting

Value

Details

Accreditation

<text>

Denotes the laboratory's accreditation.

AllowCascadeUp-

Enabled / Disabled

If enabled, a Schemes complete status will be

IncompleteStatuses

reset if a result was deleted from a analyte or if a


status value other than complete results from a
changed data value.

ApplicationPicture

%CCLASRootDirectory%

Is the URL of the splash screen file, located in the

PICTURE\ CCLASEL.BMP directory defined by the %PictureDirectory% global


setting, displayed when CCLASEL starts up.
Normally %CCLASRootDirectory%PICTURES.
ArchiveDirectory

%CCLASRootDirectory%

Defines the directory where CCLAS EL archived

ARCHIVE

job ZIP files are located. Normally


%CCLASRootDirectory%ARCHIVE.

AuditFormatted-

Enabled / Disabled

ValueHistory
AuditHistory

If enabled, when a formatted value is used, it will be


audited.

Enabled / Disabled

Defines whether or not the writing to CCLAS EL


quality control history table occurs automatically.

AutoActivate

Enabled / Disabled

Defines whether the date activated is updated with


the system date when the concentration records
are created for the job. The default setting is
ENABLED.
If this setting is DISABLED jobs not manually
activated will not be available for labbatching

AutoCompleteWithout-

Enabled / Disabled

StatusCheck

This defines whether jobs and schemes are


automatically marked completed based only on
analytes allocated as Status Active. If no analytes
in a scheme are set as status active this will be set
as complete as soon as the job is started.

AutoJobComplete

Enabled / Disabled

Defines whether jobs are automatically completed


when their schemes are completed.

72

CCLAS 1.4

Setting

Value

Details

AutoLicenceOut

Enabled / Disabled

If enabled, if the CCLASEL menu program setting


AutoLogout is also enabled, when the user exits the
CCLASEL menu or logs out via any CCLASEL
program, their slot in the Licence table is set to "Not
in use". This enables other users to use that licence
to log into CCLASEL. This setting is typically used
when the maximum number of concurrent users is
less than the maximum number of non-concurrent
users, as defined by the CCLASEL licence at that
site.

AutoPrepComplete

Enabled / Disabled

Defines whether preparation schemes are


automatically marked as completed when the job is
started.

AutoProductValidation

Enabled / Disabled

Automatically validate results that pass the Product


limits.

AutoSchemeComplete

Enabled / Disabled

Defines whether schemes are automatically


completed when the analytes for the scheme are
completed.

AutoStoreFormatted-

Enabled / Disabled

Value
AutoUnitConversion

Automatically store the Formatted Value of the


result.

Enabled / Disabled

If enabled, unit conversion will automatically be


done between the base currency and the currency
specified for the client.

AveragePriority

Denotes the default average priority assigned to a


new client. Measured in Days or Hours depending
on the value of the PriorityUnit setting

BaseCurrency

<currency unit>

Is used to determine what the local currency is,


based upon the codes specified in the
InvConversion table, accessed from the Invoice
Conversions item in the Setup module. Ideally, the
Conversion factor for this code in the
InvConversion table should be 1.

BinDirectory

73

%CCLASRootDirectory%

Defines the directory where various temporary

BIN

CCLASEL files are located.

Setting

Value

Details

CCLASRootDirectory

<//servername/cclasel

Defines where the CCLASEL directories are

directory>

located. This logical name may be used when


referring to CCLASEL directories under the root.
Normally \\servername\cclasel.

CertifyingOfficer

<text>

Is the name of the laboratory's certifying officer.

CertifyingOfficerTitle

<text>

Is the title of the laboratory's certifying officer.

CollDirectory

%CCLASRootDirectory%

Defines the directory where CCLASEL collated

COLL

output files (reports, etc.) are located. Normally


%CCLASRootDirectory%COLL.

CompanyName

<text>

Is the name of the company.

ConfigDirectory

%CCLASRootDirectory%

Defines the directory where CCLASEL

CONFIG

configuration files are located. Normally


%CCLASRootDirectory%CONFIG.

ExeDirectory

%CCLASRootDirectory%

Defines the directory root where CCLASEL

EXE

executable files are located. Normally


%CCLASRootDirectory%EXE.

FormulaLocalised

Enabled / Disabled

Allows for non English formula syntax, e.g. instead


of IF, SI (for Spanish) may be used.

HelpDirectory

%CCLASRootDirectory%

Defines the directory where CCLASEL help files

HELP

are located. Normally %CCLASRootDirectory


%HELP.

HelpFile

<text>

Defines the name of the CCLASEL help file


accessed from within CCLASEL modules, located
in the directory defined by the %HelpDirectory%
global setting.

IdentsDirectory

%CCLASRootDirectory%

Defines the directory where CCLASEL sample

IDENTS

ident files are located. Normally


%CCLASRootDirectory%IDENTS.

IFFScriptsDirectory

%CCLASRootDirectory%

Defines the directory where CCLASEL instrument

IFFSCRIPTS

format file scripts are located. Normally


%CCLASRootDirectory%IFFSCRIPTS.

IncludeWeekends

Enabled / Disabled

If enabled, weekends will be included in the


calculation to determine sample date and time
required, etc.

74

CCLAS 1.4

Setting

Value

Details

INSTDataDirectory

%CCLASRootDirectory%

Defines the directory where CCLASEL instrument

INSTDATA

data files are located. Normally


%CCLASRootDirectory%INSTDATA.

InvoiceMessage

<text>

Defines the default invoice message placed on an


invoice template.

LaboratoryName

<text>

Is the name of the laboratory.

LBAddQCAlways

Enabled / Disabled

If enabled, will add a Scheme-specified QC upon


creation of a Lab Batch.

LBAutoJobNo

<Unique Number>

Defines the default laboratory batch creation


automatic job number.

LBDefaultTemplate

<Template Job Number>

Defines the default laboratory batch creation


template job to copy schemes and analytes from.

LBIncludeNA

Enabled / Disabled

If enabled, will copy NA cells alongside non-NA


cells into a laboratory batch, as well as marking NA
in replicates, rereads, etc, of the unknown samples
which have NA. If this setting is absent, the default
is disabled.

LoginDirectory

LoginOutEventLogFile

%CCLASRootDirectory%

Defines the directory where CCLAS EL login script

LOGIN

files (menus, etc.) are located.

%CCLASRootDirectory%

If a filename is present, login and logout events are

BinDirectory\

written to the file. If the filename is blank, events

LoginOutEvent.log

can be written to the NT Event Log file on non Win


95/98 computers if LoginOutNTEventLog is
enabled.

LoginOutNTEventLog

Enabled / Disabled

If the filename supplied by LoginOutEventLogFile is


blank, if LoginOutNTEventLog is enabled, login and
logout events are written to the NT Event Log file
on non Win 95/98 computers.

MDEScriptsDirectory

%CCLASRootDirectory%

Defines the directory where CCLAS EL Data Entry

MDESCRIPTS

script files are located. Normally


%CCLASRootDirectory%MDEScripts.

MinimumProrataBLK

MinimumProrataREP

75

One/Block / Zero /

Minimum amount of Blanks to be added to a block

One/Segment

or segment of samples.

One/Block / Zero /

Minimum amount of Replicates to be added to a

One/Segment

block or segment of samples.

Setting

Value

Details

MinimumProrataSPK

One/Block / Zero /

Minimum amount of Spikes to be added to a block

One/Segment

or segment of samples.

One/Block / Zero /

Minimum amount of Standards to be added to a

One/Segment

block or segment of samples.

%CCLASRootDirectory%

Defines the directory where CCLAS EL note files

NOTES

(methods, scheme details, etc.) are located.

MinimumProrataSTD

NotesFileDirectory

Normally %CCLASRootDirectory%Notes.
PictureDirectory

%CCLASRootDirectory%

Defines the directory where various CCLAS EL

PICTURE

picture files (staff photos, etc.) are located.


Normally %CCLASRootDirectory%Picture.

PriorityUnit

Hours / Days

If set to Days, calculates date and time due by


adding priority to the date received, and if set to
Hours, calculates date and time due by adding the
priority to the time received.

ProcedureJob-

Enabled / Disabled

Pricecode

If enabled, when schemes are added to a job using


a procedure, the price code comes from the
scheme in the procedure and not from the scheme
itself.

ProtectedFields-

<colour>

BackgroundColour

Colour of the background of fields that are


protected.

QCHistory

Enabled / Disabled

If enabled, QC History records will be updated.

QControlDirectory

%CCLASRootDirectory%

Defines the directory where CCLAS EL quality

QCONTROL

control files are located. Normally


%CCLASRootDirectory%QControl.

ReportDirectory

%CCLASRootDirectory%

Defines the directory where CCLAS EL report files

REPORTS

(e.g. Crystal Reports) are located. Normally


%CCLASRootDirectory%REPORT

ReportNonValidated

Enabled / Disabled

If enabled, final reports will display non-validated


data. Otherwise reporting of such data is blocked.

RunListDirectory

%CCLASRootDirectory%

Defines the directory where CCLAS EL laboratory

RUN

run files are located. Normally


%CCLASRootDirectory%RUNLIST

76

CCLAS 1.4

Setting

Value

SpikeDesIdSource

Details
To determine the source of the PJC.DESCRIPTION
for spike samples, either SampleIdent,
ExternalIdent or Description of the original sample.
For example, if a sample with sample ident "ABC"
and external ident "DEF" were being spiked, if the
setting for SpikeDestIdSource were
[PJC.EXTERNALIDENT], the spike would get an
external ident of "DEF", but if the setting for
SpikeDesIdSource were [PJC.SAMPLEIDENT], the
spike would get an external ident of "ABC".

SpikeExtIdSource

To determine the source of the


PJC.EXTERNALIDENT for spike samples, either
SampleIdent, ExternalIdent or Description of the
original sample. For example, if a sample with
sample ident "ABC" and external ident "DEF" were
being spiked, if the setting for SpikeExtIdSource
were were [PJC.EXTERNALIDENT], the spike
would get an external ident of "DEF", but if the
setting for SpikeExtIdSource were
[PJC.SAMPLEIDENT], the spike would get an
external ident of "ABC".

TemplateDirectory

%CCLASRootDirectory%

Defines the directory where CCLAS EL template

TEMPLATES

files are located. Normally %CCLASRootDirectory


%TEMPLATES.

UpdateLinkedSchemes

Enabled / Disabled

If enabled, the weights of samples in the child


linked schemes are updated automatically with the
same weight for the parent scheme.

UpdatePriority

Enabled / Disabled

If enabled, the priority of a job is updated whenever


the date and time received or date and time
required are changed.

UseIdentsFiles

Enabled / Disabled

If Enabled, all Internal Idents will be written to an


IDS file in the Idents directory. If Disabled, Internal
Idents will only be written to an IDS file if the Idents
directory if the size of the IDSFILE field in the
ProfJob table is too small to hold all the characters.

UseWindowsPassword

Enabled / Disabled

If enabled, the same password as logging in to


Windows will apply.

77

Setting

Value

Details

UseWindowsUsername

0/1/2

Used to enforce logon using the Windows


username. 0 indicates User must enter username,
1 indicates User can enter username, which
defaults to the Windows username, or 2 indicating
User cannot modify the username, which defaults
to the Windows username. A Staff Code same as
the Windows username must be created in the
Staff Module.

Initialization Variable Settings


The initialisation variable settings are accessed through the Staff module, on the Settings tab. To change
any initialisation variable setting, click on the module in the Folder Items listbox, and change the settings in
the Explorer type screen on the right.
All modules may have some initialisation variable settings that are the same across modules (e.g.
AccessLevel), but other modules may have some unique variable settings that will only appear for that
specific module (e.g. the MDERunn settings for the Data Entry module).
These settings control the behaviour of modules.
For a complete list of all other settings, see Appendix B.

General
Directories
When you installed CCLAS, most of the directories were automatically created. Should you need more
directories, for instance, a backup directory, you may create it yourself. Through scripting, some additional
directories may be very useful.
All of us use the INSTData or InstrumentData directory (the name is up to the Client), where the data files
collected from instruments, are dumped. The IFFScripts the scripts that capture results out of the datafiles
look inside the INSTData directorys sub-directories to pick up files for every instrument.
The directories that are created during installation, are the following:
Directory

Ini Variable Setting (inside GlobalSettings)

CCLASRootDirectory

\\<ServerName>\<CCLASELDirectory>\

ArchiveDirectory

%CCLASRootDirectory%ARCHIVE

BinDirectory

%CCLASRootDirectory%BIN

CollDirectory

%CCLASRootDirectory%COLL

ConfigDirectory

%CCLASRootDirectory%CONFIG

ExeDirectory

%CCLASRootDirectory%EXE\

HelpDirectory

%CCLASRootDirectory%HELP

78

CCLAS 1.4

IdentsDirectory

%CCLASRootDirectory%IDENTS

INSTData

%CCLASRootDirectory%INSTDATA

IFFScriptsDirectory

%CCLASRootDirectory%IFFSCRIPTS

LoginDirectory

%CCLASRootDirectory%LOGIN

MDEScriptsDirectory

%CCLASRootDirectory%MDESCRIPTS

NotesFileDirectory

%CCLASRootDirectory%NOTES

PictureDirectory

%CCLASRootDirectory%PICTURE

QcontrolDirectory

%CCLASRootDirectory%QCONTROL

ReportDirectory

%CCLASRootDirectory%REPORT

RunListDirectory

%CCLASRootDirectory%RUNLIST

TemplateDirectory

%CCLASRootDirectory%TEMPLATES

TipFileDirectory

%CCLASRootDirectory%TIPFILE

Setting up Tip files


Tip files are saved in the TipsDirectory (%CCLASRootDirectory%TIPS), as was specified in the
GlobalSettings. Each file has the extension of *.TIP.
Messages are being typed into these tip files, each line represents a new message.
If the ShowTipOfTheDay setting is enabled, these tips will display, else no tip files will display.
Let us create a tip file for the MDE Module:
Remember to validate your results!
Averages only for REPs
Save results when done!
In the Staff module, for MDE, the TipeOfTheDayFile is set to %CCLASRootDirectory%TIPS\MDE.TIP. Also,
if the ShowTipOfTheDay is enabled, tips will show every time the Staff Code this has been assigned to,
opens MDE:

79

Staff
For more information on the Staff module, see the Basic Training Manuals, Staff section.
Except for creating new Staff Codes, we use the Staff module to control the behaviour of every other module
used in CCLAS.
We have already looked at Global Settings, the controlling settings of the whole of CCLAS for the Laboratory
CCLASMGR has signed into.

But what about all the other settings?

Settings
We are going to look at a few examples. Remember earlier we looked at Program Settings and the
Programs they belong to? Now we are going to delve a little deeper.
See the Staff settings again yes, the Staff Module contains its own settings as well!
Staff

STAFFAPP

Controls the Staff program and what settings are


required.

STAFF

Controls the Staff Code access and settings and


whether the staff settings against individual users can
be adjusted.

80

CCLAS 1.4

GROUPING

Control the Staff Group settings and whether the staff


groups can be adjusted

See that we have three settings here.


STAFFAPP

It is the settings that control the view of the Staff Module when you open it. In the
Settings document (Appendix B), under the Staff App settings, you will see the
following few:
AccessLevel, AllowProperties, MainListViewGrid, ShowTipOfTheDay and
TipOfTheDayFile. These are the only properties that are available for the STAFFAPP
setting.

STAFF

The following settings appear in the STAFF item: AccessLevel, Criterian,


CurrentCriteria, Edit1ListViewColumnn, Edit2ListViewColumnn,
MainListViewColumnn, ReportLDFn

GROUPING

These settings are in the Grouping item: AccessLevel, Criterian, CurrentCriteria,


MainListViewColumnn, ReportLDFn

Not that the AccessLevel setting appears for each of these three Items. If the accesslevel for the STAFFAPP
item is set to 3, but the AccessLevel for STAFF and / or GROUPING are set to 0, the user is still allowed to
open the Staff Module, but will have no access to see Staff Codes or Staff Groups. Conversely, if the
STAFFAPP item is set to 1 (read access), but the Access Levels to STAFF and / or GROUPING are set to 3,
the user will have full access to STAFF and GROUPING regardless of his access to the STAFF Module
itself.
Let us take the settings for the Method (Scheme) Module:
Method

SCHEMEAPP

Controls the Method (Scheme) program and what


settings are required.

SCHEME

Controls the settings of the Scheme & Analyte codes

PRODUCT

Controls the settings of the Product codes

PROCREG

Controls the settings of the Procedures

QCONTROL

Controls the settings of the QC Samples (Stds, Blanks


etc)

If a specific user is assigned to update Product limits only, but may not make changes to Schemes,
Procedures and QCs, what would happen? Maybe he may have read access to these three AccessLevel
1 but he will certainly have an Access Level 3 to Product. Also, he will have at least an Access Level of 1.
An Access Level of 0 will cause the following message:

81

Every time a new Staff Code is created, it automatically inherits all the settings as it exists for the
CCLASMGR. Upon creation all Access Levels are set to 0, and the administrator will have to set them
correctly according to which Modules the Staff Code will have to access.

Profile Screen Files


See what happens when we create a new Staff Code, and we look specifically at the Profile settings (which
is part of the Job Module):

Not that this Staff Code has been given an Access Level of 3 but no other settings are visible. How does it
know how to handle the Job part in the Profile (Job) module?
Look at the settings for CCLASMGR:

82

CCLAS 1.4

See that all relevant settings are visible now! Specifically look at the settings that start with ScreenFile. In
the screen shot above, you will see ScreenFile1 to ScreenFile5. This means that, when CCLASMGR opens
the Profile (Job) Module, all these registration scripts (screen files) are visible to him.
If we leave the Staff Code that we have created earlier, empty, all these registration scripts (screen files) are
also visible to him.

But assume that the new Staff Code should only see the registration script for Production Samples,
ScreenFile3, for CCLASMGR, and none of the others?
When you right-click to add a new setting, you will see the following screen:

83

On a previous screen capture, you have notices that ScreenFile3 refers to the Production Samples
registration screen. But you do not move ScreenFile3 over to the right! You move ScreenFile1 over. Why?
Because every setting that has a numerical order, must start from 1 and increment by 1 until the last setting
of the same type you add.
So, we add ScreenFile1 to the right:

84

CCLAS 1.4

and click OK. It looks like the next screen capture:

But ScreenFile1 refers to Train Samples, so we have to change it. Double-clcik on ScreenFile1, and correct
the details:

85

Now the new Staff Code will only see the registration script for Production Samples when opening the Profile
module:

Runn Files
Suppose we have created a new VBScript that hase to calculate Averages between Replicates in MDE. This
file needs to be added to the dropdown next to the Command button. Every new SCR file or VBS file one
wants to add to any module, needs to be defined for CCLASMGR first before you can add it to any other
user as in the example of the Profile Screen Files.
Once again, in the Staff Module, look at the MDE settings for CCLASMGR.

86

CCLAS 1.4

Not the settings that start with MDERun it starts at MDERun1 and ends at MDERun6. We need to add
another VB to the dropdown so, we add a new MDERun7. Remember, these settings have to be in
numerical order.
Now this setting is available to add to specific users, if need to, as was done with the Profile screen in the
previous example.

Other Modules
The following other Modules have settings that work the same way:
Module

Setting

All Modules

ReportLDFn

CMConsume

UNITUnitTextn
VOLUnitTextn
WTUnitTextn

Consumables

ConsumablesRunn

MDE

MDERunn

Samana (Online)

SamanaRunn

Profile

ProfileRunn
ScreenFilen

SamReg

ScreenFilen

StatPC

AutoRunn

Taskman

AutoRunn

Lab Maintenance

LabMaintenanceRunn

Sample Track

SampleTrackRunn

Consumables

ConsumablesRunn

Setup
The Setup Module is explained in the CCLAS Basic Training Manual.
We will look at some of the settings in the Setup (Config) Module that are the responsibility of the CCLAS
Administrator, and seems likely to cause most confusion:

Unique Numbers
Unique numbers can be used whenever CCLAS EL needs the next available number in a numerical
sequence, for example, when entering new jobs or internal sample numbers.
Suppose the laboratory receives a new type of Sample on a routine basis let us create Unique Numbers
for Mining samples.
First, we want an automatic Job Number for Mining Jobs, in the following format:
MINE-2007-0001

87

Where:

MINE = identifier
070901 = yymmdd
0001 = incremental number

This format assumes that we will not generate more than 9999 Mining Jobs during 2007.

Firstly, the Sequency type is Job, since we are registering a Mining Job.
The Sequency format will define what format the Job number will take, as it appears in the floating screen in
the screen capture above. The Sequence format takes the syntax of
RV="MINE-"&CSTR(YEAR(NOW))&"-"&RIGHT("0000"+TRIM(CSTR(NUN)),4) for programmers this
will make more sense than for non-programmers.
So where and how does this Job number gets used?
When you open the Profile (Job) Module, to manually create a job i.e. without a registration screen the
Job sequence you have just created, appears in the Job Number dropdown. Every time a Mining Job is
created, you can use this way to do it, and the sequence will increment by 1 each time a new Job is
registered.

88

CCLAS 1.4

But the Unique number you have created is not only limited to automatic Job creation. One can use this
Unique number in scripts as well.
Next, we have to create a Unique number to name our Samples as well.
Suppose the format of the Sample is:
MIN-070901-001
Where:

MIN = Identifier
070901 = yymmdd
0001 = incremental number.

The Sample Ident above assumes that there will be no more than 999 Samples per day.

89

Now this sequence is available when you manually or automatically register samples:

In the following extraction from a script, it so happened that a specific instrument could not accept more than
12 characters. But the Sampleident was much longer than that so we use the Unique number system to
create an Instrument String for each Sample.

90

CCLAS 1.4

'=================================
'GET UNIQUE NUMBER
'=================================
Function GetUniqueNumber(sUniqueNo)
Dim oUniqueNo
'
Set oUniqueNo = CreateObject("CCCFG01.clsBDUniqueNo")
Set oUniqueNo.Security = clsSecurity
oUniqueNo.GetSequence sUniqueNo, True, "", Now()
'
If oUniqueNo.NoItems < 1 Then
Exit Function
End If
'
GetUniqueNumber = oUniqueNo.FirstUniqueNo
'
Set oUniqueNo = Nothing
End Function
'
Unfortunately this code on its own does nothing, it is simply a function used in a greater script.

Rounding Codes
Rounding codes are used when numerical data is to be reported, but rounded based upon the analytical
detection limit, a given picture format and a concept referred to as nice numbers conversion. Rounding is
based on ISO Rounding Rules.
Rounding codes are assigned to numerical analytes of schemes and are used when this analyte is included
in a report which requires rounding.
Each Rounding code has a table of values used to determine the rounding method.

91

In the screen capture above, we are specifically looking at the Rounding Table of the PPM measurement
unit. How does this table work?
Since it is the table for PPM, we can safely assume that all analysis are done in PPM, some will be reported
in PPM, and others will be reported in %.
Line 12 to Line 18 is about what the number should look like if the reporting happens in %. Suppose the
value of an analyte is 274380. Start at the top of the Detection Limit column. If you scroll down to line 12
where the value is 0, it seems likely that this is the entry point for rounding but moving one column to the
right, the next line shows a value that is less than the value our instrument has given. So if we move down
to where our value is between two of the values in the Ceiling column, that is where line 14 is less than our
value, but line 15 is more than our value, we will use the rounding in line 14. Since PPM has to be converted
to %, it will take into account the conversion factor as was set up in the Setup Module, under Unit Codes
and convert it to X.XX%.
All of us have experienced at some stage the ****** appears on the report, or the value is simply not there.
This is where you find the cause for that!

Where may all the Setup settings used?


Let your imagination run wild!
All these settings can be used in Scripts. Let us look at an example:
Assume you have a Laboratory Section where certain Staff members are assigned to. So, a Lab Section
gets created. A Staff Group (in the Staff Module), gets created. Link these two and one can see what the
turnaround time for each of the Staff members are!
We will have a look at some of them, all of them are explained in the Basic Training Course.

Laboratory Sections
Laboratory Sections can by default be used in the Method Module each Scheme may be carried out by
one of the Sections only in this case you will select the Section on the General Tab of the Scheme.

92

CCLAS 1.4

Holidays
Here are a few settings in the Staff Module that can co-operate to work out the date when Jobs are expected
to be completed. Assume we have created the days around Easter as Holidays it is 4 days. Suppose we
have set the GlobalSetting IncludeWeekends to Disabled, we have set the AveragePriority to 5, and we have
set the PriorityUnit to Days. The AveragePriority of 5 together with the PriorityUnit of Days, means that a Job
is required 5 days after it has been received in the laboratory. But suppose Easter weekend falls within
these 5 days? Since Easter weekend is 4 days long, and weekends are not included, it means that the
required date is now 9 days the 5 days it was originally allowed, plus the 4 days that fall on the Easter
weekend.

Unit Codes
We define unit codes to link to Analytes. The Analysis Unit Code may differ from the Reporting Unit Code, it
often happens that we measure an analyte in PPM and report it in %, as in the following screen capture:

93

CCLAS API
Intrinsic Controls in CCLAS scripting.
In Visual Basic there are a set of default controls built in to it, which are called intrinsic controls. These
controls cannot be handled as generically as other controls and as such need some special coding to make
them available to the CCLAS scripts.
The purpose of this document is to provide a list of the controls and the events available in CCLAS scripting.
All the properties and methods of the controls will be available (although methods that pass values by
reference will have problems as there is only a variant type in VBScript), so only the events available are
listed here.

94

CCLAS 1.4

Control
CheckBox

Events
Click
GotFocus
KeyDown
KeyPress
KeyUp
LostFocus
MouseDown

MouseMove

MouseUp

ComboBox

Validate
Change
Click
DblClick
DropDown
GotFocus
KeyDown
KeyPress
KeyUp

CommandButton

LostFocus
Validate
Click
GotFocus
KeyDown
KeyPress
KeyUp
LostFocus
MouseDown

MouseMove

MouseUp

DirListBox

95

Change
Click

Parameters
KeyCode
Shift
KeyAscii
KeyCode
Shift
Button
Shift
X
Y
Button
Shift
X
Y
Button
Shift
X
Y
Cancel

KeyCode
Shift
KeyAscii
KeyCode
Shift
Cancel
KeyCode
Shift
KeyAscii
KeyCode
Shift
Button
Shift
X
Y
Button
Shift
X
Y
Button
Shift
X
Y

Comments

Control

Events
GotFocus
KeyDown
KeyPress
KeyUp

Parameters

Comments

KeyCode
Shift
KeyAscii
KeyCode
Shift

LostFocus
Scroll

Fired when controls


scroll box is
repositioned.

DriveListBox

Validate
Change
GotFocus
KeyDown
KeyPress
KeyUp

Cancel
KeyCode
Shift
KeyAscii
KeyCode
Shift

LostFocus
Scroll

Fired when controls


scroll box is
repositioned.

DTPicker

Validate
Change
Click
DblClick
GotFocus
KeyDown
KeyPress
KeyUp
LostFocus
MouseDown

MouseMove

MouseUp

FileListBox

Validate
Click
DblClick
GotFocus
KeyDown
KeyPress
KeyUp
LostFocus

96

Cancel

KeyCode
Shift
KeyAscii
KeyCode
Shift
Button
Shift
X
Y
Button
Shift
X
Y
Button
Shift
X
Y
Cancel

KeyCode
Shift
KeyAscii
KeyCode
Shift

CCLAS 1.4

Control

Events
PathChange

Parameters

Comments
Fired when the
FileName or Path
property is changed
in code.
Fired when the

PatternChange

FileName or Pattern
property is changed
in code.
Fired when controls

Scroll

scroll box is
repositioned.
Frame

Validate
Click
MouseDown

MouseMove

MouseUp

Image
Line
ListBox

Click
DblClick
GotFocus
KeyDown

LostFocus
MouseDown

MouseMove

MouseUp

97

Button
Shift
X
Y
Button
Shift
X
Y
Button
Shift
X
Y

Click
DblClick

KeyPress
KeyUp

OLE

Cancel

Validate
Click
DblClick
GotFocus

KeyCode
Shift
KeyAscii
KeyCode
Shift
Button
Shift
X
Y
Button
Shift
X
Y
Button
Shift
X
Y
Cancel

Control

Events
KeyDown
KeyPress
KeyUp
LostFocus
ObjectMove

Resize

Parameters
KeyCode
Shift
KeyAscii
KeyCode
Shift

Comments

Left
Top
Width
Height
HeightNew
WidthNew

Fired when controls


object is moved while
active.
Fired when object is
first loaded or its
window state

Updated

Code

changes.
Fired when objects
data has been
changed.

OptionButton

Validate
Click
DblClick
GotFocus
KeyDown
KeyPress
KeyUp
LostFocus
MouseDown

MouseMove

MouseUp

PictureBox

Validate
Click
GotFocus
KeyDown
KeyPress
KeyUp
LostFocus
MouseDown

MouseMove

98

Cancel

KeyCode
Shift
KeyAscii
KeyCode
Shift
Button
Shift
X
Y
Button
Shift
X
Y
Button
Shift
X
Y
Cancel
KeyCode
Shift
KeyAscii
KeyCode
Shift
Button
Shift
X
Y
Button
Shift

CCLAS 1.4

Control

Events
MouseUp

Validate
Shape
TextBox

Change
Click
DblClick
GotFocus
KeyDown
KeyPress
KeyUp
LostFocus
MouseDown

MouseMove

MouseUp

Timer

Validate
Timer

Parameters
X
Y
Button
Shift
X
Y
Cancel

Comments

KeyCode
Shift
KeyAscii
KeyCode
Shift
Button
Shift
X
Y
Button
Shift
X
Y
Button
Shift
X
Y
Cancel
Fired when the time
interval set has
elapsed.

Customised Controls With Limited Events


There are some other controls that only use a subset of the controls actual events in scripting. These are 3 rd
party controls. The events for each of these is listed below
Control
DTPicker

Event
Change
Click
DblClick
GotFocus
KeyDown
KeyPress
KeyUp
LostFocus
MouseDown

99

Parameters

KeyCode
Shift
KeyAscii
KeyCode
Shift
Button

Comments

Control

Event

MouseMove

MouseUp

lstCombo

Validate
Click
KeyDown
KeyPress
KeyUp

mListBox

Validate
Click
KeyDown
KeyPress
KeyUp

mTextBox

UniComboBox

Validate
Change
Click
DblClick
KeyPress
Validate
Change
Click
DblClick
DropDown
GotFocus
KeyDown
KeyPress
KeyUp

UniListBox

LostFocus
Validate
Click
DblClick
GotFocus
KeyDown
KeyPress
KeyUp
LostFocus
MouseDown

MouseMove

100

Parameters
Shift
X
Y
Button
Shift
X
Y
Button
Shift
X
Y
Cancel
KeyCode
Shift
KeyAscii
KeyCode
Shift
Cancel
KeyCode
Shift
KeyAscii
KeyCode
Shift
Cancel

KeyAscii
Cancel

KeyCode
Shift
KeyAscii
KeyCode
Validate
Cancel

KeyCode
Shift
KeyAscii
KeyCode
Shift
Button
Shift
X
Y
Button

Comments

CCLAS 1.4

Control

Event

MouseUp

Validate
Change
Click
DblClick
GotFocus
KeyDown

UniTextBox

KeyPress
KeyUp
LostFocus
MouseDown

MouseMove

MouseUp

Validate

Parameters
Shift
X
Y
Button
Shift
X
Y
Cancel

Comments

KeyCode
Shift
KeyAscii
KeyCode
Shift
Button
Shift
X
Y
Button
Shift
X
Y
Button
Shift
X
Y
Cancel

Standalone scripts
These scripts must be fully specified because no objects have been exposed and made available for use. All
referenced objects must be created within the script. These scripts may be run:
o

via the Task Scheduler, or

interactively via the Job module, or

interactively via the Sample Type module, or

interactively by running C:\WINNT\System32\WScript.exe "%1" %* where %1 is the name of the


VBScript and %* are any required parameters, either as a command line script or via the CCLAS EL
Menu as a menu item.

Integrated scripts
These scripts are triggered at various points within the CCLAS EL modules.

Setup scripts
Staff scripts

101

Client scripts
Method scripts
Library management scripts

Processing scripts
Job scripts
Sample scripts
Batch scripts
Online scripts
MDE scripts
Report scripts
Production Report scripts
Invoice scripts
Taskman scripts

Management scripts
Audit scripts
Job Audit scripts
Status scripts
Sample Track scripts
QC scripts
SPC scripts
Lab Maintenance scripts
Revenue scripts
Consumables scripts
Dashboard scripts

102

CCLAS 1.4

Customizing the Logon Screen


Sub MineMarket ()
Dim oCCLAS
'
Set oCCLAS = CreateObject("CCLAS.clsCCLAS")
'To run the CCLAS menu program non-interactively, set ShowState False
oCCLAS.ShowState = False
'Set the picture/caption
oCCLAS.Logon.LoginCaption = "MineMarket"
oCCLAS.Logon.LoginBMPFile = "I:\CCLS\PICTURE\CARYFOTO.BMP"
'Login without supplying username/password, ie prompt
oCCLAS.Init "", "", True
If HandleError() Then
Set oCCLAS = Nothing
Exit Sub
End If
If oCCLAS.Initialised Then
'Show the Screen with a Force Load Menu
oCCLAS.MenuFile = "I:\CCLS\LOGIN\DATALOG.MNU"
oCCLAS.Show
End If
Set oCCLAS = Nothing
End Sub

User Screens
Most of the directories may use User Screens. These SCR files are automatically added to the Config
Directory during installation, and each of them belongs to a specific Module, for a specific purpose. If you
expect a user screen to appear during an action, and it does not appear, it is missing! Keep in mind that
version 1.2 have some of these user screens, version 1.4 have all these user screens.
Now, do not confuse User Screens with Custom Screens. Custom Screens are those that we script
ourselves, those which are not added to the CCLAS directories during installations!

Module

File

Staff

GroupingUser.SCR
Staff Staff Groups User Screen
Grouping.UserField1 to 5

103

Where is it used?

Module

File

Setup

GroupSectionUser.SCR

Where is it used?

Setup Section Groups User


Screen
GroupSection.UserField1 to 5

InstrumentUser.SCR
Setup Instrument Codes User
Screen
Instrument.UserField1 to 20

LabUDF.VBS
Setup Lab Code
LabUser.SCR
Setup Lab Code User Screen
Lab.UserField1 to 20

104

Fires when you create a new Laboratory Code

CCLAS 1.4

Module

File
LOBUser.SCR
Setup Line of Business User
Screen
Lob.UserField1 to 5

SectionUser.SCR
Sectup Lab Sections User
Screen
Section.UserField1 to 20

StatusCodesUser.SCR
Setup Status Codes User
Screen
StatusCodes.UserField1 to 5

105

Where is it used?

Module

File
UnitUser.SCR
Setup Unit Codes User Screen
Unit.UserField1 to 20

CannedCommentsUser.SCR
Setup Canned Comments User
Screen
CannedComments.UserField1 to 5

Client

ClientContactUser.SCR
Client Contact User Screen
Client_Contact.UserField1 to 20

ClientCostUserQuery.SCR
Client bottom of Screen

106

Where is it used?

CCLAS 1.4

Module

File
ClientGroupUserQuery.SCR
Client Client Groups User
Screen
GroupClient.UserField1 to 5

ClientProjectUser.SCR
Client Project User Screen
Client_Project.UserField1 to 20

ClientQuoteUser.SCR
Client Quote User Screen
Client_Quote.UserField1 to 5

ClientUser.SCR
Client User Screen
Client.UserField1 to 20

107

Where is it used?

Module

File
ClientUserQuery.SCR
Client Bottom of screen

CostCentreUser.SCR
Client Cost Centre User Screen

GroupClientUser.SCR
Client Client Groups User
Screen
GroupClient.UserField1 to 5

Method

ProcRegAnalyteAddNew.SCR
(Only if the Scheme setting
CombinedSchemeAnalyteSelection is
enabled)

108

Where is it used?

CCLAS 1.4

Module

File

Where is it used?

ProcRegSchemeAddNew.SCR

ProcRegSchemeAnalyteUser.SCR

ProcRegSchemeUser.SCR
ProcReg_Scheme.UserFiel1 to 20

ProcRegUDF.VBS

Fires after when the user saves the schemes in the


combined scheme analyte tree.

109

Module

File
ProcRegUser.SCR
ProcReg.UserField1 to 20

ProcRegUserQuery.SCR

ProductAnalyteUser.SCR
Product_Analyte.UserField1 to 5

ProductUser.SCR
Product.UserField1 to 20

110

Where is it used?

CCLAS 1.4

Module

File
ProductUserQuery.SCR

QControlUser.SCR
QControl.UserField1 to 20

QCUserQuery.SCR

SchemeAnalyteUser.SCR
Scheme_Analyte.UserField1 to 20

111

Where is it used?

Module

File
SchemeUser.SCR
Scheme.UserField1 to 20

SchemeUserQuery.SCR

Job

PJCU.SCR
(Will only be available if the Profile
setting UserIdentsTab has been
defined)

ProfileUserQuery.SCR

112

Where is it used?

CCLAS 1.4

Module

File
ProfJobAddNew.SCR

ProfJobAnalyteAddNew.SCR
(Only if the Profile setting
CombinedSchemeAnalyteSelection is
enabled)

ProfJobCuidUser.SCR

ProfJobProcedureAddNew.SCR

113

Where is it used?

Module

File
ProfJobSchemeAddNew.SCR

ProfJobSchemeAnalyteUser.SCR
ProfJob_Scheme_Analyte .UserField1
to 20

ProfJobSchemeUser.SCR
ProfJob_Scheme.UserField1 to 20

ProfJobUser.SCR

114

Where is it used?

CCLAS 1.4

Module

File

Where is it used?

ProfJobUserIdents.SCR
(The Profile setting UserIdentsTab
defines which SCR file will be visible.)

ProSchemeAnalyteUDF.VBS

VB Script for when adding a Scheme Analyte to a Job,


called just before save.

ProSchemeUDF.VBS

VB Script for when adding a Scheme to a Job, called just


before save so can modify object.

ProUDF.VBS

VB Script which may be called during any stage of Job /


Sample registration.

DBCUDF.VBS

VB Script called before and after the process of database


creation.

Batch

BatchUDF.VBS

MDE

MDEUserQuery.SCR

MDESampleUserQuery.SCR

115

VB Script called before and after creation of a Lab Batch.

Module

File

Report

RepUserQuery.SCR

RepUDF.VBS

Where is it used?

VB Script which runs before and after creation of an


analytical report.

Invoice

InvoiceUserQuery.SCR

InvoiceUser.SCR
InvUDF.VBS
Job Audit

VB Script called before and after Invoice creation.

AuditJobUserQuery.SCR

Status Report StatUDF.VBS

VB Script called before and after creation of Status


Reports.

QC

PRFUDF.VBS

VB Script for Default User Defined PrfUDF, used by


Perfana.

116

CCLAS 1.4

Module

File

Sample Track STActionUser.SCR

STContainerUser.SCR

STJobSampleUser.SCR
STJob_Sample.UserFiel1 to 4

STJobUser.SCR
STJob.UserField1 to 4

117

Where is it used?

Module

File

Where is it used?

STLocationUser.SCR

STPhysicalTypeUser.SCR
STPhysicalType.UserField1 to 4

Lab

LabMaintScheduleUser.SCR

Maintenance

LabMaint_Schedule.UserField1 to 9

LabMaintUDF.VBS

VB Script for Default User Defined LabmaintUDF, used by


LabMaintenance

LabMaintUser.SCR
LabMain.UserField1 to 5

118

CCLAS 1.4

Module

File

Where is it used?

Consumables CMConsumeTypeUser.SCR
CMConsume_Type.UserField1 to 5

CMConsumeUser.SCR
CMConsume.UserField1 to 5

CMSupplierUser.SCR
CMSupplier.UserField1 to 5

Sample Track SamTrackUserQuery.SCR


SamTrackAddUserQuery.SCR

<module>UserQuery.SCR
Scheme codes, product codes, procedures and QC codes in the Method module, client groups, client codes
and cost centres in the Client module, jobs in the Job module, jobs in the Data Entry module, jobs in the
Report module, jobs in the Production Report module, jobs in the Invoice module, jobs in the Job Audit

119

module, samples in the Sample Track module, and library management schemes and procedures in the
Library Management module all support the user of UserQuery.SCR files to provide a customised for used to
return a filtered list of items.
If the module node initialization setting LoadBrowser is disabled, the module node displays the screen file
ModuleNodeUserQuery.SCR to return a filtered list of items, making the Properties menu option
automatically disabled since filtering is now under control of the user query script file.
Each of these module nodes has a QueryEvent program initialization setting that defines the name of the
user query control and the event that is looked for to initiate the database query to return the lists of items for
that node, e.g., cmdQuery_Click.
Each UserQuery.SCR file must have a command button with the exact same name as the user query control
name.
'COMMANDBUTTON,cmdQuery,,Query,Query data using entered criteria,105,255,600,600,%pictureDirectory
%\Find.ICO,,,,,,

Each UserQuery.SCR file must have an event method with the exact same name as the user query control
event.
'----------------------------------------------------------------------------------' Click selected
'----------------------------------------------------------------------------------Sub cmdQuery_Click()
End Sub

Each UserQuery.SCR file must have a function method to build up the SQL Where clause used to filter the
list of items to be returned.
'----------------------------------------------------------------------------------' Build where clause for query
'----------------------------------------------------------------------------------Function SQLWhere()
Dim sFieldWhere
SQLWhere = ""
End Function

Each UserQuery.SCR file may have an optional function method to build up the SQL Order clause used to
order the list of items to be returned.
'----------------------------------------------------------------------------------' Build Order by clause for query
'----------------------------------------------------------------------------------Function SQLOrder()
Dim sFieldOrder
SQLOrder = ""
End Function

As an example, the Client module is the first module where we will be looking at one of the User Query
screens. The ClientUserQuery.SCR is located in the Config directory, and is copied to the Server during
installation.
The Client Module may be viewed in a few different ways:
If the ClientApp settings LoadBrowser (in the Staff Module) is set to disabled, the screen would look like this:

120

CCLAS 1.4

But if the LoadBrowser setting is set to enabled, the Client Module will look like this:

The screen at the top shows the ClientUserQuery.SCR at the bottom of the Client list.
The appearance of most of the Modules can be controlled in this way. The SCR file corresponding to each
Module, may be changed to suit the needs of the laboratory, through VB Script.

121

A list of the User Query screens that work in the same fashion, are the following:
Module

Screen name

Setting in Staff Module

Client

ClientUserQuery.SCR

ClientApp LoadBrowser=disabled

ClientCostUserQuery.SCR
ClientGroupUserQuery.SCR
Method

ProcRegUserQuery.SCR

ProcReg LoadBrowser = disabled

ProductUserQuery.SCR

Product LoadBrowser = disabled

QCUserQuery.SCR
Profile (Job) ProfileUserQuery.SCR

Profile LoadBrowser = disabled

MDE

MDEUserQuery.SCR

MDE LoadBrowser = disabled

Report

RepUserQuery.SCR

Report LoadBrowser = disabled

Invoice

InvoiceUserQuery.SCR

Invoice LoadBrowser = disabled

Job Audit

JobAuditUserQuery.SCR

AuditJob LoadBrowser = disabled

Sample

SamTrackUserQuery.SCR

Track
SamTrackAddUserQuery.SCR
Sub Form_Load()
.
.
End Sub
'---------------Sub cmdQuery_Click()
.
.
End Sub
'---------------Function SQLWhere()
.
.
End Function
'---------------Function SQLOrder()
.
.
End Function
'---------------Function FieldWhereString(ByVal sField, yVal sValue)
.
.
End Function
'----------------

122

CCLAS 1.4

Function FieldWhereNumber(ByVal sField,ByVal sValue,ByVal sComparison)


.
.
End Function
'---------------Function FieldWhereDate(ByVal sField,ByVal dtStartDate,ByVal dtEndDate,ByVal
sComparison)
.
.
End Function
Note in the portions of code above, the Script works like a normal VB Script. But specifically look at the
Functions as an example, the SQLWhere function would be the string that would replace the WHERE
clause in a SQL query, e.g.:
SELECT

Cli_Code

FROM

Client

WHERE

Cli_Code LIKE B%

The <module>UserQuery.SCR files work like filters, and if it exists in your setup, but is not used, all criteria
are satisfied and you will see a complete list of whatever the Module represents.
Let us have a look at each of the <module>UserQuery.SCR files:

ClientUserQuery.SCR
If the ClientApp initialization setting LoadBrowser is disabled and the file ClientUserQuery.scr exists, the form
on this screen is used to fill out conditions on which to return client codes to populate the browser list.
Otherwise, the regular client browser is used.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Sub SQLWhere()
Sub SQLOrder()
Objects exposed from Client.exe for use in this script:
Form
clsArray
clsSecurity
clsBDClient

123

ClientCostUserQuery.SCR
If the ClientApp initialization setting LoadBrowser is disabled and the file ClientCostUserQuery.scr exists, the
form on this screen is used to fill out conditions on which to return client cost codes to populate the browser
list. Otherwise, the regular cost code browser is used.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Sub SQLWhere()
Sub SQLOrder()
Objects exposed from Client.exe for use in this script:
Form
clsArray
clsSecurity
clsBDCostcentre

ClientGroupUserQuery.SCR
If the ClientApp initialization setting LoadBrowser is disabled and the file ClientGroupUserQuery.scr exists,
the form on this screen is used to fill out conditions on which to return client group codes to populate the
browser list. Otherwise, the regular client group browser is used.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Sub SQLWhere()
Sub SQLOrder()
Objects exposed from Client.exe for use in this script:
Form
clsArray
clsSecurity
clsBDClient

ProcRegUserQuery.SCR
If the SchemeApp initialization setting LoadBrowser is disabled and the file ProcregUserQuery.scr exists, the
form on this screen is used to fill out conditions on which to return procedure codes to populate the browser
list. Otherwise, the regular procedure browser is used.
Subroutines run from this script:

124

CCLAS 1.4

Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Sub SQLWhere()
Sub SQLOrder()
Objects exposed from Scheme.exe for use in this script:
Form
clsArray
clsSecurity
clsBDProcreg
PVExplorer

ProductUserQuery.SCR
If the SchemeApp initialization setting LoadBrowser is disabled and the file ProductUserQuery.scr exists, the
form on this screen is used to fill out conditions on which to return product codes to populate the browser list.
Otherwise, the regular product browser is used.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Sub SQLWhere()
Sub SQLOrder()
Objects exposed from Scheme.exe for use in this script:
Form
clsArray
clsSecurity
clsBDProduct

125

QCUserQuery.SCR
If the SchemeApp initialization setting LoadBrowser is disabled and the file QCUserQuery.scr exists, the
form on this screen is used to fill out conditions on which to return quality control codes to populate the
browser list. Otherwise, the regular quality control browser is used.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Sub SQLWhere()
Sub SQLOrder()
Objects exposed from Scheme.exe for use in this script:
Form
clsArray
clsSecurity
clsBDQControl

ProfileUserQuery.SCR
If the Profile initialization setting LoadBrowser is disabled and the file ProfileUserQuery.scr exists, the form
on this screen is used to fill out conditions on which to return job numbers to populate the browser list.
Otherwise, the regular job browser is used.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Sub SQLWhere()
Sub SQLOrder()
Objects exposed from Profile.exe for use in this script:
Form
clsArray
clsSecurity
clsBDClient
clsBDProfjob
PVExplorer

126

CCLAS 1.4

SchemeUserQuery.SCR
If the SchemeApp initialization setting LoadBrowser is disabled and the file SchemeUserQuery.scr exists, the
form on this screen is used to fill out conditions on which to return scheme codes to populate the browser
list. Otherwise, the regular scheme browser is used.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Sub SQLWhere()
Sub SQLOrder()
Objects exposed from Scheme.exe for use in this script:
Form
clsArray
clsSecurity
clsBDScheme

MDEUserQuery.SCR
If the MDE initialization setting LoadBrowser is disabled and the file MDEUserQuery.scr exists, the form on
this screen is used to fill out conditions on which to return job numbers to populate the browser list.
Otherwise, the regular job browser is used.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Sub SQLWhere()
Sub SQLOrder()
Objects exposed from MDE.exe for use in this script:
Form
clsArray
clsSecurity
clsBDClient
clsBDProfjob
PVExplorer

127

MDESampleUserQuery.SCR
If the MDE initialization setting LoadBrowser is disabled and the file MDESampleUserQuery.scr exists, the
form on this screen is used to fill out conditions on which to return samples to populate the browser list.
Otherwise, the regular job browser is used.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Sub SQLWhere()
Sub SQLOrder()
Objects exposed from xMDE.exe for use in this script:
Form
clsArray
clsSecurity
clsBDClient
clsBDProfjob
PVExplorer

RepUserQuery.SCR
If the Report initialization setting LoadBrowser is disabled and the file RepUserQuery.scr exists, the form on
this screen is used to fill out conditions on which to return job numbers to populate the browser list.
Otherwise, the regular job browser is used.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Sub SQLWhere()
Sub SQLOrder()
Objects exposed from Report.exe for use in this script:
Form
clsArray
clsSecurity
clsBDClient
clsBDProfjob
PVExplorer

128

CCLAS 1.4

InvoiceUserQuery.SCR
If the Invoice initialization setting LoadBrowser is disabled and the file InvoiceUserQuery.scr exists, the form
on this screen is used to fill out conditions on which to return job numbers to populate the browser list.
Otherwise, the regular job browser is used.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Sub SQLWhere()
Sub SQLOrder()
Objects exposed from Invoice.exe for use in this script:
Form
clsArray
clsSecurity
clsBDClient
clsBDProfjob
PVExplorer

AuditJobUserQuery.scr
If the AuditJob initialization setting LoadBrowser is disabled and the file AuditJobUserQuery.scr exists, the
form on this screen is used to fill out conditions on which to return job numbers to populate the browser list.
Otherwise, the regular job browser is used.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Sub SQLWhere()
Sub SQLOrder()
Objects exposed from AuditJob.exe for use in this script:
Form
clsArray
clsSecurity
clsBDClient
clsBDProfjob
PVExplorer

129

SamTrackUserQuery.SCR
If the SampleTrack initialization setting LoadBrowser is disabled and the file SamTrackUserQuery.scr exists,
the form on this screen is used to fill out conditions on which to return job numbers which are being tracked
to populate the browser list. Otherwise, the regular job browser is used.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Sub SQLWhere()
Sub SQLOrder()
Objects exposed from SampleTrack.exe for use in this script:
Form
clsArray
clsSecurity
clsBDClient
clsBDProfjob

SamTrackAddUserQuery.scr
When the New menu option is selected, if the file SamTrackAddUserQuery.scr exists, the form on this screen
is used to fill out conditions on which to return job numbers to start tracking on to populate the browser list.
Otherwise, the regular job browser is used.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Sub SQLWhere()
Sub SQLOrder()
Objects exposed from SampleTrack.exe for use in this script:
Form
clsArray
clsSecurity
clsBDClient
clsBDProfjob

130

CCLAS 1.4

<module>User.SCR
These SCR files, or screens, exist in various modules to populate the <tablename>.UserFieldn in most of the
CCLAS tables. Should the user wich to add additional information, these are being used.
We will look at the following SCR files:
Module

Screen name

Description

Staff

GroupingUser.SCR

Adds additional information to the Grouping_Staff


table

Setup

GroupSectionUser.SCR

Adds additional information to the GroupSection table

Setup

InstrumentUser.SCR

Adds additional information to the Instrument table

Setup

LabUser.SCR

Adds additional information to the Lab table

Setup

LobUser.SCR

Adds additional information to the Lob table

Setup

SectionUser.SCR

Adds additional information to the Section table

Setup

StatusCodesUser.SCR

Adds additional information to the StatusCodes table

Setup

UnitUser.SCR

Adds additional information to the Unit table

Setup

CannedCommentsUser.SCR

Adds additional information to the CannedComments


table

Client

ClientContactUser.SCR

Adds additional information to the Client_Contact


table

Client

ClientProjectUser.SCR

Adds additional information to the Client_Project


table

Client

ClientQuoteUser.SCR

Adds additional information to the Client_Quote table

Client

ClientUser.SCR

Adds additional information to the Client table

Client

CostCentreUser.SCR

Client

GroupClientUser.SCR

Adds additional information to the GroupClient table

Method

ProcRegSchemeAnalyteUser.SCR

Adds additional information to the


ProcReg_Scheme_Analyte table

Method

ProcRegSchemeUser.SCR

Adds additional information to the ProcReg_Scheme


table

Method

ProcRegUser.SCR

Adds additional information to the ProcReg table

Method

ProductAnalyteUser.SCR

Adds additional information to the Product_Analyte


table

Method

ProductUser.SCR

Adds additional information to the Product table

Method

QControlUser.SCR

Adds additional information to the QControl table

131

Module

Screen name

Description

Method

SchemeAnalyteUser.SCR

Adds additional information to the Scheme_Analyte


table

Method

SchemeUser.SCR

Adds additional information to the Scheme table

Profile

ProfJobSchemeAnalyteUser.SCR

Adds additional information to the


ProfJob_Scheme_Analyte table

Profile

ProfJobSchemeUser.SCR

Adds additional information to the ProfJob_Scheme


table

Sample Track STActionUser.SCR

Adds additional information to the STAction table

Sample Track STContainerUser.SCR

Adds additional information to the STContainer table

Sample Track STJobSampleUser.SCR

Adds additional information to the STJob_Sample


table

Sample Track STJobUser.SCR

Adds additional information to the STJob table

Sample Track STLocationUser.SCR

Adds additional information to the STLocation table

Sample Track STPhysicalTypeUser.SCR

Adds additional information to the STPhysicalType


table

Lab

LabMaintScheduleUser.SCR

Maintenance
Lab

Adds additional information to the LabMain_Schedule


table

LabMaintUser.SCR

Adds additional information to the LabMaint table

Maintenance
Consumables CMConsumeTypeUser.SCR

Adds additional information to the CMConsume_Type


table

Consumables CMConsumeUser.SCR

Adds additional information to the CMConsume table

Consumables CMSupplierUser.SCR

Adds additional information to the CMSupplier table

GroupingUser.SCR
This is the Staff group user fields screen script. Pressing the User screen button on the Staff group form
runs the GroupingUser.SCR script file. This allows for the editing of Grouping table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Config.exe for use in this script:
clsArray
clsSecurity

132

CCLAS 1.4

clsBDGrouping

GroupSectionUser.SCR
This is used to add additional information to the Section Groups in the Setup module. Pressing the User
screen button on the Section group form runs the GroupSectionUser.SCR script file. This allows for the
editing of GroupSection table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()

133

Objects exposed from Config.exe for use in this script:


Form
clsArray
clsSecurity
clsBDGroupSection

InstrumentUser.SCR
This file is used to add additional information to Instruments in the Setup module. Pressing the User screen
button on the Instrument form runs the InstrumentUser.SCR script file. This allows for the editing of
Instrument table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Config.exe for use in this script:
Form
clsArray
clsSecurity
clsBDInstrument

LabUser.SCR
Used in the Setup Module to add additional information to Lab. Pressing the User screen button on the Lab
form runs the LabUser.SCR script file. This allows for the editing of Lab table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Config.exe for use in this script:
Form
clsArray
clsSecurity
clsBDLab

LobUser.SCR
Used to add extra information to the Lob table. Pressing the User screen button on the LOB form runs the
LOBUser.SCR script file. This allows for the editing of LOB table user fields.

134

CCLAS 1.4

Subroutines run from this script:


Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Config.exe for use in this script:
Form
clsArray
clsSecurity
clsBDLOB

SectionUser.SCR
Pressing the User screen button on the Section form runs the SectionUser.SCR script file. This allows for the
editing of Section table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Config.exe for use in this script:
Form
clsArray
clsSecurity
clsBDSection

StatusCodesUser.SCR
Pressing the User screen button on the Status codes form runs the StatuscodesUser.SCR script file. This
allows for the editing of Statuscodes table user fields.
Subroutines run from this script:
Sub Form_Load()
Form_Unload()
Form_Save()
Form_Resize()
Objects exposed from Config.exe for use in this script:
Form
clsArray
clsSecurity
clsBDStatuscodes

135

UnitUser.SCR
Pressing the User screen button on the Units codes form runs the UnitUser.SCR script file. This allows for
the editing of Unit table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Config.exe for use in this script:
Form
clsArray
clsSecurity
clsBDUnit

CannedCommentsUser.SCR
Pressing the User screen button on the Canned comment codes form runs the CannedcommentsUser.SCR
script file. This allows for the editing of Statuscodes table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Config.exe for use in this script:
Form
clsArray
clsSecurity
clsBDCannedcomments

ClientContactUser.SCR
Pressing the User screen button on the Client contact form runs the ClientContactUser.SCR script file. This
allows for the editing of Client_Contact table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()

136

CCLAS 1.4

Objects exposed from Client.exe for use in this script:


Form
clsArray
clsSecurity
clsBDClient

ClientProjectUser.SCR
Pressing the User screen button on the Client project form runs the ClientProjectUser.SCR script file. This
allows for the editing of Client_Project table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Client.exe for use in this script:
Form
clsArray
clsSecurity
clsBDClient

ClientQuoteUser.SCR
Pressing the User screen button on the Client quote form runs the ClientQuoteUser.SCR script file. This
allows for the editing of Client_Quote table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Client.exe for use in this script:
Form
clsArray
clsSecurity
clsBDClient

ClientUser.SCR
Pressing the User screen button on the Client form runs the ClientUser.SCR script file. This allows for the
editing of Client table user fields.

137

Subroutines run from this script:


Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Client.exe for use in this script:
Form
clsArray
clsSecurity
clsBDClient

CostCentreUser.SCR
Pressing the User screen button on the Client cost centre form runs the CostcentreUser.SCR script file. This
allows for the editing of CostCentre table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Client.exe for use in this script:
Form
clsArray
clsSecurity
clsBDCostCentre

GroupClientUser.SCR
Pressing the User screen button on the Client group form runs the GroupClientUser.SCR script file. This
allows for the editing of GroupClient table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Client.exe for use in this script:
Form
clsArray
clsSecurity
clsBDClient

138

CCLAS 1.4

ProcRegSchemeAnalyteUser.SCR
Pressing the User screen button on the Procedure scheme analyte form runs the
ProcregSchemeAnalyteUser.SCR script file. This allows for the editing of Procreg_Scheme_Analyte table
user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Scheme.exe for use in this script:
Form
clsArray
clsSecurity
clsBDProcreg

ProcRegSchemeUser.SCR
Pressing the User screen button on the Procedure scheme form runs the ProcregSchemeUser.SCR script
file. This allows for the editing of Procreg_Scheme table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Scheme.exe for use in this script:
Form
clsArray
clsSecurity
clsBDProcreg

ProcRegUser.SCR
Pressing the User screen button on the Procedure form runs the ProcregUser.SCR script file. This allows for
the editing of Procreg table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()

139

Objects exposed from Scheme.exe for use in this script:


Form
clsArray
clsSecurity
clsBDProcreg

ProductAnalyteUser.SCR
Pressing the User screen button on the Product analyte form runs the ProductAnalyteUser.SCR script file.
This allows for the editing of Product_Analyte table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Scheme.exe for use in this script:
Form
clsArray
clsSecurity
clsBDProductAnalyte

ProductUser.SCR
Pressing the User screen button on the Product form runs the ProductUser.SCR script file. This allows for
the editing of Product table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Scheme.exe for use in this script:
Form
clsArray
clsSecurity
clsBDProduct

QControlUser.SCR
Pressing the User screen button on the QC form runs the QControlUser.SCR script file. This allows for the
editing of QControl table user fields.

140

CCLAS 1.4

Subroutines run from this script:


Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Scheme.exe for use in this script:
Form
clsArray
clsSecurity
clsBDQControl

SchemeAnalyteUser.SCR
Pressing the User screen button on the Scheme analyte form runs the SchemeAnalyteUser.SCR script file.
This allows for the editing of Scheme_Analyte table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Scheme.exe for use in this script:
Form
clsArray
clsSecurity
clsBDScheme

SchemeUser.SCR
Pressing the User screen button on the Scheme form runs the SchemeUser.SCR script file. This allows for
the editing of Scheme table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Scheme.exe for use in this script:
Form
clsArray
clsSecurity
clsBDScheme

141

ProfJobCuidUser.SCR
Double-clicking a sample on the Grid/sample info tab form runs the ProfjobCuidUser.SCR script file. This
allows for the editing of Profjob_Cuid table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Profile.exe for use in this script:
Form
clsArray
clsSecurity
clsCurrent
clsBDScheme
clsBDClient
clsBDProfjob

ProfJobSchemeAnalyteUser.SCR
Pressing the User screen button on the Job scheme analyte form runs the ProfjobSchemeAnalyteUser.SCR
script file. This allows for the editing of Profjob_Scheme_Analyte table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Profile.exe for use in this script:
Form
clsArray
clsSecurity
clsBDProfjob

ProfJobSchemeUser.SCR
Pressing the User screen button on the Job scheme form runs the ProfjobSchemeUser.SCR script file. This
allows for the editing of Profjob_Scheme table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()

142

CCLAS 1.4

Objects exposed from Profile.exe for use in this script:


Form
clsArray
clsSecurity
clsBDProfjob

ProfJobUser.SCR
Pressing the User screen button on the Job form runs the ProfjobUser.SCR script file. This allows for the
editing of Profjob table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Profile.exe for use in this script:
Form
clsArray
clsSecurity
clsCurrent
clsBDScheme
clsBDClient
clsBDProfjob

STJobUser.SCR
Pressing the User screen button on the sample track job form will run the STJobUser.SCR script file. This is
used to allow for the editing of sample track job details user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from SampleTrack.exe for use in this script:
Form
clsArray
clsSecurity
clsCurrent
clsBDStjob

143

STJobSampleUser.SCR
Pressing the User screen button on the sample track job sample form will run the STJobSampleUser.SCR
script file. This is used to allow for the editing of sample track job sample details user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from SampleTrack.exe for use in this script:
Form
clsArray
clsSecurity
clsCurrent
clsBDStjobsample

STPhysicalTypeUser.SCR
Pressing the User screen button on the sample track physical type form will run the
STPhysicalTypeUser.SCR script file. This is used to allow for the editing of sample track physical type details
user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from SampleTrack.exe for use in this script:
Form
clsArray
clsSecurity
clsCurrent
clsBDStphysicaltype

InvoiceUser.SCR
If the file InvoiceUser.SCR script file exists, clicking on the Userfields tab runs this file. This allows for the
editing of InvoiceUser table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()

144

CCLAS 1.4

Objects exposed from Invoice.exe for use in this script:


Form
clsArray
clsSecurity
clsBDScheme
clsBDClient
clsBDProfjob
clsCurrentInvoice
clsBDInvoice
clsBDPrice

LabMaintScheduleUser.SCR
Pressing the User screen button on the lab maintenance schedule form will run the
LabmaintScheduleUser.SCR script file. This is used to allow for the editing of lab maintenance schedule user
fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from LabMaintenance.exe for use in this script:
Form
clsArray
clsSecurity
clsLabMaintenance
clsBDLabmaint
clsBDLabmaintaudit
clsBDInstrument
fso
ts

LabMaintUser.SCR
Pressing the User screen button on the lab maintenance form will run the LabmaintUser.SCR script file. This
is used to allow for the editing of lab maintenance task user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()

145

Objects exposed from LabMaintenance.exe for use in this script:


Form
clsArray
clsSecurity
clsLabMaintenance
clsBDLabmaint
clsBDLabmaintaudit
clsBDInstrument
fso
ts

CMConsumeUser.SCR
Pressing the User screen button on the consumable form will run the CMConsumeUser.SCR script file. This
is used to allow for the editing of consumable user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Consumables.exe for use in this script:
Form
clsArray
clsSecurity
clsBDCmconsume
clsBDCmConsumeType
clsBDCmSupplier
fso
ts

CMConsumeTypeUser.SCR
Pressing the User screen button on the consumable type form will run the CMConsumeTypeUser.SCR script
file. This is used to allow for the editing of consumable type user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Consumables.exe for use in this script:
Form
clsArray

146

CCLAS 1.4

clsSecurity
clsBDCmconsume
clsBDCmConsumeType
clsBDCmSupplier
fso
ts

CMConsumeSupplier.SCR
Pressing the User screen button on the consumable supplier form will run the
CMConsumeSupplierUser.SCR script file. This is used to allow for the editing of consumable supplier user
fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Consumables.exe for use in this script:
Form
clsArray
clsSecurity
clsBDCmconsume
clsBDCmConsumeType
clsBDCmSupplier
fso
ts

*UDF.VBS
The VBS scripts that end in *UDF.VBS, are VB Scripts that one may customize to control the behaviour of
Modules through scripting. These scripts are very versatile, and we will be looking deeper into these scripts
than we did for the <module>UserQuery.SCR scripts.
During installation of CCLAS, the following *UDF.VBS scripts are automatically copied to the Config
directory:

Module

Screen name

Description

Setup

LabUDF.VBS

Controls what happens when we add a new Laboratory


Code in the Setup Module.

Method

ProcRegUDF.VBS

Controls what happens when we create a new Procedure in


the Method module.

147

Module

Screen name

Description

Profile

ProSchemeAnalyteUDF.VBS

When adding a Scheme and Analyte to a Job, called just


before save.

Profile

ProSchemeUDF.VBS

When adding a Scheme to a Job, called just before save.

Profile

ProUDF.VBS

A VB Script which may be called during any stage of Job /


Sample registration.

DbcUDF.VBS

VB Script that runs when concentration records in the Job


module is created.

Batch

BatchUDF.VBS

Called before and after creating a Lab Batch.

Report

RepUDF.VBS

Runs before and after creation of an Analytical Report

PRepUDF.VBS

Runs before and after creation of an Analytical Report

Invoice

InvUDF.VBS

Runs before and after creation of an Invoice

Status

StatUDF.VBS

Runs before and after creation of Status Reports

QC

PrfUDF.VBS

Handles user defined QC report creation

Lab Maint

LabMaintUDF.VBS

Handles user defined Laboratory Maintenance tasks

LabUDF.VBS
After a new lab code is added, if the file LabUDF.vbs exists, the AfterAddLab subroutine in it is run.

After add lab scripts


After a new lab code is added, if the file LabUDF.vbs exists, the AfterAddLab subroutine in it is run.
Subroutines run from this script:
Sub AfterAddLab()
Objects exposed from Config.exe for use in this script:
clsArray
clsSecurity

After delete lab scripts


After a lab code is deleted, if the file LabUDF.vbs exists, the AfterDeleteLab subroutine in it is run.
Subroutines run from this script:
Sub AfterDeleteLab()

148

CCLAS 1.4

Objects exposed from Config.exe for use in this script:


clsArray
clsSecurity
The LabUDF.VBS looks like this after CCLAS installation:
Sub AfterAddLab(ByVal sLabCode)
'
End Sub
'
Sub AfterDeleteLab(ByVal sLabCode)
BackupLabCode sLabCode
DeleteLabCode sLabCode
End Sub
'
Sub BackupLabCode(ByVal sLabCode)
.(code is
.written here)
End Sub
'
Sub DeleteLabCode(ByVal sLabCode)
.(code is
.written here)
End Sub

The LabUDF.VBS will fire after the user adds or deletes a new Lab Code. In the example above, nothing
special happens after a new Lab Code has been created. The following sub is empty:
Sub AfterAddLab(ByVal sLabCode)
'
End Sub

But not that, when the user deletes a lab, two things happen:
Sub AfterDeleteLab(ByVal sLabCode)
BackupLabCode sLabCode
DeleteLabCode sLabCode
End Sub

A backup is made of the data that exist in the Lab you are deleting, and the Lab Code is deleted.

ProcRegUDF.VBS
The ProcRegUDF.VBS is fired after a Scheme has been added to a Procedure. This script will only fire if the
ProcReg setting CombinedSchemeAnalyteSelection is set to enabled. The installed code looks like this:
Option Explicit
'
Sub SchemeUpdated(sSchCode, lSchVersion, bAddScheme, bAddAnalyte, sTaskNumber)
'
514 => Refresh with save
'
600 => Save
'
900 => Scheme record updated (double-clicked on scheme)
'
901 => Analyte record updated (double-clicked on analyte)
End Sub

The objects that are exposed in this script, are the clsBDProcReg and clsSecurity classes. In Sub
SchemeUpdated() , not that there are comments relating to codes one may use for certain effects. The
sTaskNumber variable is a parameter which the script receives from the action the user performs that
means that the script will only fire under one of these four conditions.
Let us take an example:
Suppose we create a Procedure with specific Schemes in it. According to a Stream table (table containing
user specific data), there are at least four types of samples received at the laboratory which are being

149

analysed with exactly the same group of Methods. We can now use the ProcRegUDF.VBS script to
automatically create the other Procedures which correspond to those types of Samples, based on specific
rules.

ProSchemeAnalyteUDF.VBS
After adding a new analyte to a scheme in a lab batch job, if the file ProSchemeAnalyteUDF.VBS exists, the
ProSchemeAnalyteUDF1 subroutine in it is run.

After adding a new analyte to LB job scripts


Subroutines run from this script:
Sub ProSchemeAnalyteUDF1()
Objects exposed from Batch.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

After adding a new analyte scripts


After adding a new analyte to a scheme in a job (even via a procedure), if the file
ProSchemeAnalyteUDF.vbs exists, the ProSchemeAnalyteUDF1 subroutine in it is run.
Subroutines run from this script:
Sub ProSchemeAnalyteUDF1()
Objects exposed from ccProf01.dll for use in this script:
clsSecurity
clsBDProfjob
This script fires the moment one adds a new Scheme and an Analyte to a Job. It fires once for each Analyte
added.
Sub ProSchemeAnalyteUDF1()
.
.
End Sub

What can you do with a script like this? Suppose you have a separate list of Analytes and whether they are
report active for specific types of Jobs or not, regardless of how they are specified in the Method module, in
a TXT file. Using queries and more scripting inside this file, you look whether the type of Job satisfies the
reporting criteria. If not, you change the reportactive field in the ProfJob_Scheme_Analyte table according to
what is written in the TXT file!

ProSchemeUDF.VBS
After adding a new scheme to LB job scripts
After adding a new scheme to a lab batch job, if the file ProSchemeUDF.vbs exists, the ProSchemeUDF1
subroutine in it is run.

150

CCLAS 1.4

Subroutines run from this script:


Sub ProSchemeUDF1()
Objects exposed from Batch.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

After adding a new scheme scripts


After adding a new scheme to a job (even via a procedure), if the file ProSchemeUDF.vbs exists, the
ProSchemeUDF1 subroutine in it is run.
Subroutines run from this script:
Sub ProSchemeUDF1()
Objects exposed from ccProf01.dll for use in this script:
clsSecurity
clsBDProfjob
The ProSchemeUDF.VBS fires the moment a Scheme is added to a Job, even before any Analytes have
been added.
Sub ProSchemeUDF1()
.
.
End Sub

How can I use it? Maybe there is a specific order in which Schemes should appear in the Job use this to
change it automatically!

ProUDF.VBS
Before copying a job scripts
Before a job is copied, if the file ProUDF.vbs exists, the ProUDF20 or BeforeJobCopy subroutine in it is run
(whichever is listed first in the script file).
Subroutines run from this script:
Sub ProUDF20()
Sub BeforeJobCopy()
Objects exposed from Profile.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

After copying a job scripts


After a job is copied, if the file ProUDF.vbs exists, the ProUDF21 or AfterJobCopy subroutine in it is run
(whichever is listed first in the script file).
Subroutines run from this script:
Sub ProUDF21()
Sub AfterJobCopy()

151

Objects exposed from Profile.exe for use in this script:


clsArray
clsSecurity
clsBDProfjob

After selecting a job but before opening scripts


After a job is selected to be opened, but before the job is actually opened, if the file ProUDF.vbs exists, the
ProUDF3 or BeforeEditJob subroutine in it is run (whichever is listed first in the script file).
Subroutines run from this script:
Sub ProUDF3()
Sub BeforeEditJob()
Objects exposed from Profile.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

Before opening a job scripts


Before a job is opened, if the file ProUDF.vbs exists, the ProUDF14 or BeforeJobOpened subroutine in it is
run (whichever is listed first in the script file).
Subroutines run from this script:
Sub ProUDF14()
Sub BeforeJobOpened()
Objects exposed from Profile.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

After opening a job scripts


After a job is opened, if the file ProUDF.vbs exists, the ProUDF15 or AfterJobOpened subroutine in it is run
(whichever is listed first in the script file).
Subroutines run from this script:
Sub ProUDF15()
Sub AfterJobOpened()
Objects exposed from Profile.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

Before saving sample idents scripts


Before the sample idents file for a job is saved, if the file ProUDF.vbs exists, the ProUDF12 or
BeforeIdentsSave subroutine in it is run (whichever is listed first in the script file).
Subroutines run from this script:
Sub ProUDF12()
Sub BeforeIdentsSave()

152

CCLAS 1.4

Objects exposed from Profile.exe for use in this script:


clsArray
clsSecurity
clsBDProfjob

After saving sample idents scripts


After the sample idents file for a job is saved, if the file ProUDF.vbs exists, the ProUDF13 or AfterIdentsSave
subroutine in it is run (whichever is listed first in the script file).
Subroutines run from this script:
Sub ProUDF13()
Sub AfterIdentsSave()
Objects exposed from Profile.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

Before saving sample grid scripts


Before saving the samples on the Grid/sample info tab form, if the file ProUDF.vbs exists, the ProUDF10 or
BeforeSampleGridSave subroutine in it is run (whichever is listed first in the script file).
Subroutines run from this script:
Sub ProUDF10()
Sub BeforeSampleGridSave()
Objects exposed from Profile.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

After saving sample grid scripts


After saving the samples on the Grid/sample info tab form, if the file ProUDF.vbs exists, the ProUDF11 or
AfterSampleGridSave subroutine in it is run (whichever is listed first in the script file).
Subroutines run from this script:
Sub ProUDF11()
Sub AfterSampleGridSave()
Objects exposed from Profile.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

Determining whether a job can be created scripts


Before a job is created, if the file ProUDF.vbs exists, the ProUDF2 subroutine in it is run, to determine
whether a job can be created for the supplied client and project codes.
Subroutines run from this script:
Sub ProUDF2(sCliCode, sProjCode)

153

Objects exposed from Profile.exe for use in this script:


clsArray
clsSecurity
clsBDProfjob

Creating PJCSA records scripts


If user-defined create records is specified, if the file ProUDF.vbs exists, the ProUDF1 or CreateConcDB
subroutine in it is run (whichever is listed first in the script file) to manage the creation of sample scheme
analyte determination records for the job. Whether to update the job if it already exists and whether to
include quality control sample can be specified.
Subroutines run from this script:
Sub ProUDF1(bUpdate, bQC, sProJob)
Sub CreateConcDB(bUpdate, bQC, sProJob)
Objects exposed from Profile.exe for use in this script:
clsArray
clsBDScheme
clsBDClient
clsBDProfjob
clsProfRep
fso
ts

Before updating a scheme during PJCSA creation scripts


Before updating the sample scheme analyte determination records for a scheme, if the file ProUDF.vbs
exists, the ProUDF3 or BeforeSchemeUpdate subroutine in it is run (whichever is listed first in the script file).
Subroutines run from this script:
Sub ProUDF3()
Sub BeforeSchemeUpdate()
Objects exposed from Profile.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

After updating a scheme during PJCSA creation scripts


After updating the sample scheme analyte determination records for a scheme, if the file ProUDF.vbs exists,
the ProUDF4 or AfterSchemeUpdate subroutine in it is run (whichever is listed first in the script file).
Subroutines run from this script:
Sub ProUDF4()
Sub AfterSchemeUpdate()
Objects exposed from Profile.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

154

CCLAS 1.4

Before updating an analyte during PJCSA creation scripts


Before updating the sample scheme analyte determination records for an analyte, if the file ProUDF.vbs
exists, the ProUDF5 or BeforeAnalyteUpdate subroutine in it is run (whichever is listed first in the script file).
Subroutines run from this script:
Sub ProUDF5()
Sub BeforeAnalyteUpdate()
Objects exposed from Profile.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

After updating an analyte during PJCSA creation scripts


After updating the sample scheme analyte determination records for an analyte, if the file ProUDF.vbs exists,
the ProUDF6 or AfterAnalyteUpdate subroutine in it is run (whichever is listed first in the script file).
Subroutines run from this script:
Sub ProUDF6()
Sub AfterAnalyteUpdate()
Objects exposed from Profile.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

Determining whether a job can be deleted scripts


Before a job is deleted, if the file ProUDF.vbs exists, the CanDeleteJob subroutine in it is run, to determine
whether a job can be deleted.
Subroutines run from this script:
Sub CanDeleteJob()
Objects exposed from Profile.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

Before deleting a job scripts


Before a job is deleted, if the file ProUDF.vbs exists, the ProUDF4 or BeforeJobDelete subroutine in it is run
(whichever is listed first in the script file).
Subroutines run from this script:
Sub ProUDF4()
Sub BeforeJobDelete()
Objects exposed from Profile.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

155

After deleting a job scripts


After a job is deleted, if the file ProUDF.vbs exists, the ProUDF5 or AfterJobDelete subroutine in it is run
(whichever is listed first in the script file).
Subroutines run from this script:
Sub ProUDF5()
Sub AfterJobDelete()
Objects exposed from Profile.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

Before adding a procedure scripts


Before a selected procedure is added to a job, if the file ProUDF.vbs exists, the ProUDF18 or
BeforeProcedureAdd subroutine in it is run (whichever is listed first in the script file).
Subroutines run from this script:
Sub ProUDF18()
Sub BeforeProcedureAdd()
Objects exposed from Profile.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

After adding a procedure scripts


After a selected procedure is added to a job, if the file ProUDF.vbs exists, the ProUDF19 or
AfterProcedureAdd subroutine in it is run (whichever is listed first in the script file).
Subroutines run from this script:
Sub ProUDF19()
Sub AfterProcedureAdd()
Objects exposed from Profile.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

Before deleting a scheme scripts


Before a scheme is deleted from a job, if the file ProUDF.vbs exists, the ProUDF16 or BeforeSchemeDelete
subroutine in it is run (whichever is listed first in the script file).
Subroutines run from this script:
Sub ProUDF16()
Sub BeforeSchemeDelete()
Objects exposed from Profile.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

156

CCLAS 1.4

After deleting a scheme scripts


After a scheme is deleted from a job, if the file ProUDF.vbs exists, the ProUDF17 or AfterSchemeDelete
subroutine in it is run (whichever is listed first in the script file).
Subroutines run from this script:
Sub ProUDF17()
Sub AfterSchemeDelete()
Objects exposed from Profile.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

Before retrieving a job scripts


Before a job is retrieved, if the file ProUDF.vbs exists, the ProUDF8 or BeforeJobRetrieve subroutine in it is
run (whichever is listed first in the script file).
Subroutines run from this script:
Sub ProUDF8()
Sub BeforeJobRetrieve()
Objects exposed from Profile.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

After retrieving a job scripts


After a job is retrieved, if the file ProUDF.vbs exists, the ProUDF9 or AfterJobRetrieve subroutine in it is run
(whichever is listed first in the script file).
Subroutines run from this script:
Sub ProUDF9()
Sub AfterJobRetrieve()
Objects exposed from Profile.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

Before status view scripts


Before a job's status is viewed, if the file ProUDF.vbs exists, the BeforeStatusView subroutine in it is run.
This can be used to massage data on the status forms prior to producing a status report.
Subroutines run from this script:
Sub BeforeStatusView()

157

Objects exposed from Profile.exe for use in this script:


clsArray
clsSecurity
clsBDScheme
clsBDClient
clsBDProfjob
PVExplorer
FrmStatusJob
FrmStatusScheme
FrmStatusAnalyte
FrmStatusCuid
FrmStatusCuidScheme

Before archiving a job scripts


Before a job is archived, if the file ProUDF.vbs exists, the ProUDF6 or BeforeJobArchive subroutine in it is
run (whichever is listed first in the script file).
Subroutines run from this script:
Sub ProUDF6()
Sub BeforeJobArchive()
Objects exposed from ccProf01.dll for use in this script:
clsSecurity
clsBDProfjob

During job archive scripts


During the job archive process, if the file ProUDF.vbs exists, the DuringJobArchive subroutine in it is run.
Subroutines run from this script:
Sub DuringJobArchive()
Objects exposed from ccProf01.dll for use in this script:
clsSecurity
clsBDProfjob

After archiving a job scripts


After a job is archived, if the file ProUDF.vbs exists, the ProUDF7 or AfterJobArchive subroutine in it is run
(whichever is listed first in the script file).
Subroutines run from this script:
Sub ProUDF7()
Sub AfterJobArchive()
Objects exposed from ccProf01.dll for use in this script:
clsSecurity
clsBDProfjob

158

CCLAS 1.4

During job retrieve scripts


During the job retrieve process, if the file ProUDF.vbs exists, the DuringJobRetrieve subroutine in it is run.
Subroutines run from this script:
Sub DuringJobRetrieve()
Objects exposed from ccProf01.dll for use in this script:
clsSecurity
clsBDProfjob
The ProUDF.VBS fires during most occurrences in the Job (Profile) Module. This is a very useful hook,
with the ProUDF you can control nearly everything that happens to a Job.
The ProUDF.VBS has the following subs:
Sub CreateConcDB(bUpdate, bQC, sProJob)
.
.
End Sub
'
Function CanCreateJob(sLab, sCli, sProj, sProJob, sCounterUsed)
.
.
End Function
'
Sub BeforeEditJob()
.
.
End Sub
'
Sub BeforeJobDelete(sProJob)
.
.
End Sub
'
Sub AfterJobDelete(sProJob)
.
.
End Sub
'
Sub BeforeJobArchive(sProJob, lMode)
.
.
End Sub
'
Sub AfterJobArchive(sProJob, lMode)
.
.
End Sub
'
Sub BeforeJobRetrieve(sProJob)
.
.
End Sub
'
Sub AfterJobRetrieve(sProJob)
.
.
End Sub
'
Sub BeforeSampleGridSave(sProJob)
.
.
End Sub
'
Sub AfterSampleGridSave(sProJob)
.
.
End Sub
'

159

Function BeforeIdentsSave(sProJob, sMemo, sType)


BeforeIdentsSave = sMemo
End Function
'
Sub AfterIdentsSave(sProJob, sMemo, sType)
'
InsertIntoBarcodeTable sProJob
End Sub
'
Sub BeforeJobOpened(sProJob)
.
.
End Sub
'
Sub AfterJobOpened(sProJob)
Dim sPath
Dim oFolder
Dim oFiles
Dim oFile
Dim oFS
'
Set oFS = CreateObject("Scripting.FileSystemObject")
sPath = clsSecurity.GlobalSetting("BinDirectory")
Set oFolder = oFS.GetFolder(sPath)
Set oFiles = oFolder.Files
For Each oFile in oFiles
If oFile.Name = sProJob & ".LCK" Then
oFS.DeleteFile sPath & "\" & sProJob & ".LCK"
End If
Next
'
Set oFolder = Nothing
Set oFiles = Nothing
Set oFile = Nothing
Set oFS = Nothing
'
SaveAllControlProperties
End Sub
'
Sub BeforeSchemeDelete(sProJob, sScheme)
.
.
End Sub
'
Sub AfterSchemeDelete(sProJob, sScheme)
.
.
End Sub
'
Sub BeforeProcedureAdd(sProJob, sProcedure)
.
.
End Sub
'
Sub AfterProcedureAdd(sProJob, sProcedure)
.
.
End Sub
'
Sub BeforeJobCopy(sDestJob, sSourceJob, sCounterUsed)
.
.
End Sub
'
Sub AfterJobCopy(sDestJob, sSourceJob, sCounterUsed)
.
.
End Sub
'
Function CanDeleteJob(sProJob)
CanDeleteJob = ""
End Function
'
Sub BeforeSchemeUpdate(sProJob, sScheme, bQC, bUpdate)
.
.
End Sub

160

CCLAS 1.4

'
Sub
.
.
End
'
Sub
.
.
End
'
Sub
.
.
End

AfterSchemeUpdate(sProJob, sScheme, bQC, bUpdate)


Sub
BeforeAnalyteUpdate(sProJob, sScheme, bQC, bUpdate)
Sub
AfterAnalyteUpdate(sProJob, sScheme, bQC, bUpdate)
Sub

Suppose you want to hide certain tabs in the Job module from Staff Codes that do not belong to a certain
group, and where Access Levels would not be useful at what stage would one write the code to to that?
Maybe in the BeforeJobEdit sub?
Or you would like to immediately Batch samples that belong to a specific kind of Job, the moment the
Samples have been registered?
Or maybe automatically send an email to Clients informing them that their Samples have been registered?
The possibilities are huge.
Or would you like to generate a summary sheet and email it to the Client automatically?

DBCUDF.VBS
Before creating PJCSA records scripts
Before creating the sample scheme analyte determination records for a job, if the file DbcUDF.vbs exists, the
DbcUDF1 or BeforeCreateConcDB subroutine in it is run (whichever is listed first in the script file).
Subroutines run from this script:
Sub DbcUDF1()
Sub BeforeCreateConcDB()
Objects exposed from ccProf01.dll for use in this script:
clsSecurity
clsBDScheme
clsBDClient
clsBDProfjob
clsExpandIdent
clsProfRep

After creating PJCSA records scripts


After creating the sample scheme analyte determination records for a job, if the file DbcUDF.vbs exists, the
DbcUDF2 or AfterCreateConcDB subroutine in it is run (whichever is listed first in the script file).
Subroutines run from this script:
Sub DbcUDF2()
Sub AfterCreateConcDB()

161

Objects exposed from ccProf01.dll for use in this script:


clsSecurity
clsBDScheme
clsBDClient
clsBDProfjob
clsExpandIdent
clsProfRep

BatchUDF.VBS
Before creating a lab batch scripts
Before creating a lab batch, if the file BatchUDF.vbs exists, the BatchUDF1 subroutine in it is run for the new
lab batch job.
Subroutines run from this script:
Sub DbcUDF1(sProJob)
Objects exposed from ccProf01.dll for use in this script:
clsSecurity
clsBDScheme
clsBDClient
clsBDProfjob

After creating a lab batch scripts


After creating a lab batch, if the file BatchUDF.vbs exists, the BatchUDF2 subroutine in it is run for the new
lab batch job.
Subroutines run from this script:
Sub DbcUDF2(sProJob)
Objects exposed from ccProf01.dll for use in this script:
clsSecurity
clsBDScheme
clsBDClient
clsBDProfjob

Before getting sample list scripts


Before a list of samples is extracted for the criteria to lab batch on, if the file BatchUDF.vbs exists, the
BeforeQueryData subroutine in it is run.
Subroutines run from this script:
Sub BeforeQueryData()
Objects exposed from Batch.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob
clsBatch
oRsSamples

162

CCLAS 1.4

After getting sample list scripts


After a list of samples is extracted for the criteria to lab batch on, if the file BatchUDF.vbs exists, the
AfterQueryData subroutine in it is run.
Subroutines run from this script:
Sub AfterQueryData()
Objects exposed from Batch.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob
clsBatch
oRsSamples

After generating a run list for lab batch scripts


After generating a run list for a lab batch, if the file BatchUDF.vbs exists, the BatchUDF3 subroutine in it is
run.
Subroutines run from this script:
Sub BatchUDF3()
Objects exposed from Batch.exe for use in this script:
clsArray
clsSecurity
oRsSamples
clsBatch
clsBDProfjob
The BatchUDF.VBS controls anything that happens directly before (Sub BatchUDF1) and directly after (Sub
BatchUDF2) batching Samples. The BatchUDF.VBS script takes the following form:
Sub BatchUDF1(sProJob)
'
End Sub
Sub BatchUDF2(sProJob)
CreateAALabelFile sProJob
CreateWorkSheet sProJob
ReSequence sProJob
ShortBarcodesForLeco sProJob
AddQCValues sProJob
End Sub

In the BatchUDF1 Sub, nothing special happens but in the BatchUDF2, a few other subs are called):
Sub
.
.
End
'
Sub
.
.
End
'
Sub
.
.
End
'
Sub
.
.

163

CreateAALabelFile(sProJob)
Sub
CreateWorkSheet(sProJob)
Sub
ReSequence(sProJob)
Sub
ShortBarcodesForLeco(sProJob)

End Sub
'
Sub AddQCValues(sProJob)
.
.
End Sub

Do you need to create a label file to feed directly to the instrument, as soon as the Lab Batch has been
created?
Or create a Worksheet automatically, so that the person that does the batching, does not have to generate
paperwork manually?
Maybe re-sequence samples due to some reason?
Would you like to generate shorter barcodes for an instrument that cannot accept longer CCLAS Sample
Idents?
Or add dilutions and aliquots to STDs in the Lab Batch?

RepUDF.VBS
Before opening job scripts
Before a job is opened, if the file RepUDF.vbs exists, the BeforeOpenJob subroutine in it is run.
Subroutines run from this script:
Sub BeforeOpenJob()
Objects exposed from Report.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

Determining whether to a job can be reported scripts


Before a job is reported, if the file RepUDF.vbs exists, the AllowReportJob subroutine in it is run, to
determine whether a job can be reported.
Subroutines run from this script:
Sub AllowReportJob()
Objects exposed from Report.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob

Before generating a Crystal Report scripts


Before a Crystal Report is generated for the job (i.e., when the selected template has .RPT file extension), if
the file RepUDF.vbs exists, the BeforeCrystalGenerate subroutine in it is run.
Subroutines run from this script:
Sub BeforeCrystalGenerate()

164

CCLAS 1.4

Objects exposed from Report.exe for use in this script:


clsArray
clsSecurity
clsBDProfjob
oRsPJ
oRsPJC
oRsUserPJC
oRsPJSA
oRsPJCSA
clsProfRep
clsReport
The RepUDF.VBS script runs directly before (Sub RepUDF1) and directly after (Sub RepUDF2) creating an
Analytical Report.
The script takes the following form:
Sub PrepUDF1()
'
End Sub
'
Sub PrepUDF2()
'
End Sub
'
Sub PrepUDF3()
'
End Sub
'
Sub PrepUDF4()
'
End Sub
'
Sub BeforeCrystalGenerate()
'
'
Objects exposed for this subroutine
'
clsProfRep
'
clsSecurity
'
clsReport
'
oRsPJ, oRsPJSA, oRsPJCSA, oRsSubReport
'
End Sub
'
Sub AfterCrystalGenerate()
'
'
Objects exposed for this subroutine
'
CrystalReport, frmCrystalReportView.CrystalReport
'
CrystalReportViewer, frmCrystalReportView.CRViewer1
'
CrystalApplication, frmCrystalReportView.CrystalApp
'
Form, frmCrystalReportView
'
clsProfRep
'
clsSecurity
'
clsReport
'
End Sub
'
Function AllowReportJob(sProJob)
'
'
Objects exposed for this subroutine
'
clsBDProfJob
'
clsSecurity
'
AllowReportJob = ""
End Function
'
Sub BeforeOpenJob(sProJob)

165

'
'
Objects exposed for this subroutine
'
Form
'
clsBDProfJob
'
clsSecurity
'
End Sub

Would you like to automatically place your Report on the Companys intranet? Maybe convert it with Java?
Or are there other systems that depend on data from your report maybe they would allow you to place the
reported data directly into tables allocated by those systems?
Or add another field to the Excel template based on certain criteria?
Automatically print the report in PDF format?
Protect the worksheet so that no unauthorized changes can be made?
Or create a unique report number for e.g. Final Metals only?

PRepUDF.VBS
Before creating an analytical Excel report scripts
Before an analytical Excel report is generated for the job (i.e., when the selected template has .XLS file
extension), if the file PRepUDF.vbs exists, the PRepUDF1 subroutine in it is run.
Subroutines run from this script:
Sub PRepUDF1()
Objects exposed from ccPRep01.dll for use in this script:
clsBDScheme
clsBDClient
clsBDProfjob
Parameters
clsProfRep
Excel application

After creating an analytical Excel report scripts


After an analytical Excel report is generated for the job (i.e., when the selected template has .XLS file
extension), if the file PRepUDF.vbs exists, the PRepUDF2 subroutine in it is run.
Subroutines run from this script:
Sub PRepUDF2()
Objects exposed from ccPRep01.dll for use in this script:
clsBDScheme
clsBDClient
clsBDProfjob
Parameters
clsProfRep
Excel application

166

CCLAS 1.4

Before creating an analytical Word report scripts


Before an analytical Word report is generated for the job (i.e., when the selected template has .DOC file
extension), if the file PRepUDF.vbs exists, the PRepUDF3 subroutine in it is run.
Subroutines run from this script:
Sub PRepUDF3()
Objects exposed from ccPRep01.dll for use in this script:
clsBDScheme
clsBDClient
clsBDProfjob
Parameters
clsProfRep
Word application

After creating an analytical Word report scripts


After an analytical Word report is generated for the job (i.e., when the selected template has .DOC file
extension), if the file PRepUDF.vbs exists, the PRepUDF4 subroutine in it is run.
Subroutines run from this script:
Sub PRepUDF4()
Objects exposed from ccPRep01.dll for use in this script:
Word application

Before generating a Crystal Report scripts


Before a Crystal Report is generated for the job (i.e., when the selected template has .RPT file extension), if
the file PRepUDF.vbs exists, the BeforeCrystalGenerate subroutine in it is run. This is typically used to
create paperwork for the job.
Subroutines run from this script:
Sub BeforeCrystalGenerate()
Objects exposed from Profile.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob
oRsPJ
oRsPJC
oRsUserPJC
oRsPJSA
oRsPJCSA
clsProfRep

After generating a Crystal Report scripts


After a Crystal Report is generated (i.e., when the selected template has .RPT file extension), if the Crystal
Report script file defined by the clsCrystalReport.ScriptFile property exists, the PRepUDF5 or
AfterCrystalGenerate subroutine in it is run (whichever is listed first in the script file).

167

Subroutines run from this script:


Sub PRepUDF5()
Sub AfterCrystalGenerate()
Objects exposed from Profile.exe for use in this script:
Form
clsSecurity
clsProfRep
clsReport
CrystalReport
CrystalReportViewer
CrystalApplication

InvUDF.VBS
Before opening a job scripts
Before opening a single job that does not yet have an invoice, opening multiple jobs that do not yet have an
invoice, editing an invoice, overwriting an invoice or opening a job to issue another invoice for it, if the file
InvUDF.vbs exists, the InvUDF5 or CanEditInvoice subroutine in it is run (whichever is listed first in the script
file).
Subroutines run from this script:
Sub InvUDF5()
Sub CanEditInvoice()
Objects exposed from Invoice.exe for use in this script:
clsArray
clsSecurity
clsInvoice

After querying data and the cost items grid is loaded scripts
After querying data and the cost items grid is loaded on the Details tab, if the file InvUDF.vbs exists, the
InvUDF4 or AfterRefreshData subroutine in it is run (whichever is listed first in the script file).
Subroutines run from this script:
Sub InvUDF4()
Sub AfterRefreshData()
Objects exposed from Invoice.exe for use in this script:
clsArray
clsSecurity
clsInvoice

After displaying the form to enter the invoice content scripts


After displaying the form to enter the invoice content, if the file InvUDF.vbs exists, the InvUDF6 or
AfterOpenInvoice subroutine in it is run (whichever is listed first in the script file).

168

CCLAS 1.4

Subroutines run from this script:


Sub InvUDF6()
Sub AfterOpenInvoice()
Objects exposed from Invoice.exe for use in this script:
Form
clsArray
clsSecurity
clsInvoice
Note that the name of the invoice details grid in the Details tab on the form is F1Book1. The columns in the
grid (actually loaded from Invoice setting Edit2ListViewColumnN - maximum of 9 columns) are hard-fixed to:

1
2
3
4
5
6
7
8
9

PRO_JOB
SCH_CODE
ANALYTECODE
INVMESSAGE1
NOANALYTES
NOSAMPLES
UNITPRICE
DISCOUNT
AMOUNT

Some other useful controls on the form are:


chkInformational
chkSingleSheet
chkfraOutputFile
txtOutputFile
optViewNone
optPreview
optViewEnd
txtDiscount
TabStrip1
txtTemplate

Informational check box


Single sheet check box
Output file name
Output file text box
Option button for view mode
Option button for preview mode
Option button for view mode
Discount text box
Tab control
Template file text box

Inserting a scheme invoice item scripts


If the Invoice initialization setting InsertSchFile is set (e.g., InsertScheme.vbs), the script obtained from that
setting is run when the Add or Insert option is clicked on the invoice Details tab.

169

Subroutines run from this script:


Sub Main()
Objects exposed from Invoice.exe for use in this script:
clsArray
clsSecurity
clsBDScheme
clsBDClient
clsBDProfjob
clsInvoice

Inserting a miscellaneous scheme invoice item scripts


If the Invoice initialization setting InsertMiscFile is set (e.g., InsertMiscFile.vbs), the script obtained from that
setting is run when the Insert Misc option is clicked on the invoice Details tab.
Subroutines run from this script:
Sub Main()
Objects exposed from Invoice.exe for use in this script:
clsArray
clsSecurity
clsBDScheme
clsBDClient
clsBDProfjob
clsInvoice

Inserting an information line scripts


If the Invoice initialization setting InsertInfoFile is set (e.g., InsertInfoFile.vbs), the script obtained from that
setting is run when the Insert infolines option is clicked on the invoice Details tab.
Subroutines run from this script:
Sub Main()
Objects exposed from Invoice.exe for use in this script:
clsArray
clsSecurity
clsBDScheme
clsBDClient
clsBDProfjob
clsInvoice

Editing an invoice item scripts


If the Invoice initialization setting EditItemFile is set (e.g., EditItem.vbs), the script obtained from that setting
is run when the Edit option is clicked on the invoice Details tab.
Subroutines run from this script:
Sub Main()

170

CCLAS 1.4

Objects exposed from Invoice.exe for use in this script:


clsArray
clsSecurity
clsBDScheme
clsBDClient
clsBDProfjob
clsCurrentInvoice
clsBDInvoice
clsBDPrice
clsInvoice
F1Book
FormEditInvoice

Before creating an invoice or credit note scripts


Before creating an invoice or credit note, if the file InvUDF.vbs exists, the InvUDF1 or
BeforeCreatePaperwork subroutine in it is run (whichever is listed first in the script file).
Subroutines run from this script:
Sub InvUDF1()
Sub BeforeCreatePaperwork()
Objects exposed from Invoice.exe for use in this script:
clsArray
clsSecurity
clsInvoice
Excel application object

After creating an invoice or credit note scripts


After creating an invoice or credit note, if the file InvUDF.vbs exists, the InvUDF2 or AfterCreatePaperwork
subroutine in it is run (whichever is listed first in the script file).
Subroutines run from this script:
Sub InvUDF2()
Sub AfterCreatePaperwork()
Objects exposed from Invoice.exe for use in this script:
clsArray
clsSecurity
clsInvoice
Excel application object

After removing an invoice scripts


After removing an invoice, if the file InvUDF.vbs exists, the InvUDF2 or AfterDeleteInvoice subroutine in it is
run (whichever is listed first in the script file).
Subroutines run from this script:
Sub InvUDF3(sInvoiceNo)
Sub AfterDeleteInvoice(sInvoiceNo)

171

Objects exposed from Invoice.exe for use in this script:


clsArray
clsSecurity
clsInvoice

After triggering invoice generate scripts


After removing an invoice, if the file InvUDF.vbs exists, the InvUDF7 or BeforeSaveInvoice subroutine in it is
run (whichever is listed first in the script file).
Subroutines run from this script:
Sub InvUDF7()
Sub BeforeSaveInvoice()
Objects exposed from Invoice.exe for use in this script:
clsArray
clsSecurity
clsInvoice
This runs before and after creation of an Invoice.
The InvUDF.VBS takes the following form:
Sub BeforeCreatePaperwork(bCreditNote)
.
.
End Sub
'
Sub AfterCreatePaperwork(bCreditNote)
.
.
End Sub
'
Sub AfterDeleteInvoice(InvoiceNo)
.
.
End Sub
'
Sub AfterRefreshData()
.
.
End Sub
'
Function CanEditInvoice()
.
.
End Function
'
Sub AfterOpenInvoice()
.
.
End Sub
'
Sub BeforeSaveInvoice()
.
.
End Sub
'
Sub BeforeGetSequence(bCreditNote)
.
.
End Sub
'
Function CanOpenInvoice()
.
.
End Function

172

CCLAS 1.4

Suppose you want to automatically email the Invoice to your Client after it has been created?
Or you assign a different sequence number to each Clients invoices?
Or send the invoice amount to some accounting system?

StatUDF.VBS
Before querying records for a Crystal Report scripts
Before querying records to generate a Crystal Report status report (i.e., when the selected template has
.RPT file extension), if the file StatUDF.vbs exists, the BeforeCrystalQuery subroutine in it is run.
Subroutines run from this script:
Sub BeforeCrystalQuery()
Objects exposed from StatRep.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob
clsProfRep
clsStatRep

Before generating a Crystal Report scripts


Before a Crystal Report is generated for lab status (i.e., when the selected template has .RPT file extension),
if the file StatUDF.vbs exists, the BeforeCrystalGenerate subroutine in it is run.
Subroutines run from this script:
Sub BeforeCrystalGenerate()
Objects exposed from StatRep.exe for use in this script:
clsArray
clsSecurity
clsBDProfjob
oRsPJ
oRsPJC
oRsUserPJC
oRsPJSA
oRsPJCSA
clsProfRep
clsStatRep
The StatUDF.VBS runs before and after the creation of Status Reports. It takes on the following format;
Sub PrepUDF1()
.
.
End Sub
'
Sub PrepUDF2()
.
.
ExcelApplication.ActiveWindow.SelectedSheets.PrintOut ,,1,False,"Acrobat PDFWriter on
LPT1:", True, True, "C:\STATREP"
End Sub
'

173

Sub
.
.
End
'
Sub
.
.
End

BeforeCrystalGenerate()
Sub
AfterCrystalGenerate()
Sub

Think of what you could do with this one:


Create and email a status report directly;
Or create a report that calculate turn-around times for you;

PrfUDF.VBS
The PRFUDF.VBS handles user-defined QC Report creation.

Before extracting the qc performance analysis data scripts


Before extracting the qc performance analysis data, if the file PrfUDF.vbs exists, the PrfUDF1 subroutine in it
is run.
Subroutines run from this script:
Sub PrfUDF1()
Objects exposed from PerfAna.exe for use in this script:
clsArray
clsSecurity
clsPrfCriteria
clsPrfData
clsPrfStatistics
clsPrfReport
clsPrfChart
tso
ts

After extracting the qc performance analysis data scripts


After extracting the qc performance analysis data, if the file PrfUDF.vbs exists, the PrfUDF2 subroutine in it is
run.
Subroutines run from this script:
Sub PrfUDF2()

174

CCLAS 1.4

Objects exposed from PerfAna.exe for use in this script:


clsArray
clsSecurity
clsPrfCriteria
clsPrfData
clsPrfStatistics
clsPrfReport
clsPrfChart
tso
ts

Before creating a qc performance analysis report scripts


Before creating a qc performance analysis report, if the file PrfUDF.vbs exists, the PrfUDF3 subroutine in it is
run.
Subroutines run from this script:
Sub PrfUDF3()
Objects exposed from PerfAna.exe for use in this script:
clsArray
clsSecurity
clsPrfCriteria
clsPrfData
clsPrfStatistics
clsPrfReport
clsPrfChart
tso
ts

After creating a qc performance analysis report scripts


After creating a qc performance analysis report, if the file PrfUDF.vbs exists, the PrfUDF4 subroutine in it is
run.
Subroutines run from this script:
Sub PrfUDF4()
Objects exposed from PerfAna.exe for use in this script:
clsArray
clsSecurity
clsPrfCriteria
clsPrfData
clsPrfStatistics
clsPrfReport
clsPrfChart
tso
ts

175

Before creating a qc performance analysis plot scripts


Before creating a qc performance analysis plot, if the file PrfUDF.vbs exists, the PrfUDF5 subroutine in it is
run.
Subroutines run from this script:
Sub PrfUDF5()
Objects exposed from PerfAna.exe for use in this script:
clsArray
clsSecurity
clsPrfCriteria
clsPrfData
clsPrfStatistics
clsPrfReport
clsPrfChart
tso
ts

After creating a qc performance analysis plot scripts


After creating a qc performance analysis plot, if the file PrfUDF.vbs exists, the PrfUDF6 subroutine in it is run.
Subroutines run from this script:
Sub PrfUDF6()
Objects exposed from PerfAna.exe for use in this script:
clsArray
clsSecurity
clsPrfCriteria
clsPrfData
clsPrfStatistics
clsPrfReport
clsPrfChart
tso
ts
When CCLAS is installed, the PRFUDF.VBS takes the following form:
Sub PrfUDF1()
.
.
End Sub
Sub PrfUDF2()
.
.
End Sub
Sub PrfUDF3()
.
.
End Sub
'

176

CCLAS 1.4

Sub PrfUDF4()
.
.
End Sub
Sub PrfUDF5()
.
.
End Sub
Sub PrfUDF6()
.
.
End Sub

What can you do with all of this? Create QC Report and graphs automaticall and email them to the relevant
people!
Or update tables from other systems that need Quality Control data?
Or, maybe use this data for calibration of an instrument, sending it to the relevant database on the
Instruments PC?

LabMaintUDF.VBS
The LabMaintUDF.VBS handles user defined Laboratory Maintenance tasks. During installation, this file is in
the following format:
Sub LabUDF1()
'
' Pre audit add subrountine
'
End Sub
Sub LabUDF2()
'
' Post audit add subrountine
'
End Sub
Sub LabUDF3()
'
' Pre schedule modify subroutine
'
End Sub
'
Sub LabUDF4()
'
' Post schedule modify subroutine
'
End Sub

177

*Runn Settings
ConsumablesRunn
If the File Run menu is selected, the associated screen script defined by the Consumables initialization
settings ConsumablesRunn is run to add a new tracking.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Consumables.exe for use in this script:
Form
clsArray
clsSecurity
clsBDCmConsumeType
clsBDCmSupplier
fso
ts

MDERunn
If the MDERun run type menu is selected, the associated screen script defined by the MDE initialization
settings MDERunn is run to add a new run list.
Subroutines run from this script:
Sub Form_Load()
Objects exposed from Samana.exe for use in this script:
Form,
clsArray
clsSecurity
clsBDProfjob
Grid
F1Book1

SamanaRunn
If the File Add run type menu is selected, the associated screen script defined by the Samana initialization
settings SamanaRunn is run to add a new run list.

178

CCLAS 1.4

Subroutines run from this script:


Sub Form_Load()
Sub SQLWhere()
Sub SQLOrder()
Sub cmdQuery_Click()
Objects exposed from Samana.exe for use in this script:
Form,
clsArray
clsSecurity
clsBDProfjob
Grid
FormSamana

Profile - ScreenFilen
If the File New job type menu is selected, the associated screen script defined by the Profile initialization
settings ProfileScreenFilen is run to add a new job.
Subroutines run from this script:
Sub Form_Load()
Sub Main()
Objects exposed from Profile.exe for use in this script:
Form
clsArray
clsSecurity
clsProfile
clsBDProfjob
clsCurrent

SamReg - ScreenFilen
If the File New sample type menu is selected, the associated screen script (default script is SamReg.scr) is
run to register a new sample for a job. The values of the SamReg initialization settings ScreenFilen point to
screen files that are used to enter user defined details for different sample types.
Subroutines run from this script:
Sub Form_Load()
Form_Unload()
Form_Save()
Form_Resize()

179

Objects exposed from Profile.exe for use in this script:


Form
clsArray
clsSecurity
clsBDScheme
clsBDProfjob
clsProfRep

Taskman - AutoRunn
Either when a script is manually selected or when there is an associated screen script defined by the
Taskman initialization setting AutoRunn, the Taskman module runs the script.
Subroutines run from this script:
Sub Main()
Objects exposed from Taskman.exe for this script:
clsSecurity
clsBOTaskmanSession
fso
ts

LabMaintenanceRunn
If the File Run menu is selected, the associated screen script defined by the LabMaintenance initialization
settings LabMaintenanceRunn is run to add a new lab maintenance schedule.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from LabMaintenance.exe for use in this script:
Form
clsArray
clsSecurity
clsBDLabmaint
clsBDLabmaintaudit
clsLabMaintenance
clsBDInstrument
fso
ts

180

CCLAS 1.4

SampleTrackRunn
If the File Run menu is selected, the associated screen script defined by the SampleTrack initialization
settings SampleTrackRunn is run to add a new tracking.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from SampleTrack.exe for use in this script:
Form
clsArray
clsSecurity
clsBDSTPhysicalType
clsBDSTLocation
clsBDSTContainer
clsBDSTAction
clsBDSTJob
clsBDProfjob
clsBDProfClient
clsBDClient
fso
ts

ConsumablesRunn
If the File Run menu is selected, the associated screen script defined by the Consumables initialization
settings ConsumablesRunn is run to add a new tracking.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Consumables.exe for use in this script:
Form
clsArray
clsSecurity
clsBDCmConsumeType
clsBDCmSupplier
fso
ts

181

*AddNew.SCR
ProcregSchemeAddNew.scr
When selecting a scheme to add to a procedure, if the file ProcregSchemeAddNew.scr exists, the form is
run. This form can be used return a scheme code to be added to the procedure.
Subroutines run from this script:
Sub Form_Load()
Sub SQLWhere()
Sub SQLOrder()
Sub cmdQuery_Click()
Objects exposed from Scheme.exe for use in this script:
clsArray
clsSecurity
clsBDScheme

ProductSchemeAddNew.scr
When selecting a scheme to add to a product, if the file ProductSchemeAddNew.scr exists, the form is run.
This form can be used return a scheme code to be added to the product.
Subroutines run from this script:
Sub Form_Load()
Sub SQLWhere()
Sub SQLOrder()
Sub cmdQuery_Click()
Objects exposed from Scheme.exe for use in this script:
clsArray
clsSecurity
clsBDScheme

ProfjobAddNew.scr
If the New menu icon is selected, the ProfjobAddNew.scr script is run.
Subroutines run from this script:
Sub Form_Load()
Sub SQLWhere()
Sub SQLOrder()
Sub cmdQuery_Click()

182

CCLAS 1.4

Objects exposed from Profile.exe for use in this script:


Form
clsArray
clsSecurity
clsBDClient
clsBDProfjob

ProfjobProcedureAddNew.scr
When selecting a procedure to add to a job, if the file ProfjobProcedureAddNew.scr exists, the form is run.
This form can be used return a procedure code to be added to the job.
Subroutines run from this script:
Sub Form_Load()
Sub SQLWhere()
Sub SQLOrder()
Sub cmdQuery_Click()
Objects exposed from Scheme.exe for use in this script:
Form object
clsArray
clsSecurity
clsBDProcreg
clsBDProfjob

ProfjobSchemeAddNew.scr
When selecting a scheme to add to a job, if the file ProfjobSchemeAddNew.scr exists, the form is run. This
form can be used return a scheme code to be added to the job.
Subroutines run from this script:
Sub Form_Load()
Sub SQLWhere()
Sub SQLOrder()
Sub cmdQuery_Click()
Objects exposed from Scheme.exe for use in this script:
Form object
clsArray
clsSecurity
clsBDScheme
clsBDProfjob

183

ProfjobAnalyteAddNew.scr
When selecting an analyte to add to a scheme of a job, if the file ProfjobAnalyteAddNew.scr exists, the form
is run. This form can be used return an analyte code to be added to the job's scheme.
Subroutines run from this script:
Sub Form_Load()
Sub SQLWhere()
Sub SQLOrder() - Default order is SCH_CODE, SCHVERSION
Sub cmdQuery_Click()
Objects exposed from Scheme.exe for use in this script:
Form object
clsArray
clsSecurity
clsBDScheme
clsBDProfjob

BatchProcedureAddNew.scr
When selecting a procedure to batch on, if the file BatchProcedureAddNew.scr exists, the form is run. This
form can be used return a procedure code to extract samples to be lab batched.
Subroutines run from this script:
Sub Form_Load()
Sub SQLWhere()
Sub SQLOrder()
Sub cmdQuery_Click()
Objects exposed from Batch.exe for use in this script:
Form object
clsArray
clsSecurity
clsBDProcreg

BatchSchemeAddNew.scr
When selecting a scheme to batch on, if the file BatchSchemeAddNew.scr exists, the form is run. This form
can be used return a scheme code to extract samples to be lab batched.
Subroutines run from this script:
Sub Form_Load()
Sub SQLWhere()
Sub SQLOrder() - Default order SCH_CODE, SCHVERSION
Sub cmdQuery_Click()

184

CCLAS 1.4

Objects exposed from Batch.exe for use in this script:


Form object
clsArray
clsSecurity
clsBDScheme

QuoteProcedureAddNew.scr
When selecting a procedure to add to a quote, if the file QuoteProcedureAddNew.scr exists, the form is run.
This form can be used return a procedure code to be added to the quote.
Subroutines run from this script:
Sub Form_Load()
Sub SQLWhere()
Sub SQLOrder()
Sub cmdQuery_Click()
Objects exposed from ccQtWz01.dll for use in this script:
Form object
clsSecurity
clsBDProcreg

QuoteSchemeAddNew.scr
When selecting a scheme to add to a quote, if the file QuoteSchemeAddNew.scr exists, the form is run. This
form can be used return a scheme code to be added to the quote.
Subroutines run from this script:
Sub Form_Load()
Sub SQLWhere()
Sub SQLOrder()
Sub cmdQuery_Click()
Objects exposed from ccQtWz01.dll for use in this script:
Form object
clsSecurity
clsBDScheme

185

Module Specific scripts


Profile
Command dropdown
If a screen script is selected from the Command menu, the selected script file is run.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Profile.exe for use in this script:
Form
clsArray
clsSecurity
clsProfile
clsBDProfjob
clsCurrent

Sample idents user fields screen scripts


If the Profile initialization setting UserIdentsTab is set, the sample idents user fields screen obtained from
that setting is available on the USERIDENTS tab form. This allows for the entry of data into the Profjob_Cuid
table user fields.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from Profile.exe for use in this script:
Form
clsArray
clsSecurity
clsCurrent
clsBDScheme
clsBDClient
clsBDProfjob

Status text report preview scripts


If the file ProfileReportPreview.vbs exists, it is run when the File Preview menu option is selected from the
Job status form for a job. This allows for a quick overview of the status either at the job, scheme or analyte
level for the job.

186

CCLAS 1.4

Subroutines run from this script:


Sub ReportPreview(sJob, sScheme, sAnalyte)
Objects exposed from Profile.exe for use in this script:
clsArray
clsSecurity
clsBDScheme
clsBDClient
clsBDProfjob
PVExplorer
WebBrowser

User round value scripts


Whenever the clsBOProfjobCuidSchemeAnalyte.UserRoundedValue property is accessed, if the file
UserRoundValue.vbs exists, the UserRoundValue subroutine in it is run to round the final value according to
user-defined specifications.
Subroutines run from this script:
Sub UserRoundValue()
Objects exposed from ccProf01.dll for use in this script:
clsBDProfjob

Script snippets
Adding single samples to a job
Example of adding a single sample to a job:
oProfile.clsBDProfJob.AddSampleToConcDB sJobNum, sSamID

Example of adding a standard to a job:


clsCCComm.ProfJob.AddSampleToConcDB msProJob, sQCId, sEID, "", "", "STD", msSchCode

Example of adding a reread sample to a job for a number of times (lTimes):


sSql = "select * from profjob where pro_job = '" & sComponentJob & "'"
clsBDProfjob.OpenRSProfJob CStr(sSql)
clsBDProfJob.SkipProfJob 0
clsBDProfJob.DoUpdateJobStatus = False
For lI = 1 to lTimes
clsBDProfJob.AddSampletoConcDB sComponentJob, sIdent, sEid, "", "", "RRD", sSchCode
If Not HandleError Then
If lI = lTimes Then
MsgBox "Reread sample(s) " & CStr(clsBDProfJob.Current.SampleType) & "," & _
CStr(clsBDProfJob.Current.SampleIdent) & _
" added to job " & CStr(clsBDProfJob.Current.Pro_Job), vbOkOnly+vbInformation,
"Information"
End If
End If
Loop
bclsBDProfJob.DoUpdateJobStatus = True

187

Copying jobs
Example of creating the next automatic job as defined by the UNIQUENO AUTOJOB, where the client and
project for the job is the same as the template job, using a created clsProfile class call:
oProfile.clsBDProfjob.CopyProfJob "", "", "_TEMPLATE", "", "", "^AUTOJOB"

Note that the following are equivalent since either the client or project is blank:
oProfile.clsBDProfjob.CopyProfJob "", "", "_TEMPLATE", "ClientA", "", "^AUTOJOB"
oProfile.clsBDProfjob.CopyProfJob "", "", "_TEMPLATE", "", "Project1", "^AUTOJOB"

Example of creating the next automatic job as defined by the UNIQUENO AUTOJOB and the client and
project for this job will be ABC MINING, PROJECTX:
oProfile.clsBDProfjob.CopyProfJob "", "", "_TEMPLATE", "ABC MINING", "PROJECTX", "^AUTOJOB"

SamReg
Sample edit screen scripts
If a sample is opened on the sample registration screen, the script filename (default script is
SamRegEdit.scr) stored for the sample, in the Profjob_Cuid table ScreenFile field, is run. This allows for the
editing of sample details.
Subroutines run from this script:
Sub Form_Load()
Form_Unload()
Form_Save()
Form_Resize()
Objects exposed from Profile.exe for use in this script:
Form
clsArray
clsSecurity
clsBDScheme
clsBDProfjob
clsProfRep

Samana (Online)
After saving data for a sample scripts
After saving the analytical data for a sample by selecting the File Save Sample menu option, if the file
SamUDF.vbs exists, the AfterSave subroutine in it is run for the job, scheme, sample, either for interactive or
non-interactive mode.
Subroutines run from this script:
AfterSave(sProjob, sSchCode, sCuid, bInteractive)

188

CCLAS 1.4

Objects exposed from Samana.exe for use in this script:


Form
clsSecurity
clsCCComm
clsBDProfjob
clsChangesCollection

After pressing a user key scripts


After a user-defined key from vbKeyF6 to vbKeyF12 is pressed, if the file SamanaKeys.vbs exists, the Main
subroutine in it is run.
Subroutines run from this script:
Sub Main()
Objects exposed from Samana.exe for use in this script:
Form
clsCCComm
clsBDProfjob
fso

Product rules scripts


When samples are analyzed, if they are of a particular product, if a product rule exists for that scheme, the
Main subroutine in it is run. The scripts are stored in the Product_Rule table.
Subroutines run from this script:
Sub Main()
Objects exposed from Scheme.exe for use in this script:
clsBDScheme
clsBDClient
clsBDProfJob
Profjob
Profjobuser
ProfjobScheme
ProfjobSchemeAnalyte
ProfjobCuid
ProfjobCuiduser
ProfjobCuidScheme
ProfjobcuidSchemeAnalyte
Current

MDE
After loading the sheet scripts
After a sheet of sample data is loaded, if the file defined by the MDE initialization setting AutoRunAfterLoad
exists, the Main subroutine in it is run.

189

Subroutines run from this script:


Sub Main()
Objects exposed from MDE.exe for use in this script:
clsArray
clsSecurity
Sheet
F1Book
clsVariables
clsBDScheme
clsBDProfjob
clsCCComm
StatusBar

Running change value scripts


After editing a cell, if the file defined by the clsSheet.ValueChangedScriptFile property exists (e.g.,
ValueChanged.vbs), the Main subroutine in it is run.
Subroutines run from this script:
Sub Main(sValueEntered)
If the value entered was empty, sValueEntered="BLANKVALUEWASTYPED"
Objects exposed from MDE.exe for use in this script:
clsArray
clsSecurity
Sheet
F1Book
clsVariables
clsSchemes
clsBDProfjob
clsCCComm
StatusBar

Before saving the sheet scripts


After the Save menu option is selected, but before a sheet of sample data is saved, if the file defined by the
MDE initialization setting AutoRunBeforeSave exists, the Main subroutine in it is run.
Subroutines run from this script:
Sub Main()

190

CCLAS 1.4

Objects exposed from MDE.exe for use in this script:


clsArray
clsSecurity
Sheet
F1Book
clsVariables
clsBDScheme
clsBDProfjob
clsCCComm
StatusBar

After saving the sheet scripts


After saving the sheet of sample data, if the file defined by the MDE initialization setting AutoRunAfterSave
exists, the Main subroutine in it is run.
Subroutines run from this script:
Sub Main()
Objects exposed from MDE.exe for use in this script:
clsArray
clsSecurity
Sheet
F1Book
clsVariables
clsBDScheme
clsBDProfjob
clsCCComm
StatusBar

Running a selected command scripts


If a command with an associated script is run from the Command menu icon, the Main subroutine in it is run.
Subroutines run from this script:
Sub Main()
Objects exposed from MDE.exe for use in this script:
clsArray
clsSecurity
Sheet
F1Book
clsVariables
clsBDScheme
clsBDProfjob
clsCCComm
StatusBar

191

Running a selected screen scripts


Data entry user defined screens are run by setting the Sheet.ShowScreen method within the
<MDECommand>.VBS.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from MDE.exe for use in this script:
clsArray
clsSecurity
Sheet
F1Book
clsVariables
clsBDScheme
clsBDProfjob
clsCCComm
StatusBar

QC validation scripts
After the Edit Check QC values menu option is selected, but before validation occurs, if the file defined by
the MDE initialization setting ValidateScript exists, the Main subroutine in it is run.
Subroutines run from this script:
Sub Main()
Objects exposed from MDE.exe for use in this script:
clsArray
clsSecurity
Sheet
F1Book
clsVariables
clsBDScheme
clsBDProfjob
clsCCComm
StatusBar

QC ignore scripts
After the Edit Ignore menu option is selected, but before ignoring occurs, if the file defined by the MDE
initialization setting IgnoreScript exists, the Main subroutine in it is run.
Subroutines run from this script:
Sub Main()

192

CCLAS 1.4

Objects exposed from MDE.exe for use in this script:


clsArray
clsSecurity
Sheet
F1Book
clsVariables
clsBDScheme
clsBDProfjob
clsCCComm
StatusBar

QC trend scripts
After the File Command menu option and QC command is selected, if the file QCTrend.vbs exists, the
Form_Activate subroutine in it is run.
Subroutines run from this script:
Sub Form_Activate()
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from MDE.exe for use in this script:
Form
clsArray
Sheet
clsSecurity
F1Book
F1Book2
clsVariables
clsBDScheme
clsBDProfjob
clsCCComm
ctlChart
frmQC

ccComm01.dll
Instrument format file scripts
To communicate and decode data from an instrument, the Main subroutine is run from the instrument format
file (i.e., instrument.vbs).
Subroutines run from this script:
Sub Main()

193

Objects exposed from ccComm01.dll for use in this script:


clsSecurity
clsBDProfjob
clsCCComm

After starting instrument capture scripts


After instrument capture is initiated, the OnStart subroutine is run from the instrument format file (i.e.,
instrument.vbs).
Subroutines run from this script:
Sub OnStart()
Objects exposed from ccComm01.dll for use in this script:
clsSecurity
clsBDProfjob
clsCCComm

After a record is captured from instrument scripts


After a data record is captured from an instrument, the GotRecord subroutine is run from the instrument
format file (i.e., instrument.vbs).
Subroutines run from this script:
Sub GotRecord()
Objects exposed from ccComm01.dll for use in this script:
clsSecurity
clsBDProfjob
clsCCComm

After detecting a new data file scripts


After detecting a new data file, the AfterNewFileDetect subroutine is run from the instrument format file (i.e.,
instrument.vbs).
Subroutines run from this script:
Sub AfterNewFileDetect()
Objects exposed from ccComm01.dll for use in this script:
clsSecurity
clsBDProfjob
clsCCComm

Pre sample sub definition file scripts


After a data record is captured from an instrument but before the data is entered into CCLASEL, if a pre
sample sub definition file defined by the clsCCComm.PreSSDFile property exists (i.e.,
instrumentPreSSD.scr), it is run.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()

194

CCLAS 1.4

Objects exposed from ccComm01.dll for use in this script:


Form
clsArray
clsSecurity
clsBDProfjob
clsCCComm
Sheet (only when ccComm01.dll is an application extension of MDE.exe)

Post sample sub definition file scripts


After collected data is entered into CCLASEL, if a post sample sub definition file defined by the
clsCCComm.PostSSDFile property exists (i.e., instrumentPostSSD.scr), it is run.
Subroutines run from this script:
Sub Form_Load()
Sub Form_Unload()
Sub Form_Save()
Sub Form_Resize()
Objects exposed from ccComm01.dll for use in this script:
Form
clsArray
clsSecurity
clsBDProfjob
clsCCComm
Sheet (only when ccComm01.dll is an application extension of MDE.exe)

After storing sample data scripts


After storing data from an instrument or file for a sample, the AfterStoreSample subroutine is run from the
instrument format file (i.e., instrument.vbs).
Subroutines run from this script:
Sub AfterStoreSample()
Objects exposed from ccComm01.dll for use in this script:
clsSecurity
clsBDProfjob
clsCCComm

After stopping instrument capture scripts


After instrument capture is terminated, the AfterStopInstrument subroutine is run from the instrument format
file (i.e., instrument.vbs).
Subroutines run from this script:
Sub AfterStopInstrument()
Objects exposed from ccComm01.dll for use in this script:
clsSecurity
clsBDProfjob
clsCCComm

195

IFF Scripting
The CCLAS EL data log module provides various powerful features for loading in data from different
instruments. It is the purpose of this document to explain in more detail the various features available.
In order to capture data from instruments via file transfer or RS232 port, it is necessary to use the Comm
class clsCCComm. This class is accessible from the MDE and Samana programs via a VBScript file, which
forms the basis of the IFF (Instrument Format File).
The sections below describe each property, method and events handled by the class.
Once a data record is captured, it is passed to a Subroutine (if present) called Got_Record( ). This
subroutine can further manipulate the input buffer as required. At the end of this subroutine, the input buffer
CommsBuffer is 'decoded' by the IFF Settings

Properties
Property

Mode

Data

Description

AdvanceLockedSamples

Read

Type
Boolean

Flag to determine whether to automatically

Write

advance locked samples, i.e. NA, IS, LNR etc.


Can be set with True/False or 1/0 .
clsCCComm..AdvanceLocedSample = True

AdvanceSample

Read

Boolean

Flag that tells MDE or Samana to advance to the

Write

next sample.
This could be the time to wait for the display on
the current sample before moving onto next
sample. Zero (0) is no movement.
Ie
clsCCComm..AdvanceSample = 3

AllowAlphanumeric

Read

Boolean

Allow alpha as well as numeric characters to be

AutoAppendMode

Write
Read

Numeric

captured as results.
If set to True will register an extra sample if the

Write

sample doesnt exist provided the required


information is available.
ie
.AutoAppendMode = 1

'

append modes:
'

0 - Never

'

1 - Manual

AutoProductCheck

Read

Boolean

'
2 - Auto
If set to True will automatically check product

AutoUpdate

Write
Read

Boolean

rules.
If set to True will automatically update the QC

Write

196

statuses.

CCLAS 1.4

Property

Mode

Data

Description

BlkItems

Read

CommPort

Write
Read

Long

collection.
The COM port number. Values include 1, 2, 3, 4

CommPortSettings

Write
Read

String

etc
The various COM port settings such as baud rate,

Type
Provides access to the QC Blank codes

Write

parity, stop bits, data bits.


Ie
.CommPortSettings = "9600,N,8,1"

CommsBuffer

Read

String

The data stored in the COMs buffer. This can be

ConfirmResultOverwrite

Write
Read

Boolean

processed in the Got_record() subroutine.


If set to True, will ask user prompt user to

Cuid

Write
Read

String

overwrite results.
The sample CUID. Read-only.

Cycles

Only
Read

Long

The number of cycles. Read-only.

CycleWidth

Only
Read

Long

The number of characters for a element-data

Write

cycle.
Example:
clsCCComm.CycleWidth=20

DataItems

Read

DataMatchString

Write
Read

DateAnalysedItem

Write
Read

DecodedData

Write
Read

DecodedDataCachedRecords

Write
Read

Long

The number cached records in decoded data.

DupItems

Write
Read

String

Provides access to the previously defined

EOFFileCommunication

Only
Read

Boolean

Duplicate code items. Read-only.


Set to True if the end of file has been reached.

String

A string expression that tells MDE/Samana to only


decode data if the string expression is found.

Only

Read-only property.
Example:
If clsCCComm.EOFFileCommunication Then

ErrorItems

Read

String

Provides access to the previously defined

FileCommunication

Only
Read

String

instrument error items. Read-only.


Filename including full path of the instrument

Only

output file. UNC compliant. Read-only property.


Example:
clsCCComm.FileCommunication=\\ASERVER\CCLASEL
\XRF\XRFDATA.DAT

197

Property

Mode

Data

Description

FileDelay

Read

Type
Long

Number of seconds between new file

Handshaking

Write
Read

Long

communication.
A communications protocol.

Write

Usage: clsCCComm.Handshaking =
HandShakingConstant
HandShakingConstant can be any one of the
following values:
comNone

0. No handshaking

comXOnXOff

1. XOn/XOff handshaking

comRTS

2. Request-to-send/clear-to-send

handshaking.
comRTSXOnXOff

3. Request-to-send,

XOn/XOff handshaking.
Example:
clsCCComm.Handshaking =

clsCCComm.Handshaking = 2
clsCCComm.Handshaking = 0
clsCCComm.Handshaking = 3
clsCCComm.Handshaking = comXOnXOff

IFFScript

Read

String

The name of the IFF script that has been

IgnoreItems

Only
Read

Collection

InstrumentActive

Write
Read

Boolean

Set to True if instrument is active. Read-only.

InstrumentMedia

Only
Read

InstrumentName

Write
Read

String

Name of the instrument.

Job

Write
Read

String

Example: clsCCComm.InstrumentName=PE5100
Provides access to the job number. Read-only.

MultiplicationFactor

Only
Read

Double

Set a multiplication factor to apply to the decoded

selected.

Write

data.
Example:
clsCCComm.MultiplicationFactor=5.3235

NewFileCommunication

Read

String

Write

Filename and path to single record data file.


Example:
clsCCComm.NewFileCommunication=\\ASERVER\CCLA
SEL\XRF\XRFDAT.TXT

OnKeyItems

Read

PostSSDFile

Write
Read
Write

198

String

Filename and path to SSD file for entering data


after the capture has occurred.

CCLAS 1.4

Property

Mode

Data

Description

PreserveValue

Read

Type
Boolean

If set to True, will not overwrite the existing value

PreSSDBuffer

Write
Read

String

PreSSDFile

Write
Read

String

ProfJob

Write
Read

PromptForFileCommunication

Write
Read

Boolean

If set to True will prompt user for the location of

ProtocolCode

Write
Read

String

instrument data file.


Sets the code that indicates that a Protocol is

without prompting the user.

Filename and path to SSD file for entering data


after the capture has occurred.

Write

required.
.ProtocolCode = "P"

.ProtocolSend = chr(6)
String

.ProtocolReceive = chr(5)
Defines the protocol characters to be received.

ProtocolReceive

Read

ProtocolSend

Write
Read

String

Defines the protocol characters to send.

QCFailureBeeps

Write
Read

Long

.ProtocolSend = chr(6)
Number of speaker beeps to sound when a

.ProtocolReceive = chr(5)

Write

sample fails QC.


Example:
clsCCComm.QCFailureBeeps=5000

QCFailureWAVFile

Read

String

Write

Filename and path to a .WAV file to play when a


sample fails QC.
Example:
clsCCComm.QCFailureWAVFile=c:\winnt\media\URA
Loser.WAV

RecordHeaderLength

Read

Long

RecordLength

Write
Read

Long

RecordTrailerLength

Write
Read

Long

RepItems

Write
Read

ResultType

Write
Read
Write

String

The type of result to capture into. Values are:


"FINAL", "RAW", "WEIGHT". Final is the
weight/volumne/dilution corrected value, Raw is
the result from the instrument that will then be
weight corrected, and Weight is the catch weight
that will be used in weight correction.
Example: clsCCComm.ResultType=FINAL

199

Property

Mode

SampleFieldsItems

Read

Scheme

Write
Read

Security

Write
Read

Data

Description

Type

Object

Write

Provides access to the security object.


Example:
If clsCCComm.Security.IsConnected Then

StdItems

Read

TerminatorCode

Write
Read

String

Write

Specifies the terminator code for data


transmission.
Example:
clsCCComm.TerminatorCode=Chr(13) & Chr(10)

UnkItems

Read

Provides access to the unknown sample codes

WarningItems

Write
Read

collection.
Provides access to the instrument warning codes

WeightToVolumeCorrect

Write
Read

Boolean

Write

collection.
Specifies whether weight to volume correction
should be performed.
Example:
clsCCComm.WeightToVolumeCorrect=True

Workstation

Read
Only

String

Reads the computer name of the current


workstation. Read-only.
Example:
MsgBox clsCCComm.workstation

Methods
Method
CloseDataSource

Description
Closes the data capture source. If from a file, the file is closed. If the data

Form

capture source is from a COM port, the COM port is reset.


Load a pre or post SSD form for input by the operator. The code in the SCR
can set any of the valid objects and properties.
Usage: clsCCComm.Form sFilename
Example:
clsCCComm.Form "\\ASERVER\CCLASEL\CONFIG\STEEL.SCR"

GetFileCommunicationRecord
HideStatusWindow

Gets the next record from a file communication.


Hides the communications buffer status window.
Example:
clsCCComm.HideStatusWindow

IFFList
OpenDataSource

Returns a list of IFF files ?????


Opens the data capture data source, ie. COM port or file.
How to use

200

CCLAS 1.4

Method
PerformOnkey

Description
Send a string to the instrument based on the key pressed. Requires the
SetOnKeyItem properties set.
Usage: clsCCComm.PerformOnKey iKey
Argument: iKey The key that was pressed. eg. vbKeyF6 etc.
Example:
clsCCComm.PerformOnKey vbKeyF6
clsCCComm.PerformOnKey 13

PerformPreSSD
RewindFileCommunication

Executes a Form that allows user input.


Starts data capture from the beginning of a file. Must be used in conjunction
with SetFileCommunication clause.
Usage: clsCCComm.RewindFileCommunication
Example:
clsCCComm.SetFileCommunication "\\ASERVER\CCLASEL\DATA\LOI.TXT"
clsCCComm.RewindFileCommunication

SetBlkItem

Specifies the location within the record for the QC Blank Code and the code
against which a comparison is made with the input from the instrument in
order to determine if the sample is a QC Blank Sample.
Usage: clsCCComm.SetBlkItem lIndex, lStart, lEnd, sStr
Arguments:
lIndex Data item number (index)
iStart

Start position

IEnd

End position

sStr

QC Blank string

Example:
clsCCComm.SetBlkItem 1,15,17,"BLK"

SetCuid

Specify the positions to find the cuid.


Usage: clsCCComm.SetCuid lStart, lend, [sDef]
Arguments:
lStart

Start position within record

lEnd

End position

sDef

Specify a default cuid.

Example:
clsCCComm.SetCuid 1,20

SetCycles

Specify the position of the number of cycles.


Usage: clsCCComm.SetCycles lWidth, lStart, lEnd
Arguments:
iWidth Width in number of characters.
iStart

Start position

iEnd

End position

Example:
ClsCCComm.SetCycles 4,21,25

201

Method
SetDataItem

Description
Specify the position or location of data.
Usage: clsCCComm.SetDataItem lIndex, lStart, lEnd
Arguments:
lIndex Data item number (index)
lStart

Start position

IEnd

End position

Example:
clsCCComm.SetDataItem 1,26,55

SetDateAnalysedItem

Specify the position or location of the Date Analysed stamp.


Possible syntax
clsCCComm.SetDateAnalysedItem 26,55

SetDupItem

.SetDateAnalysedItem

"DAY",6,7

.SetDateAnalysedItem

"MONTH",8,9

.SetDateAnalysedItem

"YEAR",10,11

.SetDateAnalysedItem

"HOUR",12,13

.SetDateAnalysedItem

"MINUTE",14,15

.SetDateAnalysedItem "SECOND",16,17
Specifies the location within the record for the QC Duplicate Code and the
code against which a comparison is made with the input from the instrument
in order to determine if the sample is a QC Duplicate Sample.
Usage: clsCCComm.SetDupItem lIndex, lStart, lEnd, sStr
Arguments:
iIndex Data item number (index)
iStart

Start position

iEnd

End position

sStr

QC Code string

Example:
clsCCComm.SetDupItem 1,15,16,"D"

SetErrorItem

Specify the location within the data transmission for the error codes supplied
by the instrument.
Usage: clsCCComm.SetErrorItem lIndex, lStart, lEnd, sErrStr
Arguments:
lIndex Data item number (index)
lStart

Start position within the record of error string

IEnd

End position.

sErrStr The error string to search for.


Example:
clsCCComm.seterroritem 1,10,14,"ERR10"

202

CCLAS 1.4

Method
SetFileCommunication

Description
Specify the location of file for data transmission.
Usage: clsCCComm.SetFileCommunication sFile, [bPrompt]
Arguments:
sFile

Filename including full path

bPrompt

Optional. Prompt user.

Example:
sLecoFile="I:\cclasel\data\leco.txt"
clsCCComm.SetFileCommunication sLecoFile, False

SetIgnoreItem

Specify which records to ignore. Can be in a fixed position if specified.


Usage: clsCCComm.SetIgnoreItem lIndex, sCvar, [lStart], [lend]
Arguments:
lIndex Index number
sCvar The string to ignore in the record
[lStart] Optional. Start position
[lEnd]

Optional. End position

Example:
sIgnoreStr="Sample"
clsCCComm.SetIgnoreItem 1,sIgnoreStr

SetJob

Specify the job number.


Usage: clsCCComm.setjob lStart, lEnd, [sDefault]
Arguments:
lStart

Start position

lEnd

End position

[sDefault]

Optional. Specify a default job number

Example:
clsCCComm.SetJob 1,20

SetNameItem

Specify the analyte name.


Usage: clsCCComm.SetNameItem lIndex, lStart, lEnd, sName,
[bUppercase]
Arguments:
lIndex Index number
lStart

Start position

lEnd

End position

sName Specify the analyte name if not decoded from file


[bUpper]

Optional. Uppercase the analyte name.

Example:
clsCCComm.SetNameItem 1,50,59,"FE",True

203

Method
SetOnkeyItem

Description
Specify strings that will be sent to the instrument based on a key that is
pressed.
Usage: clsCCComm.SetOnKeyItem lKey, sString
Arguments:
lKey

The keycode to react to. This can be of the form vbKeyF1 or

vbKeyD etc.
sString The string to send to the instrument.
Example:
clsCCComm.SetOnKeyItem vbKeyF6, "S"
clsCCComm.SetOnKeyItem vbKeyF7, "D"

SetRepItem

The start and end position in the record for the QC Replicate Code and the
code against which a comparison is made with the input from the instrument
in order to determine if the sample is a QC Replicate Sample.
Usage: clsCCComm.SetRepItem lIndex, lStart, lEnd, sStr
Arguments:
lIndex Data item number (index)
iStart

Start position

iEnd

End position

sStr

QC Replicate string

Example:
clsCCComm.SetRepItem 1,15,16,"R"

SetSampleFieldsItem

Sets the various properties of the samples decoded.


Usage: clsCCComm. SetSampleFieldsItem sField, lStart, lEnd, sDefault,
sFieldType
Arguments:
sField The field name of the sample table (ie SAMPLETYPE,
SAMPLEIDENT etc)
iStart

Start position (0 to set the default)

iEnd

End position (0 to set the default)

sDefault
sStr

The default string if the position is empty.

QC Replicate string

Example:
.SetSampleFieldsItem "SAMPLETYPE", 0, 0, "UNK", "STRING"
.SetSampleFieldsItem "SAMPLEIDENT", 41, 60, "", "STRING"

204

CCLAS 1.4

Method
SetScheme

Description
Specify the scheme code.
Usage: clsCCComm.setscheme lStart, lEnd, [sDefault]
Arguments:
lStart

Start position

lEnd

End position

[sDefault]

Optional. Specify a default scheme code

If the Start and End positions are zero, then the default can be specified. If
the input between the Start and End position is blank, then the Default will
be assumed.
Examples:
clsCCComm.SetScheme 12,20
clsCCComm.SetScheme 0,0,"XRF1"

SetStdItem

The start and end position in the record for the QC Standard Code and the
string against which a comparison is made with the input from the
instrument in order to determine if the sample is a QC Standard.
Usage: clsCCComm.SetStdItem lIndex, lStart, lEnd, sStr
Arguments:
lIndex Data item number (index)
lStart

Start position

IEnd

End position

sStr

QC Standard string

Example:
clsCCComm.SetStdItem 1,15,16,"S"

SetUnkItem

The start and end position in the record for the unknown sample and the
string against which a comparison is made with the input from the
instrument in order to determine if the sample is an unknown.
Usage: clsCCComm.SetUnkItem lIndex, lStart, lEnd, sStr
Arguments:
lIndex Data item number (index)
lStart

Start position

IEnd

End position

sStr

Unknown string

Example:
clsCCComm.SetUnkItem 1,15,16,"U"

205

Method
SetWarningItem

Description
The start and end position in the record for the warning field and the string
that is generated by the instrument in the event of a warning, e.g., out of
calibration range. When the information decoded from the position indicated
matches that defined, then a warning message is generated.
Usage: clsCCComm.SetWarningItem lIndex, lStart, lEnd, sStr
Arguments:
lIndex Data item number (index)
lStart

Start position

IEnd

End position

sStr

The warning string

Example:
clsCCComm.SetWarningItem 1,15,18,"OVER"

ShowStatusWindow

Display what is in the Communication buffer.


Usage: clsCCComm.ShowStatusWindow [lTop], [lLeft], [lWidth], [lHeight]
Cordinates are in row and column units.
Example:
clsCCComm.ShowStatusWindow 10,20,30,40

Example 1:
Simple balance capture in MDE.
'
'
Globals
'
Option Explicit
'
'
IFF for MDE - simple balance interface
'
Sub Main ()
With clsCCComm
.AdvanceLockedSamples = True
.AdvanceSample = 0
.InstrumentName = "BAL1"
.TerminatorCode = chr(13) & chr(10)
.CommPort = 1
.CommPortSettings = "9600,O,7,1"
.SetDataItem 1,2,10
End With
End Sub

Example 2:
The following example demonstrates data capture using file communication.
Sub Main ()
clsCCComm.QCFailureWAVFile = "\\OSERVER\D\CCLASV5DEM\IFFSCRIPTS\OHNO.WAV"
With clsCCCOmm
.InstrumentName = "XRF2"
HandleError
.ResultType = "F"
HandleError
'
'
append modes:
'
0 - Never
'
1 - Manual
'
2 - Auto
'
.AutoAppendMode = 1

206

CCLAS 1.4

.AdvanceLockedSamples = True
.AutoProductCheck = True
.SetFileCommunication "\\OSERVER\D\CCLASV5DEM\IFFSCRIPTS\XRF2.DAT", False
HandleError
.TerminatorCode = Chr(13) & Chr(10)
HandleError
.SetIgnoreItem 1, "----", 0, 0
HandleError
.SetIgnoreItem 2, "Sample", 0, 0
HandleError
'
'
'

Items
.SetJob 1,10
.SetScheme 12,14
.SetCuid 16,25
.SetNameItem 1,0,0,"FEX", True
.SetNameItem 2,0,0,"SIX", True
.SetNameItem 3,0,0,"ALX", True
.SetNameItem 4,0,0,"SX", True
.SetNameItem 5,0,0,"CAX", True
.SetNameItem 6,0,0,"TIX", True
.SetNameItem 7,0,0,"MNX", True
.SetNameItem 8,0,0,"MGX", True

'
.SetDataItem
.SetDataItem
.SetDataItem
.SetDataItem
.SetDataItem
.SetDataItem
.SetDataItem
.SetDataItem

1,26,35
2,36,45
3,46,55
4,56,65
5,66,75
6,76,85
7,86,95
8,96,105

End With
End Sub
'
'
Sub HandleError ()
If err.number <> 0 Then
MsgBox Err.Description, vbOKOnly, "Handled Error"
End If
err.clear
End Sub

Example 3:
The following example will register a sample manually if it comes across a sample that does not exist in the
job.
Sub Main ()
clsCCComm.QCFailureWAVFile = "\\OSERVER\D\CCLASV5DEM\IFFSCRIPTS\OHNO.WAV"
With clsCCCOmm
.InstrumentName = "LOI2"
HandleError
.ResultType = "F"
HandleError
'
'
append modes:
'
0 - Never
'
1 - Manual
'
2 - Auto
'
.AutoAppendMode = 1
.AdvanceLockedSamples = True
.AutoProductCheck = True
.SetFileCommunication "\\OSERVER\D\CCLASV5DEM\IFFSCRIPTS\LOI.DAT", False
HandleError
.TerminatorCode = Chr(13) & Chr(10)
HandleError
'
'
Items
'
.SetJob 1,10
.SetScheme 12,14

207

.SetSampleFieldsItem "SAMPLETYPE", 0, 0, "UNK", "STRING"


.SetSampleFieldsItem "SAMPLEIDENT", 16, 29, "", "STRING"
'
.SetNameItem
.SetNameItem
.SetNameItem
.SetNameItem

1,0,0,"WT1",
2,0,0,"WT2",
3,0,0,"WT3",
4,0,0,"WT4",

True
True
True
True

'
.SetDataItem 1,26,35
.SetDataItem 2,36,45
.SetDataItem 3,46,55
.SetDataItem 4,56,65
'.SetDataItem 5,66,75
'.SetDataItem 6,76,85
'.SetDataItem 7,86,95
'.SetDataItem 8,96,105
End With
clsCCCOmm.ShowStatusWindow 100,100,1000,4000
End Sub
'
'
Sub HandleError ()
If err.number <> 0 Then
MsgBox Err.Description, vbOKOnly, "Handled Error"
End If
err.clear
End Sub

208

CCLAS 1.4

Example 4:
The following example uses cycles to decode the elements and data via file. This would typically be a noninteractive session of SAMANA.
Sub Main ()
'
clsCCComm.QCFailureWAVFile = "\\OSERVER\D\CCLASV5DEM\IFFSCRIPTS\OHNO.WAV"
clsCCComm.FileDelay = 1
With clsCCCOmm
.InstrumentName = "SAM"
HandleError
.ResultType = "F"
HandleError
'
'
append modes:
'
0 - Never
'
1 - Manual
'
2 - Auto
'
.AutoAppendMode = 1
.AdvanceLockedSamples = True
.AutoProductCheck = True
.AutoUpdate = True
.NewFileCommunication = "\\OSERVER\D\CCLASV5DEM\BIN\COLLECT.DAT"
'
.SetFileCommunication "\\OSERVER\D\CCLASV5DEM\BIN\COLLECT.DAT", False
HandleError
.TerminatorCode = Chr(13) & Chr(10)
HandleError
.SetIgnoreItem 1, "----", 0, 0
HandleError
.SetIgnoreItem 2, "Sample", 0, 0
HandleError
'
'
Items
'
.SetJob 1,20
.SetScheme 41,50
.SetCuid 21,40
.SetCycles 20,51,60
.CycleWidth = 20
.SetCycles 17,21,23
'
.SetNameItem 1,61,70,"", True
'
.SetDataItem 1,71,80
End With
End Sub
'
'
Sub HandleError ()
If err.number <> 0 Then
MsgBox Err.Description, vbOKOnly, "Handled Error"
End If
err.clear
End Sub

Example 5:
The following example uses a generic IFF file that starts a form to request some details.
Generic.VBS

(IFF)

'
'
Globals
'
Option Explicit
Sub Main ()
clsCCComm.InstrumentName = ""
'
if clsCCComm.Workstation <> "GC733" Then
clsCCComm.Form "I:\CCLASV5ORA\IFFSCRIPTS\GENERIC.SCR"
'
else
'
clsCCComm.InstrumentName = clsCCComm.Workstation

209

'

end if
if len(rtrim(ltrim(clsCCComm.InstrumentName))) = 0 then
msgbox "Must Select Instrument"
else
SetInst clsCCComm.InstrumentName
end if

End Sub
'
'
Sub SetInst(sInstName)
On Error Resume Next
clsCCComm.ResultType = "W"
With clsCCCOmm
.AdvanceLockedSamples = True
.AdvanceSample = 0
.TerminatorCode = chr(13) & chr(10)
.CommPort = 1
HandleError ()
.CommPortSettings = "9600,N,8,1"
HandleError ()
.SetDataItem 1,1,10
HandleError ()
End With
End Sub
Sub HandleError ()
If err.number <> 0 Then
MsgBox Err.Description, vbokonly, "Error BAL1.VBS"
End If
err.clear
End Sub
and Generic.SCR (Form)
'FORM,0,0,5000,4000,1
'LISTBOX,lstInstCode,,,,240,150,3120,3345,,,,,,
'COMMANDBUTTON,cmdOK,,OK,,240,3390,1410,360,,,,,,
'COMMANDBUTTON,cmdCancel,,Cancel,,735,3390,1410,360,,,,,,
Sub Form_Load ()
Form.Top = 1000
Form.Left = 1000
lstInstCode.AddItem "AAS1"
lstInstCode.AddItem "AAS2"
lstInstCode.AddItem "AAS3"
lstInstCode.AddItem "AAS4"
lstInstCode.AddItem "AAS5"
End Sub
Sub cmdCancel_Click()
on error resume next
clsCCComm.InstrumentName = ""
Form.Hide
End Sub
Sub cmdOK_click
on error resume next
clsCCComm.InstrumentName = lstInstCode.Text
Form.Hide
End Sub
Sub lstInstCode_DblClick()
cmdOK_Click
End Sub

What is wrong when


Question:
When I click on Database Diagrams, I get the following message:

210

CCLAS 1.4

Answer:
As the message says, the database does not have a valid owner. This happens if you install a database and
does not link an owner, or when you restore a database from another server where the owner on the original
server, does not correspond with the owner on the restoring server.
To fix this, right-click on the database you want to change the owner for, and select Properties:

In the left pane, select the Options option.

211

Sometimes the Compatibility level is still set to the older version of SQL the original database comes from
so set it to SQL Server 2005.
Now click on the Files option in the left pane:

212

CCLAS 1.4

Here you can set to Owner of the database to the new profile that has to be the owner. How do I do that?
Question:
When I try to add CCLASMGR as a user to my database, I get the following message:

Answer:
CCLASMGR already exists in the database as a user. But you may find that you still cannot log into CCLAS
using CCLASMGR! The problem is that, even though CCLASMGR exists, the password assigned to
CCLASMGR on the previous server, is not the same as the password assigned to CCLASMGR on the
current server. So what does one do?

213

In your database, you first have to remove CCLASMGR from your security. Let us first create another error:

Expand your Database, expand Security and expand Users. Select the CCLASMGR user and press Delete:
When you click on OK on the following screen, either CCLASMGR will delete, or the following screen
appears:

214

CCLAS 1.4

which indicates that you could not delete the CCLASMGR user. If this happens, you first have to check if
CCLASMGR is also one of the Schemas in the database:
Expand you database, expand Security and expand Schemas:

215

As you may see in the screen capture, CCLASMGR is a Schema. So let us delete that first select
CCLASMGR, and press the Delete key.
The following screen will appear:

Click on OK to delete CCLASMGR as a Schema.


Now you will be able to delete CCLASMGR as a user, and add the correct CCLASMGR as a user again.
Question:
When I try to log onto CCLAS, I get the following message:

Answer:
One of a few things may be wrong:

216

Your CCLAS.INI file is faulty


Your Server does not have enough licences.

CCLAS 1.4

217

You are not connected to the network


Your Access Level for the specific module you want to open, is set to 0.

Vous aimerez peut-être aussi