Calculate Copies (Via Data Entry Form + Database Field) 追蹤

0
Avatar
Legacy Poster

Hello,

 

I already know how to define the number of copies:

- via a data entry form

- via a database field

 

But now I would like to combine both.

 

The user will input a (pick) quantity in the data entry form. In the database I have the information, how many labels are needed for this item (e.g. 1 label per 10 items or 1 label per 20 items)

 

So the number of copies would be something like: "Number Input Box Control 1" / [table.column]

 

Is there an easy way to implement this (also without VB)?

 

Thanks & regards

 

3 意見

0
Avatar
Legacy Poster
評論操作 永久連結

Create a text object and assign it the database field (quantity per label) as data source. Assign a data source name.

Create another text object, that's linked to the data entry box. Also assign a data source name.

Go to File > Print. Click the icon to the right of the "Copies:" field. Select "Get quantity from data source". Select "Data Source" in the left pane.

Change the Data Source Type to "Visual Basic Script". As Script Type, select "Event Control Scripts". Click "Edit with Script Assistant...".

In the "OnPrintStart" event, type

Value = Format.NamedSubStrings("nameofdatasource2").Value / Format.NamedSubStrings("nameofdatasource1").Value

..whereas "nameofdatasource2"/-1 are the names you assigned at the beginning.

Test and report back :-)

0
Avatar
Legacy Poster
評論操作 永久連結

Thank you very much! It worked.

 

But I think I found a bug (at least I have no explanation for this):
- I have a label, where 8 labels fit on a page.
- I use 'Value = (Format.NamedSubStrings("DataSource1").Value' to define the print quantity.
- If e.g. DataSource1.Value = 20 -> I get 24 labels.

 

With some tests I found the following logic (if you print more than two pages):
- DataSource1.Value / (how many labels fit on a page)

-> In my example = 20 / 8 =  2,5
- Round down this value

-> In my example = 2
- Then you have to mulitply this value with another value (8 labels per page: for 17/25/33 it is 9, for 18/26/34 it is 10, for 19/27/35 it is 11, for 20/28/36 it is 12 ...)
-> In my example: 2 * 12 = 24 (19 -> 22 copies, 18 -> 20 copies, ...)

 

Is this behavior already known?

0
Avatar
Legacy Poster
評論操作 永久連結

Hm, I'm not really following you... Your original question was about determining the number of copies based on user input and a database field. So, 1 label per 10 items is defined in the database, the user enters 30pcs, thus the script should calculate 30/10 and return 3 (and BarTender should print 3 labels). Now you are mentioning "labels per page" fractional results (2.5)...?

登入寫評論。