Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old October 20th, 2014, 11:54 AM
rsheldon rsheldon is offline
Junior Community Member
 
Join Date: Sep 2008
Location: Upper Marlboro, MD
Posts: 24
Default Excel Scanline Check Digit

Good Afternoon Everyone,

I am not sure that this is the correct forum to be on, but I will ask anyway. I am using VDP 9.1 in Acrobat 10.1 on iOS 10.8.5. I have a client that has sent in a database that I need to create a Scanline using 2 fields. The data is alphanumeric, and I need to create a Check Digit using a Mod10 with weights of 2, 1, 2, 1. Sample data is:

Field 1 Field 2
CON135627 U14B1DDBMR

The result is 0CON135627 U14B1DDBMR8, with 8 being the check digit.

I am so confused
Reply With Quote
  #2  
Old October 20th, 2014, 01:27 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,359
Default Re: Excel Scanline Check Digit

What do you mean by a "scanline?" Are you trying to output a bar code? Or do you just literally want a string of numbers and letters like "0CON135627 U14B1DDBMR8" to be in the output?
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #3  
Old October 20th, 2014, 01:37 PM
rsheldon rsheldon is offline
Junior Community Member
 
Join Date: Sep 2008
Location: Upper Marlboro, MD
Posts: 24
Default Re: Excel Scanline Check Digit

Good Afternoon Dan,

The Scanline is an alphanumeric string of text like the sample I gave. It uses the font OCR A. So yes, just a string of text, no barcode. I have received a few scanlines from other clients, but they come in already formatted in excel. Unfortunately with this one, I am creating from 2 fields in the database. The instructions I received are in the attached .xls file
Attached Files
File Type: zip Scanline.zip (19.9 KB, 7 views)
Reply With Quote
  #4  
Old October 20th, 2014, 05:40 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,359
Default Re: Excel Scanline Check Digit

Quote:
Originally Posted by rsheldon View Post
Good Afternoon Dan,

The Scanline is an alphanumeric string of text like the sample I gave. It uses the font OCR A. So yes, just a string of text, no barcode. I have received a few scanlines from other clients, but they come in already formatted in excel. Unfortunately with this one, I am creating from 2 fields in the database. The instructions I received are in the attached .xls file
Okay, out of everything in that Zip file, the instructions about this check digit are really just this one line from the Excel file: "This is the scan-line check digit - Modulus 10, double add double, sum of the digits,with weights of 2121,etc from right to left." I asked my best expert about this; his name is Dr. Google. Pasting that text into Google returns this:
https://www.claredi.com/download/npi_luhn.html

So I think that's the formula. But that formula is specific to numbers. It doesn't say what to do with non-digits, i.e letters. How are you supposed to get the "sum" of "CON135627 U14B1DDBMR"? Are you supposed to add the ASCII values of the letters, like for a POSTNET barcode?

Once we have some numbers to deal with, it should be easy enough to apply the formula in that link. But what do we do with the letters?

Maybe what we really need is this:
http://en.wikipedia.org/wiki/CUSIP#C...git_pseudocode

But, as much fun as it is for me to do all of this research for you, I think you need to get some clarification from whoever sent you those instructions about exactly what it means to make a check sum of "Modulus 10, double add double, sum of the digits" with something other than digits.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #5  
Old October 22nd, 2014, 04:26 AM
rsheldon rsheldon is offline
Junior Community Member
 
Join Date: Sep 2008
Location: Upper Marlboro, MD
Posts: 24
Default Re: Excel Scanline Check Digit

Thanks Dan for taking a look at this for me. I have reached out to a caging house as well. This is where they check the scanline. I figured if they couldn't tell me, I am in deep deep trouble. From what I was reading in the scanline instructions: A = 3o, B = 31, C = 32 all the way to Z = 55, but I am still lost.
Reply With Quote
  #6  
Old October 22nd, 2014, 09:10 AM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 955
Default Re: Excel Scanline Check Digit

I set this up using the formula Dan posted (or at least I tried to). The check digit, as I determined it, doesn't match your example so I'm not sure this is going to help you at all but I figured it may at least give you a starting place or at the very least the function for converting the alpha characters to the numeric values you listed above. I'm also unsure of where the leading zero is coming from in your example from your original post so that may have something to do with why my solution is a bit off.

Code:
// Initiate variables
var field1 = "CON135627";
var field2 = "U14B1DDBMR";
var result = [];
var checkDigit = 0;

// Function to convert alphas:
//   A = 30
//   B = 31
//   Z = 55
function getAlpha(input){
    var alpha = ['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'];
    var result = alpha.indexOf(input);
    return result + 30;
}

// Concatenate fields to create the barcode field
var barcode = field1 + field2; 

// Replace alphas with numbers
barcode = barcode.replace(/[a-z]/gi, function(s){return getAlpha(ToLower(s));});

// For loop to double every other number
for (var i=0; i<barcode.length; i++) {
    if (i%2 == 1) {
        result.push(barcode[i]*2);
        }
    else {
        result.push(barcode[i]);
        }
}

// Join result of the above for loop into a string of numbers to be added together
result = result.join('');

// For loop to all of the numbers together
for (var n=0; n<result.length; n++){
    checkDigit += Int(result[n]);
}

// Modulus 10
checkDigit = 10-(checkDigit%10);

return field1 + " " + field2 + checkDigit;
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:14 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.