New User? Sign Up  |  Sign In  |  Help
Barcode support and
tutorials from IDAutomation
and the community.
Click for the BBB Business Review of this Computers Hardware, Software & Services in Tampa FL
Resolved Questions

Need to create Human Readable data with Check Digit for GS1-128 Barcodes in Crystal Reports

Need to format the human-readable into groups with the check digit for USPS barcodes.
image


Need to format data for SSCC-18 with check digit.
image

Need to format human-readable data without manually entering the data and check digits.


Application: Crystal Reports

10-12-18     6.1 year(s) ago    

  Report Abuse

 

Ben

Best Answer

It may be necessary to produce human-readable data with a check digit for various Code 128 specifications including USPS IMpb, SSCC18, and SCC-14. The Code 128 Font Package font encoders do not produce human-readable with check digits for GS1-128 barcodes. Therefore, we have written a formula that will allow you to produce human-readable for some of the specifications listed. This formula along with either IDAutomation's font formula and Code 128 barcode fonts will allow the user/developer to generate the proper combination of barcode and human-readable for GS1-128 in Crystal Reports.

This example explains how to produce the human-readable field with the MOD10 Check Digit.

1. Run Crystal Reports

2. In the Field Explorer, right-click Formula Fields and select New.
image

3. Create a name for the Formula and select OK.

4. In the Formula Editor, set the Syntax to Basic Syntax and remove the formula = code.
image

5. Paste this human-readable formula into the Formula Editor field area.

'****************************************************************************************
' IDAutomation Font Formula for Human Readable GS1-128
' Compatibility: Crystal Reports 9 and above
' Font to use: IDAutomationC128 (version 2009 and above)
' Tutorial: http://www.idautomation.com/font-encoders/crystal-reports/font-formulas/
'
' Copyright, IDAutomation.com, Inc. 2000-2018. All rights reserved.
' You may embed this font encoder formula within your report if you own a valid
' license from IDAutomation.com for the associated barcode font,
' and this entire section and copyright notice are not modified or removed.
'
' Distribution of this formula within your organization requires a multi-user or site license.
' Distribution of this formula outside your organization requires a developer license.
'
'****************************************************************************************


Dim I As Number
Dim J As Number
Dim OnlyCorrectData As String
Dim CheckDigitValue As Number
Dim Factor As Number
Dim CheckDigit As Number
Dim NewLine As String
Dim CurrentChar As String
Dim CurrentCharNum As Number
Dim IMpbCheckDigit As String
Dim HumanReadableText As String
Dim StringLength As Number

Dim DataToFormat As String
Dim DataToFormatParens As String
Dim Groupby As Number
Dim ApplyTilde As Boolean
Dim ShowFullHR As Boolean
Dim ReturnCheckDigitOnly As Boolean
Dim HRData As String
Dim m As Number ' The number of digits to calculate MOD10 for
Dim ValuesToRemove As Number

'Set Parameters
'HR Data is your Data
HRData = "(00)08556340080264936"

'Groupby is the amount of numbers to appear in a group. For example, if Groupby = 4 for the data 12345678, it will format to 1234 5678
'This parameter only works when ShowFullHR is False.
Groupby = 0

'ShowFullHR when set to True displays the full Human Readable (with parentheses) and Check digit.
ShowFullHR = True
'm is the number of values that you want to appear in the human-readable. It is the number of characters included in the check digit calculation.
'For example, if the data is (00)1234567890123456 and m = 10. The calculated check digit will be 7890123456
m = 17




DataToFormat = HRData

DataToFormat = Replace(DataToFormat, "(", "")
DataToFormat = Replace(DataToFormat, ")", "")

ValuesToRemove = (Len(DataToFormat) - m)
DataToFormat = right(DataToFormat,len(DataToFormat)- ValuesToRemove)


HumanReadableText = ""

