CODESOFT 9 Tutorial (PDFDrive)
CODESOFT 9 Tutorial (PDFDrive)
TUTORIAL
The information contained in this guide is not of a contractual nature and may be subject to change
without prior notice.
The software described in this guide is sold under a license agreement. The software may be used, copied
or reproduced only in accordance with the terms of theagreement.
No part of this guide may be copied, reproduced or transmitted in any form, by any mea ns or fo r any
purpose other than the purchaser’s own use without the written permission of Teklynx Newco SAS.
ii
About this manual
Typographical conventions
This manual distinguishes between different types of information using the following conventions:
Terms taken from the interface itself, such as commands, appear in bold.
Key names appear in all caps. For example: ''Press the SHIFT key''.
When the conjunction -or- appears next to a paragraph, it means there is the choice of another
procedure for carrying out a given task.
When a menu command contains submenus, the menu name followed by the command to select
appears in bold. Thus, ''Go to File > Open'' means choose the File menu then the Open command.
Some of the functions described in this manual may not be available in your product.
For the complete list of specific features available in your software, refer to the specification sheet provided
with the product.
Table of contents
CONNECTING TO DATABASE........................................................................................................................ 1
A FEW REMINDER.................................................................................................................................................. 1
DATABASE MANAGER................................................................................................................................... 11
Remove a filter................................................................................................................................................ 17
FORMULAS........................................................................................................................................................ 19
OPERATORS ........................................................................................................................................................ 19
iv
About this manual
DESCRIPTION ...................................................................................................................................................... 29
CONFIGURATION ................................................................................................................................................. 31
v
Connecting to database
A few reminders
In this chapter we are going to link a label (the container) with a database (the content). To do this, we will use
ODBC (Open DataBase Connectivity) or OLE DB connections.
Databases allow you to store data. All data is organized into two-dimensional tables in what is called a
relationship. Each row in a table is called a record. The purpose of a record is to manage an object, the
properties of which are organized across the different columns of the table in the form of fields.
A database can contain a number of tables. To link the different tables within a given database, we use joins. A
concrete example later in this chapter demonstrates how joins are created.
ODBC
ODBC data sources make it possible to access data belonging to a wide range of database management
systems. ODBC makes it easy to link an application such as your label design software with a certain number of
databases. The software comes with several ODBC drivers.
OLE DB
OLE DB is a set of interfaces that gives access to all data, regardless of type, format or location. It provides
components such as access interfaces, query drivers, and so on. These components are called "providers".
Practical Workshop 1
The example below describes a connection process when a database is not connected to your software.
The process described below uses the direct creation mode. If you want, you can use the Wizard by selecting
Wizard in the context menu.
Note: You can define data sources with system Data Sources Names (DSNs). These data sources are unique to
a specific computer but not to a specific user. Any user with the necessary rights can access a system DSN.
4. Enter ''TK Training CS Level 2'' in the Data source name box.
5. Click Select and select the database TKTraining.mdb, located in the InstallDir\Samples\Form\Tutorial.
6. Click the Options button. Check the Read Only option. This option makes it possible to open the
database at the same time as Codesoft without causing any read/write problems.
Importing data
When the database is connected to your software, you have to connect it to your document.
6. Click the button. It allows the selected records to be sorted into alphabetical or numeric order,
Ascending, or Descending.
7. Select "Reference" as the Sort Key and "Ascending" as the Sort Order.
9. Click OK.
The variables are created automatically and are listed in the Database branch in the Data sources
view.
To view or print the different values that your object can take, use the navigation bar. You can also print from
the Query result window.
2
Connecting to database
1. Select the created variables listed in the Database branch in the Data sources view, then drag and
drop it into the workspace.
2. Select Text in the context menu.
1. Select the data source from the Select data source list.
Note: To create a new data source, click the New data source button. This gives you the option of
using the Wizard or choosing between an ODBC or OLEDB data source.
2. By default, Standard creation mode is activated. However to carry out a table lookup, you can use
Advanced creation mode: SQL.
3. In the Select table list, select a table where the search is to be carried out.
4. In the Select result field list, select the field whose value is to be transferred into your variable.
6. Select the field in the external table on which the search is to be carried out.
- or -
Click SQL Query Builder to access Query Builder. This provides an easy-to-use interface for building
SQL database queries. You can create new requests or represent existing requests graphically in your
applications.
3
5. Click the Test button to display the result in the Query dialog box.
Query Builder
Active Query Builder is a visual query builder component that allows you to build complex SQL queries via an
intuitive visual query building interface.
To work with Active Query Builder, you need basic knowledge of SQL concepts. Active Query Builder will help
you to write correct SQL code hiding technical details, but only understanding of the SQL principles will make it
possible to achieve desired results.
Getting started
The Query Building Area is the main area where the visual representation of query will be displayed.
This area allows you to define source database objects and derived tables, define links between them
and configure properties of tables and links.
The Columns Pane is located below the query building area. It is used to perform all necessary
operations with query output columns and expressions. Here you can define field aliases, sorting and
grouping, and define criteria.
The Query Tree Pane is located at the left. Here you may browse your query and quickly locate any
part of it.
4
Connecting to database
The page control above the query building area will allow you to switch between the main query and
sub-queries.
The small area in the corner of the query building area with the "Q" letter is the union sub-query
handling control. Here you may add new union sub-queries and perform all necessary operations with
them.
To add an object to the query right click the query building area and select the Add Object item in the drop-
down menu.
5
The Add New Object window allows you to add as many objects as you wish at once. The objects are grouped
according to their type by four tabs: Tables, Views, Procedures (Functions) and Synonyms. You may select
one or several objects by holding the Ctrl key and then press the Add Object button to add these objects to
the query. You may repeat this operation several times. After you finish adding objects, press the Close button
to hide this window.
To remove an object from the query, select it and press the Del key or simply click the Close button in the
object header.
For those servers that have schemas or allow selection of objects from different databases, you may filter
objects by database or schema name by selecting the necessary schema or database from the combo box at
the top of the window.
Active Query Builder can establish links between tables based on the information about foreign keys in the
database. This ability is turned on by default. To turn it off, uncheck the Create links from foreign keys
checkbox.
You may change the properties of each object added to the query by right clicking the object and selecting the
Edit... item from the drop-down menu or simply by double-clicking the object header.
6
Connecting to database
The Datasource Properties dialog may vary from server to server, but at least the Alias property is the same
for all database servers.
Joining tables
To create a link between two objects (i.e. join them) you should select the field by which you want to link the
object with another and drag it to the corresponding field of the other object. After you finish dragging, a line
connecting the linked fields will appear.
The join type created by default is INNER JOIN, i.e. only matching records of both tables will be included in the
resulting dataset. To define other types of joins you should right click the link and select the Edit... item in the
7
drop down menu or simply double-click it to open the Link Properties dialog. This dialog allows you to define
join type and other link properties.
To remove a link between objects, right-click the link line and select the Remove item in the drop-down menu.
To enable sorting of output query fields you should use the Sort Type and Sort Order columns of the
Columns Pane.
The Sort Type column allows you to specify the way the fields will be sorted - in the Ascending or
Descending order.
The Sort Order column allows you to setup the order in which fields will be sorted, if more than one field will
be sorted.
To disable sorting by some field you should clear the Sort Type column for this field.
Defining criteria
To define criteria for the expression listed in the Columns Pane you must use the Criteria column.
There you should write the criterion omitting the expression itself. To get the following criterion in your query
8
Connecting to database
You may specify several criteria for a single expression using the Or... columns. These criteria will be
concatenated in the query using the OR operator.
Query Builder lets you create a parameterized query where the value of the parameter is held in a variable.
1. Drag and drop the table on which your query is to be carried out.
2. Select the field(s) to which the criterion or criteria is/are to apply.
3. In the Criterion column or in the SQL-format edit field, specify the variable to be used as the object
of a search criterion.
Example: To look for the value of the variable Var0 which you created beforehand:
In SQL:
SELECT [Table].*
FROM [Table]
Criterion column
= APPLICATION.DOCUMENT.Var0
To access the Query result grid, click the button in the Defining a query dialog box, in the Merge
database browser toolbar or via the Data source > Database menu.
This grid allows the result of a query to be displayed, or to search for a particular term and all its occurrences
and print the corresponding labels.
Search functions
Search field, allowing the field in which the search will be carried out in to be entered.
Search for the value anywhere in the field or at the start of the field .
First record
9
Previous record
Next record
Last record
Requery
Requery the request and update the grid.
10
Database Manager
The Database Structure window is used to manage the structure of the database file: to add, modify or delete
tables/ fields etc.
You can also copy the structure of the table from a table that already exists in the selected database. To do so:
12
Database Manager
2. Click Apply.
4. Click Apply.
3. Click Apply.
13
Edit Database window
The Edit Database window is used to manage the contents of the database file: to add, modify or delete data.
These actions depend on the type of database. Thus, Excel file records cannot be modified.
14
Database Manager
At least one record must have been found. There must be several identical contents in the search field.
To select a record, use the search tool: click on 1 (First), 2 (Previous), 3 (Next) or 4 (Following).
Modify a record
Delete a record
15
Database Query window
The Database Query window is used to create and apply various filters.
Add a query
16
Database Manager
Remove a filter
17
The Print window
The Print window is used to select files for printing, to assign printers and to define various parameters before
printing is launched.
- or -
Note: Creating a label in relation to the database allows you to define exactly which elements are required to
position each database field.
Note: The ''Field'' radio buttons in the ''Label name'' and ''Printer name'' groups of options allow you to choose
the label or printer required, when the latter are defined in one of the fields of the active database.
If your Database contains the name of the label to be used for the printing job in one of the fields, you can
define this field as being the place where Database Manager is going to pick up the .lab file.
Select a printer
18
Formulas
The Formula data source contains a list of data sources you have created. These data sources are populated
by combinations of operators, constants, data sources, control variables, formulas, and functions. Data can be
numeric or alphanumeric.
In order to carry out a calculation within a document, you must first create a Formula data source.
This data source has a specific dialog box allowing you to define the required function(s) for a given formula.
About functions
Functions are predefined formulas that carry out calculations by using particular values called arguments, in a
certain order, called syntax.
Functions are used to return a numeric, character string, or logical value - the result of a calculation or an
operation.
Conversion functions
Logical functions
Mathematical functions
Operators
Operators are mathematical symbols indicating an operation to be carried out. There are different types of
operators: arithmetic, comparative, concatenation and logical.
Arithmetic operators
% Modulo.
Comparative operators
Operator Meaning
= Equal to.
Concatenation operator
Operator Meaning
Logical operator
Operator Meaning
! Not logical.
Mathematical functions
int (value): Returns the largest integer less than or equal to the value argument.
Examples:
int (-5.863) = -6
int (5.863) = 5
mod (val_1, val_2): Returns the remainder of the division of the val_1 argument by the val_2 argument. The
result has the same sign as the divisor.
Examples:
mod (7,2) = 1
mod (-7,2) = -1
mod (7,-2) = 1
mod (-7,-2) = -1
quotient (val_1, val_2): Returns the integer result of the division of the val_1 argument by the val_2
argument.
round (val_1, val_2): Returns the argument val_1 rounded to the number of figures indicated by val_2.
20
Formulas
If val_2 is less than 0, val_1 is rounded off to the left of the decimal point.
Examples:
round (4.25,1) = 4.3
round (1.449, 1) = 1.4
round (42.6,-1) = 40
Examples
If the field named Base 16 contains the string "0123456789ABCDEF"
BASE10TOBASEX(Base16, 12) produces C
BASE10TOBASEX(Base16,10) produces A
BASE10TOBASEX("012345","9") produces 13
Note: This formula cannot accept negative decimal numbers for ''string_2'' parameter.
Examples
If the field named Base 16 contains the string "0123456789ABCDEF"
BASEXTOBASE10(Base16, "E") produces 14
BASEXTOBASE10(Base16,10) produces A
BASEXTOBASE10("012345","9") produces 13
hex(val_1,val_2): Converts the val_1 decimal number to hexadecimal format with a total value of val_2
Note: This formula cannot accept negative decimal numbers for ''val_1'' parameter.
Logical functions
Logical functions allow you to check whether one or more conditions have been fulfilled.
and (expr_1, expr_2): Returns TRUE if both arguments are true, FALSE if at least one is false. The
arguments must be calculated from logical values.
Example:
and(exact("string","string"),exact("string","string")) = 0
and(exact("string","string"),exact("string","string")) = 1
exact (string_1, string_2): Returns TRUE if the two strings are identical, FALSE if not. This function is case-
sensitive.
21
Example:
exact("software","software") = 1
exact("software","software") = 0
if (expr, Val_if_true, Val_if_false): Returns the Val_if_true value if Expr is true and the Val_if_false
argument if Expr is false.
Example:
if(exact("string", "string"), "true", "false") = false
if(exact("string", "string"), "true", "false") = true
Example:
not(exact("string", "string")) = 1
not(exact("string", "string")) = 0
not(False) = 1 or not(0) = 1
not(True) = 0 or not(1) = 0
not(1+1=2) = 0
or (expr_1, expr_2): Returns TRUE if one of the two arguments is true and FALSE if both arguments are
false. The arguments must be calculated from logical values.
Example:
or(exact("string", "string"),exact("string", "string")) = 0
or(exact("string", "string"),exact("string", "string")) = 1
or(true,true) = 1 or or(1,1) = 1
or(true,false) = 1 or or(1,0) = 1
or(false,false)= 0 or or(0,0) = 0
Text functions
A character string can be assimilated into a table if each box contains a character. It is defined by its length
(total number of characters in the string, including spaces). The position of a character in the string
corresponds to its place in the table. For example, the first character is at position one.
cyclebasex ( ): Allows counting to take place in any kind of database counting system. The numbering system
must be defined within the linked expression. The start value, the value of each increment and the number of
copies must also be specified for each number. All these values can be linked to other fields in the label, but the
field names must not be enclosed in quotation marks.
Example:
If a field named Base 16 contains the character string 0123456789ABCDEF, then:
cyclebasex(base16, "8", 1 ,1) = 8,9,A,B,C…
cyclebasex(base16, "F", -1,1) = F,E,D,C,B,A 9,8,7…
22
Formulas
Example:
cyclechar("A", "C") = A B C A B C A B C …
cyclechar("A", "C", 1,2) = A A B B C C A A B B …
cyclenumber ( ): Allows you to set your own sequence of numbers, instead of using the normal sequence of
numbers or letters (0,1,2… or A,B,C…).
Example:
cyclenumber(1,3) will produce labels in the following sequence: 1 2 3 1 2 3 1 2 3...
cyclenumber(1,3,1,2) will produce labels in the following sequence: 1 1 2 2 3 3 2 2 1 1...
cyclestring ( ): Allows you to create a group of words or characters using a complete cycle as an increment
field. The whole string must be enclosed in quotation marks (" ") and each word or group of characters must be
separated from the others by a semicolon ( ; ).
Example:
cyclestring("Mon ; Tue ; Wed ; Thu ; Fri ; Sat ; Sun") = Mon Tue Wed Thu Fri Sat Sun
The following example is for labels that use all letters of the alphabet except for O and I.
cyclestring("A;B;C;D;E;F;G;H;J;K;L;M;N;P;Q;R;ST;U;V;W;X;Y;Z")
exact (string_1, string_2): Returns TRUE if the two strings are identical, FALSE if not.
Example:
exact("software","software") = 1
exact("sftware","software") = 0
extract («string», «sep», «pos»): Returns the substring from the character string «string» at the specified
position «pos» that contains data separated by string «sep».
Example:
Extract("1;2;3;4", ";", 3) = 3
find (string, key, start): Returns the position of the first occurrence of the key argument in the string
argument. The search in the string argument starts from the position returned by the start argument (start >=
1). The function resets to zero if no occurrence of the key argument is found. The function distinguishes
between upper and lower case letters.
Example:
find("Peter McPeepert","P",1) = 1
find("Peter McPeepert","p",1) = 12
23
left (string, num_char): Returns the character string extracted from the string argument. This string starts
at position one of the string argument and has a length equal to the num_char argument.
Example:
left("Peter McPeepert",1) = P
left("Peter McPeepert ",5) = Peter
len (string): Gives the length of the string argument. Spaces are counted as characters.
Example:
len("Paris, New York") = 15
len("") = 0
len(" ") = 1
lower (string): Converts all upper case letters in a text string into lower case letters.
Example:
lower("Paris, New York") = paris, new york
mid (string, start, num_char): Returns the character string extracted from the string argument. This string
starts at the position corresponding to the value of the start argument (start >=1) and has a length equal to
the num_char argument.
Example:
mid("Paris, New York",8,8) = New York
pad ( ): Adds characters to the left of the field to assign a predefined length to the whole input. Any character
can be selected as a padding character.
Example:
If a field named GREETING displays a value HELLO, then:
pad(GREETING,8,0) = 000HELLO
pad(5,3,0) = 005
pad(''Nine'',6,"a") = aaNine
replace (string, start, num_char, new_string): Returns the converted string argument. A number (equal to
the num_char argument) of characters from the position defined in the start argument has been replaced by
the new_string argument.
Example:
replace("Paris, New York",8,8,"Singapore") = Paris, Singapore
Example:
ReplaceString( "abc12def12", "12", "") = abcdef
24
Formulas
rept (string, num_char): Returns the character string where the string argument is repeated the number of
times in the num_char argument.
Example:
rept("Ah Paris! ",2) = Ah Paris! Ah Paris!
right (string, num_char): Gives the character string composed of the last characters of the string and has a
length equal to the num_char argument.
Example:
right("Purchase order",5) = order
search (string, key, start): Gives the position of the first occurrence of the key argument in the string
argument. The search starts from the position defined by the start argument (start >= 1). The function resets
to zero if no occurrence of the key argument is found.
Example:
search("Purchase order","order,1) = 10
search("Purchase order","c",1) = 4
trim (string): Returns the converted string argument. All spaces encountered at the beginning and end of the
string are deleted. The number of spaces included between two words is reduced to one.
Example:
trim(" Purchase order") = Purchase order
trimall (string): Returns the converted string argument. All spaces encountered are deleted.
Example:
trimall("Paris / New York / Rome") = Paris/NewYork/Rome
Example:
upper("Purchase order") = PURCHASE ORDER
ztrim ( ): Deletes all zeros, starting from the left, in fields that are entirely numerical.
Example:
If a field named WEIGHT displays a value of 000200, then:
ztrim(weight) = 200
- or -
25
Select the elements of your choice, then click Insert.
2. Click Test to verify that the syntax is correct. If an error occurs, follow the instructions displayed on
the screen and carry out any necessary changes.
3. Click OK.
Note: If a variable used in the formula has a name containing one of the following characters &+-
*/<>=^%,!\", it must be enclosed in brackets {}.
Note: You can check your formula by clicking Test. If the message displays the formula value, it means that
your formula is correct. If the value is not correct, follow the instructions displayed on the screen to carry out
the necessary modifications.
If the value obtained is truncated, you must modify the maximum length specified in the Output tab.
The production label must show the price of the product as a function of its weight and the price per kilogram.
Demonstration: Adding the "Warning" Formula variable for displaying a warning message
In the following sequence, we will create a formula to display a warning message telling the user that the value
of the Total_Weight shared variable exceeds 1,000kg.
If the weight value exceeds 1,000kg, the message ''Attention! Error! Total Weight exceeds maximum!'' will
appear.
26
Formulas
Returns one value if the condition you specify is TRUE, and another value if it is FALSE.
Use the IF function to carry out conditional tests on values and formulas.
Syntax
if("expr","val_if_true","val_if_false”) ”expr" represents any value or expression, the result of which can be TRUE
or FALSE.
val_if_true is the value returned if "expr" is TRUE. The val_if_true argument can be another formula.
val_if_false is the value returned if "expr" is FALSE. The val_if_false argument can be another formula.
In this workshop we will convert the ''Customer_Code'' EAN8 barcode into a 2/5 Interleaved barcode using the
"Formula_4_NewCustCode" Formula data source.
Symbology: printer,
Height: 4mm,
Ratio: 2,
Create the Formula_1_Weighted formula, bearing in mind that the first character of Customer_Code is
multiplied by 1, the second by 2, the third by 1, the fourth by 2, and so on.
Formula_1_Weighted:
mid(Customer_Code,1,1)*1&mid(Customer_Code,2,1)*2&mid(Customer_Code,3,1)
1&mid(Customer_Code,4,1)*2
27
To add up the result of the weight calculation:
The next step involves adding together the figures resulting from the previous formula, bearing in mind that the
maximum permitted length of this character string is 2.
Using the previous result, we will now calculate the value of the check digit.
When creating the barcode you must include the data to be encoded, for example, the value of the
Customer_Code variable concatenated with the value of the check digit (Formula_3_CheckDigit).
Create a fourth formula and name it Formula_4_NewCustCode. This formula is the result of concatenating
Customer_Code and Formula_3_CheckDigit.
1. Select the Formula_4_NewCustCode formula then drag and drop it into the label over the
Customer_Code barcode.
2. Define the properties of the barcode.
28
Installing the network version
Description
To use the network/multi-user version of Codesoft, you must first install Network and Users Utilities either on
the server or on a workstation that will act as the server, then install your labeling software on each
workstation.
The dongle must be installed on the computer (server or workstation) on which the license manager is installed.
A single dongle, pre-programmed with the number of licenses purchased, is included with the network version
of your software.
The dongle must be installed before the license manager (License Manager or Service) can be started.
Note: When you start the program, if the dongle does not match the product version, a dialog box with the
necessary instructions is displayed.
If you need to use a printer on the parallel port, connect it to the dongle. In this case, you might have to turn
the printer on in order for the dongle to be recognized.
Installation procedure
Network configuration
Before you install the software, the network administrator must first define the structure of the network for the
group of users, specifically:
Define the license server on which the Network and Users Utilities and dongle will be installed.
Define the workstations, or the client workstations that will use the labeling software.
The Network and Users Utilities lets you use the network configuration of your labeling software. Network
Manager includes:
Network Settings Wizard: The Network Settings Wizard helps you define the network
configuration.
User Manager: The User Manager is installed with the Network and Users Utilities so you can
define access rights to the labeling software in a network setting.
Before installing the labeling software on all the workstations that will use it, you must install the Network and
User Utilities on the server to configure the network.
Users wanting Write Access to the Network Licence must be dually given the rights by:
1. Sharing the TKDongle folder and authorizing the user: C:\Documents and Settings\All Users\Application
Data\Teklynx\LicenseManager\ TKDongle (Vista: C:\Program Data\Teklynx\LicenseManager\TKDongle) > Right-
30
Installing the network version
2. Give Write Access to the user in the Security tab of the TKDongle properties
Configuration
All the necessary tools to configure the network version are available from the ''Network'' tool bar accessible
from by going to Start > Programs > Teklynx > Network and Users Utilities and selecting Network.
The Network Settings Wizard helps you define the settings for your network version.
Generic: All users will use the same settings on all workstations. (user.ini).
By user: Each user can access his or her own settings on any workstation. (user name.ini).
3. In step 2, specify the location in which you want to store these settings. If you want to share these
settings between various workstations, specify a network path accessible to all workstations.
4. In step 3, specify the location in which you want to store the shared data (variables, lists, printing
logfile, etc.).
If you want to define network access rights for all users of the labeling software, you must do so during
installation (consult the User Manager help system).
Before installing the labeling software on all workstations, you must start the License Manager.
If the License Manager was installed as Service, you do not need to start it. In fact, Service starts when the
workstation is turned on and runs as a background task as long as the workstation is on. However, if you
installed the License Manager, you must start it manually.
Click the icon available on the Network toolbar -or double-click the SLICENSECTRL.EXE file in the [DONGLE]
folder in C:\PROGRAM FILES\TEKLYNX\9\COMMON\TOOLS\
Note: To start License Manager automatically when a Windows session is started, copy the shortcut for the
program to the Start > Programs > Startup menu in Windows.
31
Installing the software on the workstations
The labeling software must be installed on all the workstations on which it will be used.
32
United States France Germany Singapore China Japan
1-414-837-4800 33-562-601-080 49-6103-30026-0 65-6477-7293 86-21-6100-6588 81-45-461-3603
Copyright 2012 Teklynx Newco SAS. All rights reserved. Printed in the USA 06/12. TEKLYNX and CODESOFT are trademarks of Teklynx Newco SAS. All
other brands and product names are trademarks of their respective owners.
www.teklynx.com