AnsweredAssumed Answered

Scripting Assistance Requested

Question asked by lcot17 on Feb 21, 2016
Latest reply on Feb 22, 2016 by lcot17


I have spent a good while trying a number of ways to make this work but don't seem to be coming up with the right answer right now.


I am trying to assign a barcode to a product. A barcode has to be globally unique and are purchased from GS1. I for example will register 10,000 barcodes and add these barcodes into a 'Barcode Pool' table. This will consist of a barcode ID, EAN Barcode number.. and then the productOption ID (of that product) that the barcode is assigned to.


(By productOptionID, I mean that a product has a number of size variations each with a unique SKU and Barcode).


I need to make sure that I can assign a barcode to only one product SKU. I also need to make sure that if I disassociate a product SKU from a barcode, the barcode becomes available for use again.


I have set up a product option portal table in my products with a button to create an option.

I have also set up a portal in the product layout to list out all of the barcodes that do not have a product option ID assigned.



1) I cannot seem to add the portal to the popover?? Because of this, it is my understanding that when I click a barcode to assign, the portal row to assign it to may not be active so it may not work.


2) An alternative method to add a barcode to a portal record by turning the EAN field (this is the barcode field) into a button and activating a script that could maybe auto-assign an available barcode (or present an error if no barcode available)?


3) How to un-assign a SKU from a barcode to make it available for selection again. This was no barcodes are being wasted.


4) Making sure no productOptionID can be assigned to 2 different barcodes.


4) It seems for some reason, the 'Add Option' button breaks the portal sort order when around 3 or 4 entries are added? Its looks as if the order is going 12, 13, 14, 7, 8, 9.... It is seeing 12 as a lower number as 7 because the first character is a 1. How do I avoid this?


I've attached my database so far to take a look at.