Dim M10StringLength As Number
Dim M10OnlyCorrectData As String
Dim M10Factor As Number
Dim M10WeightedTotal As Number
Dim M10CheckDigit As Number
Dim M10I As Number
M10OnlyCorrectData = ""
M10StringLength = Len(DataToFormat)
'Check to make sure data is numeric and remove dashes, etc.
For M10I = 1 To M10StringLength
'Add all numbers to OnlyCorrectData string
'2006.2 BDA modified the next 2 lines for compatibility with different office versions
CurrentCharNum = AscW(Mid(DataToFormat, M10I, 1))
If CurrentCharNum > 47 And CurrentCharNum < 58 Then M10OnlyCorrectData = M10OnlyCorrectData & Mid(DataToFormat, M10I, 1)
Next M10I
'Generate MOD 10 check digit
M10Factor = 3
M10WeightedTotal = 0
M10StringLength = Len(DataToFormat)
For M10I = M10StringLength To 1 Step -1
'Get the value of each number starting at the end
'CurrentCharNum = Mid(M10NumberData, I, 1)
'Multiply by the weighting factor which is 3,1,3,1...
'and add the sum together
M10WeightedTotal = M10WeightedTotal + (Val(Mid(DataToFormat, M10I, 1)) * M10Factor)
'Change factor for next calculation
M10Factor = 4 - M10Factor
Next M10I
'Find the CheckDigit by finding the smallest number that = a multiple of 10
M10I = (M10WeightedTotal Mod 10)
If M10I <> 0 Then
M10CheckDigit = (10 - M10I)
Else
M10CheckDigit = 0
End If
IMpbCheckDigit = totext(M10CheckDigit,0,"")


DataToFormat = DataToFormat & IMpbCheckDigit
DataToFormatParens = DataToFormatParens & IMpbCheckDigit
'Formula = DataToFormat

J = 0
If (Groupby = 0)Then
HumanReadableText = HRData & IMpbCheckDigit
Else

For I = 1 To Len(DataToFormat)
CurrentCharNum = AscW(Mid(DataToFormat, I, 1))
If CurrentCharNum > 31 And CurrentCharNum < 128 Then
HumanReadableText = HumanReadableText & Mid(DataToFormat, I, 1)
J = J + 1
End If
If (J Mod Groupby) = 0 Then HumanReadableText = HumanReadableText & " "
Next I
End If
If ShowFullHR = True Then
Formula = HRData & IMpbCheckDigit
Else
Formula = HumanReadableText
End If
''End of Code


6. Edit the HRData and any of the other parameters to meet the specification.

7. Save and close.

8. Drag the Human Readable field to the report.
image

When generating GS1 symbols, IDAutomation recommends testing the result with the Barcode Decoder App which parses out GS1 data to verify proper encoding.

Posted 6.1 year(s) ago

(0)
(0)
  Report Abuse
 
Find Interesting
 
Email to Others
 
Bookmark
 
Subscribe to Answer Alert
No comments yet.     Be the first to comment.

Email this question link to friends
You must enter an email address, if name is entered or vice-versa for each friend.
Friend #1 -
Friend #2 -
Friend #3 -
Friend #4 -
Friend #5 -
  Your comment on this question
  |         |  
bold  italic  underline  strike       big  small       superscript  subscript 
  Allows to add a link. Added links would only be converted to actual clickable link, when the domain of the link is white-listed by administrator.
Caption :
Link URL :
(Must starts with "http://")
Add  |   Cancel
  Allow to insert an image. Must be among the following file types - *.jpg, *.gif, *.png & *.bmp.
Image Url :   Upload New
(Image url must always starts with " http:// ")
Width : pixels
(Must not be greater than 450px. Enter 0px for no resize)
Add  |   Cancel
  Allow to insert YouTube video. Insert the video embed code.
Embed Code :
Add  |   Cancel
Up to 5000 Characters are allowed. Current Count: 0
  Your comment on this answer
  |         |  
bold  italic  underline  strike       big  small       superscript  subscript 
  Allow you to add a link. Added links would only be converted to actual clickable link, when the domain of the link is white-listed by administrator.
Caption :
Link URL :
(Must start with "http://" or "https://")
Add  |   Cancel
  Allow to insert an image. Must be among the following file types - *.jpg, *.gif, *.png & *.bmp.
Image Url :   Upload New
(Image url must always start with "http://" or "https://")
Width : pixels
(Must not be greater than 450px. Enter 0px for no resize)
Add  |   Cancel
  Allow to insert YouTube video. Insert the video embed code.
Embed Code :
Add  |   Cancel
Up to 5000 characters are allowed. Current Count: 0

You may answer and comment on any thread according to the Terms and Conditions.

 © Copyright 2021 IDAutomation.com, Inc., All Rights Reserved. Legal Notices.

 Barcode Fonts | Components | Scanners | Support | Contact Us
Training Videos on YouTube Join us on Google Plus Join us on LinkedIn Follow us on Twitter Like us on Facebook