Visual Basic for Pulling content out 追蹤

0
Avatar
Rusty Page

I have a barcode in a BTW form that I am trying to extract data from. I am looking for some help with the visual basic script to do both of the following: As a point of reference, the barcode would look something like this: (01)00111111111111(10)LOT44030344(11)210118(17)220718 Script #1: Find "(11)" in the barcode readout & return the next 6 digits (not including the "(11)". This script would return: 210118 Script #2: Find "(10)" in the barcode readout and then return all of the digits between "(10)" & "(11)". This script would return LOT44030344 Appreciate any help you can provide! Thanks!

1 意見

0
Avatar
Pete Thane
評論操作 永久連結

As it looks like you are linking to a GS1 barcode symbology, the problem is, if the barcode has been created correctly, that the brackets will not actually be encoded in the barcode string as these only appear in the human readable and so you cannot use something like the InStr command to search for (10) for example. If this is a GS1 symbol then you may need to look at how and what data you are passing into the barcode as you should not be sending the brackets but will need to include at least one function 1 character in your string, due to a variable length data elelment being included in in it and possibly two if you have not used a GS1 symbology option (ie Code128 barcode and not a GS1-128 barcode).

As the 11 and 17 AI's at the end of the data string are dates and must be 6 characters are long then you could use a combination of the Right command to retain the last 14 characters of the sting (ie 210118(17)220718) and then the Left Command just to keep the 210118

A similar method could be used for the Lot number element all this is a bit more problematic as the AI 10 length is variable. If your lot number is always 11 characters in length then you could use a Right and Left command to first just keep the end 27 characters on the right and then just the first 11 characters of this. 

 

 

登入寫評論。