I'm seeing summer-time. How 'bout you?

Crystal Reports Kicker

Posted: December 3rd, 2009 | Author: admin | Filed under: Crystal Reports | No Comments »

The task? Open existing pack list and label reports and populate some numbered fields with 128-bit barcodes.  Sounds easy, right? It was! (kinda)

Utilizing the most recent version of Crystal Reports, I was pleasantly surprised to find a VISUAS BASED EDITOR… wow… felt almost as cool as Dreamweaver for the first time.

Find your numbered Database Field – right click – Convert to Barcode.  Demo barcodes are installed and available to give your preview report the right layout and consistency.  Note, the demo barcodes are just that – demo barcodes. Don’t expect to utilize them in any production environment. 

Now that you’ve created the barcodes and feel all professional about it – it’s time to acquire legit barcodes and start importing them.  For this example, I relied on IDAUTOMATION.com’s Barcode UFL Tutorial, located at http://www.idautomation.com/fonts/tools/crystal/

  • Install the appropriate barcode fonts. If there is a doubt as to which font to use, IDAutomation recommends the Code 128 Barcode Font Advantage Package. When using Code 128 or Interleaved 2 of 5, if the character set is not US English, 1252 Latin-1, 1250 European, 1251 Cyrillic, 1253 Greek, 1254 Turkish, 1255 Hebrew or 1256 Arabic, the Universal Barcode Font Advantage™ must be used. This example uses the Code 128 Barcode Font Advantage Package. Some font packages also include Font Formulas, which allow the font formatting routines to be embedded in a report without the need for a UFL.
  • Download IDAutomation’s Crystal Reports UFL and install it. After installing the UFL, the barcode functions should show up under Additional Functions in the formula editor. For backward compatibility with formulas of previous reports, IDAutomation also provides the previously released COM based Crystal UFL. If the earlier version of the UFL is used, refer to the documentation in that package.
  • Choose the Design tab to enter the design mode of the report.
  • Open the Field Explorer. In version 9, choose ViewField Explorer. In versions prior to 9, choose Insert - Formula Field.
  • Right click on Formula Fields and select New.
  • In the Formula Name dialog box, enter a name to identify the formula field. This can be any name, for example, "Code128Barcode." In this example, the formula is simply named "Barcode."
  • Click OK and select Use Editor if asked. The Formula Editor should now be open.
  • In the Functions Column, expand Additional Functions and expand the IDAutomation section. From the list provided, choose the appropriate function. When creating DataBar Expanded Stacked symbols, a formula is used instead of a function. If the IDAutomation functions do not show up in the Additional Functions section after installing the UFL, copy the U25IDAutomation.dll file from the Windows System directory (for example C:\Windows\System32) to the directory where the Crystal DLLs are located. In Crystal 11, the file may be copied to C:\Program Files\Common Files\Business Objects\3.0\bin; in Crystal 10 and previous versions, the file may be copied to %Windows%\Crystal where %Windows% is the directory where Windows is installed.
  • Make sure the function utilized matches the font listed in the "font to use" column. As an example, only use the IDAutomation_Code128() function with the IDAutomationC128 Font.
  • With the cursor in between the parentheses of the function, select the data field that is to be encoded. Data fields used in this formula must be formatted as text. If the data fields are not text, use ToText for conversion. The syntax of the formula should look similar to the formula below which formats Field1 of Table1 to a Code 128 barcode font. IDAutomation_Code128 ({Table1.Field1}) or IDAutomation_Code128 (ToText( {Table1.Field1} ) )
  • Choose Save and then Close. If an error such as "A string is required" appears, convert the data to text with the ToText function. For example: IDAutomation_Code128 (ToText( {Customers.CustNum} ) )
  • To include a text interpretation of what is being encoded below the barcode; it is recommended to create an additional formula. In this example, the formula is named BarcodeHR to return the "human readable" text for Table1.Field1:
    {Table1.Field1}
    When creating GS1-128 (UCC/EAN) barcodes which require specific text interpretations, the appropriate HR function may be used for that purpose. For example, to display the text for a GS1-128 barcode, BarcodeHR is created with a different formula to return the formatted text from Table1.Field1: IDAutomation_Code128HumanReadable ({Table1.Field1})
  • Return to the Field Explorer dialog box.
  • Click on the formula field and drag it onto the report.
  • Now that the fields have been created in the Crystal Report, choose the Preview tab to make sure the data is being retrieved from the fields and properly formatted to the barcode font. Strange characters will append to the beginning and ending of the data from the fields, which are required for the start and stop characters in the barcode. Additional formatting may also be necessary that scrambles the data; this is normal for Code 128, Interleaved 2 of 5 and all functions in the Universal Barcode Font and DataBar Font. The graphic below in this tutorial shows the first field produced by the @Barcode formula and the second produced by the @BarcodeHR formula.
  • Choose the Design tab again and size the barcode formula field to display the appropriate barcode font in the report.
  • Change the font of the formula field to be the appropriate barcode font and set the point size to 12 points or another appropriate size. Ensure the formula used matches the font listed in the "font to use" column. This is a very important step; if this is not correct, barcodes will not be properly created.
    NOTE: When selecting the font from the pull down menu, please do not use the fonts that begin with the "@" Symbol. Instead, scroll down in the list and select fonts that begin with "IDAutomation”.
  • Select the Preview tab (or File – Print Preview) to view the barcodes in the report. Print one page of the report and test with a scanner. IDAutomation suggests testing with the easy-to-use IDAutomation USB Barcode Scanner, which scans all popular linear, GS1 DataBar and PDF417 barcodes. When 2D Data Matrix, QR Code, Aztec or Intelligent Mail symbols need to be verified, IDAutomation suggests the 4600G Hand Held Products Imager.\
  •  

    Get all that? GEEK!


    Comments are closed.