Download Example File
How it works
To understand how this example works, open the Manage Database dialog. Find the “Barcode” field, and double-click it. This should open the “Specify Calculation” window.
CNSBC_Generate( “Code39” ; Data )
This short calculation is all that is needed to create a barcode. The first parameter defines the type of barcode you want, which is “Code39” in this example. The second parameter defines the actual data you want encoded in the barcode.
This example uses a calculated container field to display the barcode image. Notice the field type is “Calculation”, and when you look at the “Specify Window” window for the field, in the bottom left corner is a “Calculation result is” field which is set to “Container”.
If you wanted to put this in a script instead of a calculation field, you can do that too. Simply create your script, and add the Set Field script step to the script. The “Target field” for the Set Field script step would be your container field, and the “Calculated Result” would be the function call as above. The following would create a Code 39 barcode with “Your Data Here” encoded in it and place it in the “db::barcodeimage” field.
Set Field [ db::barcodeimage ; CNSBC_Generate( “Code39” ; “Your Data Here” )]
If you wanted to specify the barcode type and/or barcode data in a field, that would look something like the following.
Set Field [ db::barcodeimage ; CNSBC_Generate( db::barcodetype ; db::barcodedata )]
It really is that easy to create barcodes with CNS Barcode.
How to recreate in your solution
After you have gone over the example databases, learned how they work and how the plug-in works, you can integrate the plug-in into your own solutions. There are many ways this can be done, but here are a few of the most common ways.Note, to properly integrate the plug-in into your own solution you need to be proficient at FileMaker scripting and calculations. While our documentation tries to provide some tips, teaching all the ins and outs of FileMaker scripting and calculations is beyond what we do. FileMaker offers many training options to help you further your FileMaker developing skills. If you are looking for a professional developer to integrate the plug-in into your solution, you can search for one on FileMaker's Consultants site.
Import example script
This is the easiest way to go, but can be the most frustrating at the same time. When importing a script, you will have to go back over the imported script with a fine tooth comb. Field references will be different between the example database and your own database, so you will have to touch every script step to make sure all field references are correct. This will mainly deal with the Set Field script step (but check all the script steps to make sure they are correct for your database). Select the Set Field step and check the “Specify target field” button to make sure that field is correct. Then check the “Calculated result” button and make sure any field (and table names) are correct. If you find /* */ at the beginning and end of the calculation, FileMaker has commented out the code because of incorrect field references. You will need to fix all field references, and then remove the /* */ from the beginning and the end.
Re-create example script
Print out or view the example script and re-create it in your own database. Since you will be creating the script as you go, you are less likely to overlook an incorrect field reference as you would with Importing an example script. This method helps you to better understand what your script is doing since you are actually creating the script yourself.
Create script from scratch
If you went over all the example databases, you should have a pretty good idea what a script would look like. Using the function browser to give you more information about the functions, you can create a script to send an email exactly as you need it. Click the “Functions” tab to open the function browser. Remember to build error checking into your scripts. This is very important and will save much frustration later when something stops working and you have no idea why and no errors to go by.
Be sure to check out the Coding Considerations section for some helpful tips on working with the plug-in functions and writing scripts.