The bar code functions in our products are usually sufficient for the vast majority of bar code projects.
See: Bar code functions for the standard set of bar code functions.
It is easy to create additional bar code functions for special applications. Often a new function is merely used to format your data before it is bar coded.
|Note: Bar code functions you create, will rely on our; functions, components and fonts. If you distribute your new function, you must purchase a license for each person who will print bar codes.|
Functions are entered as Project Methods. This sections shows you how to create a new function;
- Select the List of tables window
- Choose menu Use | Design then Tools | Explorer
- Choose menu Methods tab. Select Project Methods and click the New button
- Enter a new Method Name (e.g. MY_BARCODE_QTY) and click the OK button. Now you can enter a new function;
|Note: The return value of 4th Dimension functions is assigned to variable $0. The arguments to the function are $1, $2, $3, etc.|
Below is the 4D code for our example MY_BARCODE_QTY function;
` Example user bar code function that adds a prefix to data before it is bar coded
The MY_BARCODE_QTY function uses the standard bar code function CIAXCOM_CODE39 to calculate a Code 39 bar code. Before the argument is used to create the bar code, the fixed string "QTY" is added.
If you wanted to print human-readable text below ITF (Interleaved 2 of 5) bar codes, and you wanted the text to include the added check character, then you could write a function called MY_ITF_HUMAN.
Below is the 4D code for our example MY_ITF_HUMAN function;
CIAXCOM_BCP("ITF-0.HA", Msg, $0)
In fact there is already a standard function that does this CIAXCOM_ITF_A_H - but for this example, let us pretend this function does not exist.
Function CIAXCOM_BCP( ) can be used to return any bar code type you require, by using a string argument that defines the bar code type and a string argument that contains the message to bar code.
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.
For example, the following string is used to return an Interleaved 2 of 5 ( ITF) bar code with added check character;
This is exactly what function CIACOM_ITF( ) does. Function CIACOM_ITF( ) simply calls function CIAXCOM_BCP("ITF-0.BA", Msg) to calculate the bar code.
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;
|Separate expressions||Printed results||Font used to print result|
|=CIA_ITF_A("123456")||CIA ITF Medium, 14 point.|
|=MY_ITF_HUMAN("123456")||01234565||Arial Bold, 10 point.|
Human-readable characters are usually printed underneath bar codes, but you could print them on top if you wish, or elsewhere.
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.
When printing human-readable characters you can use any regular text font; Arial, Courier, Times, etc.
Copyright © 2000 CIA (BAR CODES) UK. All rights reserved. Reproduction prohibited.