James
|
Best Answer
Incident Update: IDAutomation now includes mode 43 calculation options in all 2019 or later updated QR Code and Data Matrix products with the ApplyTilde ~f?? method.
The character values for Mod43 are the same for:
• Code 39 (see ‘Code 39 Character Values’ table)
• HIBC (see Table B1)
The following are function examples* that will calculate the Mod43 check character for a valid input:
VB.Net:
Public Function functMod43(dataIn As String) As String
'set characters in array whose index matches values of respective character
Dim aryChar = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "-", ".", " ", "$", "/", "+", "%"}
'declare variables
Dim intSum = 0
Dim intRemainder = 0
'sum up all the individual characters' values by index (which corresponds to set character values)
For Each var As String In dataIn
intSum = intSum + Array.IndexOf(aryChar, var) 'add index value to current sum
Next
'get remainder by dividing by 43
intRemainder = intSum Mod 43
'get/return character for the value of the remainder - this is the mod43 check digit
Return aryChar(intRemainder)
End Function
VBA:
Public Function functMod43(dataIn As String) As String
'set characters in a string (array of characters) whose index matches values of the respective character
stringOfCharacters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%"
'declare variables
intSum = 0
intRemainder = 0
For i = 1 To Len(dataIn)
'sum up all the individual characters' values by index (which corresponds to set character values)
intSum = intSum + (InStr(stringOfCharacters, Mid(dataIn, i, 1)) - 1)
Next i
'get remainder by dividing by 43
intRemainder = intSum Mod 43
'get/return character for the value of the remainder - this is the mod43 check digit
functMod43 = Mid(stringOfCharacters, (intRemainder + 1), 1)
End Function
Crystal Reports Basic Syntax:
There is an updated implementation post, which includes a downloadable report.
Applies To:
• Excel: Use to calculate Mod43 and add (using the & operator or concatenate function) result to data before passing to the encoding function.
• Barcode Label Software: Same use in Excel, but after adding Mod43 result to data, import Excel spreadsheet as an external datasource to the Barcode Label Software.
• .Net Application (VB or C#): Use to calculate Mod43 and add (using the & or + operators) result to data before passing to the encoding function.
• Crystal Reports Products: Use to calculate Mod43 and add (using the & or + operators) result to data before passing to the encoding function.
*Support Notes:
• The above functions are provided to assist IDAutomation clients but are outside the scope of support.
• Do not rename the function to Mod43, as this seems to conflict with Excel.
Posted 8.3 year(s) ago
|