Creating your own bar code functions

The bar code functions provided in our Lotus Script library are usually sufficient for the vast majority of bar code projects. However, it is easy to create additional bar code functions for special applications.

IMPORTANT: Bar code functions you create, will rely on our; functions, components and fonts. Please remember that a license is required for every user of any Lotus Notes application that uses the library, or produces bar codes, or uses any part of JIT-NOT.

See: Distributing your solutions which print bar codes

Why do I need to create my own bar code functions?

Often data used in businesses must be formatted in a special way, especially when it is printed as bar codes. For example, although dates are usually displayed like 01/01/2002 on screen, in bar codes dates are usually represented like 20000101 (i.e. yyyymmdd format).

Formatted data is used in many different parts of most businesses, and in different parts of your Lotus Notes database, so it is wise to use one central function whenever a type of data is format.

Errors are reduced because code is not duplicated, and your database is simplified.

Use the existing bar code functions, in the supplied Lotus Script library, as examples. For example, if you examine function CIA_ITF, you can see this bar code function contains just one line of code;

' Interleaved 2-of-5 bar code. Use 'CIA ITF...' fonts.
Public Function CIA_ITF(Msg As String)

  CIA_ITF = CIA_BCP("ITF-0.B", Msg)

End Function

To get the bar code result, function CIA_ITF( ) calls function CIA_BCP( ).

Function CIA_BCP( ) can be used to return any bar code type you require, by using a string argument to define the bar code type you require.

For example, the following string is used to return an ITF (Interleaved 2 of 5) bar code with added check character;

"ITF-0.BA"

See: Specifying a bar code type to discover other strings you can use to return different bar codes.

See: Printing check characters to discover how check character options can be specified.

See: Printing human-readable characters to discover how to create human-readable text.

See: Bar code options / formats to discover how you can select special features of each bar code type.


Example of a new function

If you want to print human-readable text below ITF (Interleaved 2 of 5) bar codes, and you want the text to include the added check character, you can write this function;

Public Function MY_ITF_HUMAN (Msg As String)
  MY_ITF_HUMAN = CIA_BCP("ITF-0.HA", Msg)
End Function

CIA_BCP( ) returns human-readable text, if character H is used in the string argument which defines the bar code type.

Use your new MY_ITF_HUMAN function to print human-readable text underneath ITF (Interleaved 2 of 5) bar codes.

Use two separate expressions to print a complete bar code with human-readable text underneath, like this;

Function Results
CIA_ITF_A("123456")
MY_ITF_HUMAN("123456")
01234565

The CIA ITF Medium font (size 14 point) was used to print the bar code, and the Arial Bold font (size 8 point) was used to print the human-readable characters (although any regular text font can be used; Arial, Courier, Times, etc.)

01234565

Human-readable characters are usually printed underneath bar codes, but because we are using two separate items to print the bar code and the text, the text can be printed on top, or somewhere else, and at any size or orientation.

Note: You can instantly see, from the human-readable text, that 5 has been added as a bar code check character. Also, because ITF (Interleaved 2 of 5) bar codes must be an even length, a leading 0 has also been automatically added to the front.

 

 


Copyright 2000 CIA (BAR CODES) UK. All rights reserved. Reproduction prohibited.