Is it possible to generate this kind of PDF?

Hi Guys-

I have a Products table and each row has a barcode. Does anyone how can I generate the barcodes in this format (3 columns by X number or rows)?

JuneCorpuz_0-1664380383804.png

 

Thank you in advance!

Solved Solved
1 20 818
1 ACCEPTED SOLUTION

Hi @SkrOYC ,

That is a very good point you brought up. I had planned to mention but forgot. I have not yet dealt with pagination. The barcodes shown by @JuneCorpuz are of small height and he has mentioned he may need 30 or so at a time, which I believe one page will accommodate. Also in case of only images or barcdes , I think it will not be a problem as images may not split like a text field. They will be on one page or the other I believe. below is the result when I tested with images spreading multiple pages. The thick black line is page break.

Multi pages..png

Anyway, I have some approaches in mind to deal with pagination, possibly with using GAS. Planning to work on them. Will post as and when pagination works. ๐Ÿ™‚

View solution in original post

20 REPLIES 20

Hey June,

You could try with 

 

For the first column:
<<LOOKUP([_ROWNUMBER], "TABLE", "_ROWNUMBER", "BARCODE_COLUMN")>> 

For the second column:
<<LOOKUP([_ROWNUMBER]+1, "TABLE", "_ROWNUMBER", "BARCODE_COLUMN")>> 

For the third column:
<<LOOKUP([_ROWNUMBER]+3, "TABLE", "_ROWNUMBER", "BARCODE_COLUMN")>> 

Or use the label generation option in word, build the template there.

Hey James-

For the lookups, would that work if I will print dynamic number of barcodes? (Example, I will print 10 today, tomorrow I will print 30)

How about the template in word? Can I use <<Start:>> expression there?

Hi @JuneCorpuz ,

May we know if the bar code details are contained in one single column over several rows?

If so the picture shows a matrix of 12 bar codes( 3 column X 4 rows).  Would you like the bar cords for 12 rows in a single template? or in multiples of 12 or in multiples of three columns?

Request let us know how the bar code are contained in the data table and a bit more on template arrangement you wish to have so that we can share any feasibilities

Hey Suvrutt-

I'm sorry there are details missing, I'm already sleepy when I posted this topic last night ๐Ÿ˜…

Okay, let me explain what I'm trying to achieve. Each product has a barcode and I want to print multiple barcodes in (3 columns) x (X number of rows) format. The photo I posted contains only 15 barcodes, but in reality it can contains 100 barcodes.

Hi @JuneCorpuz ,

No worries. I think you are in Philippines and it was already very late for you. 

Thank you for your revert. Is correct to understand that each product's barcode being different row in the table. So if 30 barcodes are to be printed , the data will he fetched from 30 tows and so on.

That is correct

Thank you. I am currently not at my desk and responding from mobile phone. Will respond after some testing.

Hi @JuneCorpuz 

You could do the needful with a template like below

Image

Image

Image

<<START: SELECT(Product Slice[ID], MOD(COUNT(SPLIT(LEFT(Product Slice[ID],FIND([ID], Product Slice[ID])),",")),3)=0) >>

<<[BarCode]>>

<< END >>

<<START: SELECT(Product Slice[ID], MOD(COUNT(SPLIT(LEFT(Product Slice[ID],FIND([ID], Product Slice[ID])),",")),3)=1) >>

<<[BarCode]>>

<< END >>

<<START: SELECT(Product Slice[ID], MOD(COUNT(SPLIT(LEFT(Product Slice[ID],FIND([ID], Product Slice[ID])),",")),3)=2) >>

<<[BarCode]>>

<< END >>

Please note the expression part highlighted in red selects rows with the sequence 1, 4, 7, 10... in the first column.  Rows with the sequence 2, 5, 8, 11 in the second column and 3, 6, 9, 12.... in the third column. The MOD() function does this. COUNT(SPLIT....) does the indexing of rows. Note the slight difference in MOD() function results being compared with 0, 1, and 2 to get the rows in the described sequence above.

In the expressions, Product Slice is the slice on the Products table  that you will create to filter the desired rows to print bar codes from the Product  table as per your requirement.  [BarCode] is the column containing barcode images and [ID] is the key of the Products table.

I tested it on a table with images and images were printed like below. I believe, a slight misalignment in height is due to different size of images. I believe that will not be there in case of bard codes as they will have uniform image size.

template test.png

 

Nice trick ๐Ÿ˜‰, good execution.

Just curious, how you deal with pagination? I mean, what's the look of it on the page break?
I tried with an HTML template and everything works great except I didn't like the way it currently breaks to the new page and I'm a little perfectionist

Hi @SkrOYC ,

That is a very good point you brought up. I had planned to mention but forgot. I have not yet dealt with pagination. The barcodes shown by @JuneCorpuz are of small height and he has mentioned he may need 30 or so at a time, which I believe one page will accommodate. Also in case of only images or barcdes , I think it will not be a problem as images may not split like a text field. They will be on one page or the other I believe. below is the result when I tested with images spreading multiple pages. The thick black line is page break.

Multi pages..png

Anyway, I have some approaches in mind to deal with pagination, possibly with using GAS. Planning to work on them. Will post as and when pagination works. ๐Ÿ™‚

Hey Suvrutt. Nice trick! It works well if I will generate all of the rows in the sheet. The problem that I encountered is that when I generate the report that handles different rownumber (not sequential), the result is kinda off because it seems that the formula is based on the rownumber

Hi @JuneCorpuz ,

Thank you for the update. Good to know it works to some extent for you.

You may want to update "what you mean when you say the result is kinda off". do some rows do not get printed that should have or is just the print sequence off.

It is not dependent on the row number but key index. It should generate sequence irrespective of intermittent rows being selected. If you could share the key type (meaning if it is unique I'd based or variable length) and your template expressions , then I can suggest , if anything I observe.

Hello Suvrutt, This is the result that I got in generating the template by using random rows instead of sequential.

JuneCorpuz_0-1664598811845.png

I'm really thankful for helping me in generating the template, but the client decided to use other format instead. We can now close this discussion.

Thank you very @JuneCorpuz for the update. I know we are closing the discussion but just for any future reader's update, one difference I see is that there are 4 columns in your result.

My solution was made for three columns and that could be the reason for the slight mismatch you mentioned. It can of course be readily adapted to any number of columns by changing MOD() expression and equality operator.

Anyway, thank you again and have a great weekend.

Thank you for bringing that up, yes I think that problem is I added one more column but as you can see in Column 2 to 4, it works perfectly ๐Ÿ˜Š 

Try an HTML template with a "Display: flex" CSS

Thank you for your suggestion but I have no idea how to work on this ๐Ÿ˜ข

wrong thread. ๐Ÿ˜ฑ

HI @James_McFarlane ,

I think you have posted in wrong thread. Please post in your other SVG  related thread.

 

My take using a normal Start: expression (meaning that the template is the one incharge of the layout on 3 columns):

Landscape:

Page 1Page 2Page 3
SkrOYC_2-1664459505079.pngSkrOYC_3-1664459534995.pngSkrOYC_4-1664459555817.png

Portrait:

Page 1Page 2
SkrOYC_5-1664459612126.pngSkrOYC_6-1664459628799.png
Top Labels in this Space