Delete Barcode If Null/empty? S’abonner

0
Avatar
Legacy Poster

With VB Scripting would I be able to delete unused barcodes if they are null/empty at print time?

8 commentaires

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

I think you probably don't mean "Delete" and rather mean to just not print barcodes on a certain label if the data is empty.

 

The vb code you're looking for looks similar to :

 

If (len(<DataSource>) < 1) then
  Format.Objects(<object name>).PrintVisibility = false
else
  Format.Objects(<object name>).PrintVisibility = true
end if

For example:

 

If (len(data) < 1) then
  Format.Objects("Barcode 1").PrintVisibility = false
else
  Format.Objects("Barcode 1").PrintVisibility = true
end if

This code would likely go best in the "OnIdenticalCopies" event VB scripting which can be found by going to View > Options in your BarTender document (requires Automation and Higher I believe)

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

[attachment=853:Untitled.png]

The data source name is "UPC8". The substring name for the barcode circled is "Barcode 8". 

 

Right now, for testing purposes, I'm trying to test  a label where only the the first row for information, of 8, is filled. I'm leaving it so the last row isn't printed but the actual barcode prints with no data. Right now I don't have access to the printer so I'm using the debug feature to view the results. I'm not sure if that's skewing what I'm supposed to see or not.

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

I don't know much about the debugger you speak of, I know for sure the print preview sometimes don't work so great when programatically changing visibility. However, note that you have a "0" in your field. This means it will still print. The if statement is using the Len() command which means "Length", it is not a value check. It is checking if the length of the data is less than 1 character long (otherwise known as empty :) )

 

You could try installing a PDF printer or something to get another level of testing to rule out the debugger or print preview as a source of issue.

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

The current "0" in the previous screenshot is from the template. 

 

[attachment=855:post.png]

 

After I simulate a print I get something like this where I only have 6 rows worth of information. The other fields in the last 2 rows are just "" no characters. Printing them to PDF still shows the empty barcodes.

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Please attach your file here if you can. Then someone can take a look at all aspects of it.

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

[attachment=856:ShippingLblUPC.btw]

 

I don't remember at what point I left it, but I tried various VBscripts in all the possible events but to no avail. I tried suppressing the barcodes if the previous/next data was empty as well.

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Looking at your screenshot again, the barcodes you claim to be empty are consistent with the pattern for encoding " ", or a single space. The .btw file you attached does not appear to have anything in it that links the barcodes to another field, they are all just "0". When I manually blank the 0 out, I have no issues with the barcodes still appearing. Please make sure that you're not accidentally still trying to encode a space in the barcodes you actually want to be blank.

 

Alternatively, you could adjust your VB code from <Len(0) to something like <Len(2) just to test and see if it works

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

I ran the store procedure just to view the results and the barcode data (UPC1-8) that's empty gets passed in a NULL.

 

If (IsNull(Format.NamedSubStrings("UPC8").Value)) then
  Format.Objects("Barcode 8").PrintVisibility = false
else
  Format.Objects("Barcode 8").PrintVisibility = true
end if 

 

 

 I have this, as suggested, in View->View Options->VB Scripting-> OnIdenticalCopies. When that failed I threw it into every event but but the same thing kept happening. I've deleted the sample data that's present in Barcode itself. I'll probably sit on this for a bit and I'll see the answer eventually. I appreciate the help.

Vous devez vous connecter pour laisser un commentaire.