Convert Weight Follow


I am trying to create a label which displays weight in both LBS and KGS. The user needs to be able to input the weight in KGS using the Data Entry Form, and that weight be converted in another field to LBS. I know this is probably quite simple using VB, but I have no idea how to do it. Any suggestions?


Xabier Clemente
Comment actions Permalink

Hello Vincent,

Welcome to the BarTender Community Forum!

I believe using VB Script would be the easiest way to achieve what your user is intending. Here is a link to a script and some instructions which should meet their needs. I've attached some simple instructions on the steps you'd need to take, so I believe you should be able to reproduce the outcome.

Also, we would recommend reaching our Professional Services Department or one of our BarTender Partners in case you need further and more dedicated help with label design or scripting.

Hope this helps!

Peter Thane
Comment actions Permalink

This is the way I would achieve this:

Add on your Kilogram field on to the label made up of two sub-strings, the numeric part and a s 2nd string that contains

" Kg"

then make the numeric part a named string via the Change Data Source Name button (ringed on the screenshot below). I called mine KGInput in my test label.

On your Data Entry Form add an input box for the users to add in the weight in kilograms (just the numbers).

For the pound field, again construct this of two sub strings, a " lbs" (or similar) string preceded by a string with a Data Type set to numeric to the appropriate number of decimal places and then adjust the Type on the Data Source tab to Visual Basic and adjust the Script Type to Event Controlled Script. 

Click the Edit button and in the OnAutoSelected Event change the code to something like Value = 999 or similar (this will be what appears on the label as default)

In the column on the left scroll down to OnPostPrompt and in the script box add type Value = and double click on the name you gave to the kilogram field above to complete the first line of code. 

On a new line type Value = Value * 2.20462

(I believe the conversion rate is 1kg = 2.204622 pounds)

Then click close and come out of the field and that should be it.



Please sign in to leave a comment.