Hi there, I’m trying to input multiple items from scanning a single barcode/QR code, and was wondering if this possible with SambaPOS?
For example: 3 products from the menu,
Coke, barcode: 9001
Sprite, barcode: 9002
Fanta, barcode: 9003
Combine these 3 into a long barcode such as
88 03 9001 9002 9003 77
88 and 77 are marker for his special barcode, 03 meaning there are 3 product barcodes in this series, and SambaPOS would know to read 9001, 9002, & 9003, and add these items to ticket.
I cannot give you the exact steps for automation but using JScript you can parse the 1 value into the bits required i.e. 9001, 9002 etc and then use automation to add items to a Ticket. JScript has some fairly good text handling features so Google will bring up actual source to test.
Place your source in a SambaPOS Script and use {CALL:x} to return the values into Automation. In some cases you can use JSCRIPT directly in a Constrain or Parameter with needing a call. I find sometimes a CALL is better as my constraints can blow out in length.
In a quick service restaurant scenario with complex menu. I can potentially let customers create their own order on their phone, and the app will turn their order into a barcode which they come to the front counter and place their order with the barcode. If that make sense at all.
This shouldn’t be too hard with jscript few slice functions in a for loop
So long as you have a consistent format at least up to the qty number at the beginning and ideally consistent lengths of bar-codes would make life easier.
Or posibly loose the qty prefix and prefix each barcode string with a unique value which can be indexed and used to break apart
Slice out the qty and then loop a few more slices to pull the individual numbers.
Only bit im not sure about would be the adding of the products.
Should be doable with a loop value action.
The script returning a comma separated list of barcodes into a loop value action triggering add order actions.
Although never used the loop value action myself.
see what your thinking but not sure carrage return is a barcodeable function.
A scanner would add a return as a suffix usually as an ‘enter’ after the code entered.
comma would be better as pretty sure the loop values action needs comma seperated list
Basically you will need to include a ~013 in the Data To Encode text box where ever you need the carriage return to be. For example, for the data 1234567890, you would use 12345~01367890. When scanned the carriage return will be between the 5 and 6. Also the Apply Tilde in Code 128 option needs to be set to Yes or True.
If it were to work I think you would need to turn the scan speed down to allow time to process.
Saying that were you even using a barcode scanner??
Thanks JTRTech, that’d be awesome if you could start me on something.
I haven’t decided on a format yet, probably something similar to this
8888 9001 9002 9003 7777
basic concept is that
8888 is the marker for the beginning of special barcode
7777 is the marker for the end of the special barcode
product codes are in 9xxx format
when SambaPOS process a barcode input, it checks
IF the first 4 digit of the barcode is 8888,
THEN it knows it’s the beginning of the special barcode, and will read 4 digits at a time, enter it as a product, until it reaches 7777 (end of the special barcode)
ELSE treat the input as normal barcode, and process normally
Not sure youll need the 8888 and the 7777…
All you want is a way for the numberpad entered rule to know its a multi product code so say the 8888 would suffice.
Either way…
Here is a quick rough and ready script which should return a comma separated list of barcodes for use in a loop value action.
This is based on the given format and all segments being 4 digets separated by spaces.
function multiBarcodeSplitter(inputBarcode) {
var multiBarcode = inputBarcode;
var listBarcode = multiBarcode.split(" ");
var listLength = listBarcode.length-2;
var productString = '';
for(var i = 1; i<listLength+1;i++) {
productString += listBarcode[i]+',';
}
var slicedListString = productString.slice(0,listLength*5-1);
return slicedListString
}
function multiBarcodeSplitter(inputBarcode) {
var multiBarcode = inputBarcode;
var prefix = multiBarcode.slice(0,4);
if (prefix==8888) {
var listBarcode = multiBarcode.split(" ");
var listLength = listBarcode.length-2;
var productString = '';
for(var i = 1; i<listLength+1;i++) {
productString += listBarcode[i]+',';
}
var result = productString.slice(0,listLength*5-1);
} else {
var result = 'Not a valid multi-product barcode'
}
return result
}
If you put the qty segment back in you could also varify that the qty matches the barcode qtys
var prefix = multiBarcode.slice(0,4);
if (prefix==8888) {
Are all segments 4 didgets
for(var c = 0; c<codeLength;c++){
var loopSegment = listBarcode[c];
var loopSegmentLength = loopSegment.length;
if (loopSegmentLength==4) {
//If four digets do nothing
} else {
var allFourDiget = 'No';
}
}
if (allFourDiget=='Yes') {
Does the second segment (barcode listing of product qty) match the counted number of codes
var listLength = listBarcode.length-3;
var barcodeQty = Number(listBarcode[1]);
if (listLength==barcodeQty) {
Full code;
function multiBarcodeSplitter(inputBarcode) {
var multiBarcode = inputBarcode;
var prefix = multiBarcode.slice(0,4);
if (prefix==8888) {
var listBarcode = multiBarcode.split(" ");
var codeLength = listBarcode.length;
var allFourDiget = 'Yes';
for(var c = 0; c<codeLength;c++){
var loopSegment = listBarcode[c];
var loopSegmentLength = loopSegment.length;
if (loopSegmentLength==4) {
//If four digets do nothing
} else {
var allFourDiget = 'No';
}
}
if (allFourDiget=='Yes') {
var listLength = listBarcode.length-3;
var barcodeQty = Number(listBarcode[1]);
if (listLength==barcodeQty) {
var productString = '';
for(var i = 2; i<listLength+2;i++) {
productString += listBarcode[i]+',';
}
var result = productString.slice(0,listLength*5-1);
} else {
var result = 'Barcode QTY doesnt match ready qty';
}
} else {
var result = 'A segment of the barcode has either been misread or is invalid';
}
} else {
var result = 'Not a valid multi-product barcode';
}
return result
}
This is on basis of following format;
8888 0005 9002 9002 9003 9004 9005 7777
Segments;
8888 prefix
0006 four digit barcode product qty
3-7. Product codes
7777 suffix
This checks both the 8888 prefix and 7777 suffix;
function multiBarcodeSplitter(inputBarcode) {
var multiBarcode = inputBarcode;
var prefix = multiBarcode.slice(0,4);
var suffix = multiBarcode.slice(-4);
if (prefix==8888 && suffix==7777) {
var listBarcode = multiBarcode.split(" ");
var codeLength = listBarcode.length;
var allFourDiget = 'Yes';
for(var c = 0; c<codeLength;c++){
var loopSegment = listBarcode[c];
var loopSegmentLength = loopSegment.length;
if (loopSegmentLength==4) {
//If four digets do nothing
} else {
var allFourDiget = 'No';
}
}
if (allFourDiget=='Yes') {
var listLength = listBarcode.length-3;
var barcodeQty = Number(listBarcode[1]);
if (listLength==barcodeQty) {
var productString = '';
for(var i = 2; i<listLength+2;i++) {
productString += listBarcode[i]+',';
}
var result = productString.slice(0,-1);
} else {
var result = 'Barcode QTY doesnt match ready qty';
}
} else {
var result = 'A segment of the barcode has either been misread or is invalid';
}
} else {
var result = 'Not a valid multi-product barcode';
}
return result
}
Put in a new script, name whatever aned put handeler of say ‘BarcodeTools’.
Then in your automation flow where you need to use put {CALL:BarcodeTools.multiBarcodeSplitter('[:NUMBERPAD]')}
That call might not be 100% correct as not on machine to check the numberpad tag but its something like that, if you click a constraint dropdown on a number pad entered event it should show you, it might be [:NumberPad], cant remember off the top of my head.