Multiply a database field by a set value
I am trying to multiply a numerical value on my label, that is being pulled from a database, by a set numerical value and then have that new value show on the label in a different object field. So for example I have an object field pulling a numerical value from my database and it currently reads as 0.7. I would like to have that same value multiplied by 10 to equal 7 and record that information in a different object field on the same label. I have no VB Script experience and am not sure where to start. Just looking for some information on where to start. Thanks!
-
Peter Thane
★ BarTender Hero ★
Create your sum field on the label and make it a VB Script and an Event Controlled Script and then click the Edit with.... button.
On the Autoselected Events screen amend the editor box to Value = "1" so that you have a dummy value showing on your label and then from the column on the left select the OnNewRecord option.
In the editor box type in Value = and then in the Script Assistant box on the right scroll down to the Database Fields section and from there double click on the field you wish to multiply.
The editor box should now show something like
Value = Field.......
On a new line type
Value = Value *
and then add the type the multiplier to that command (ie Value = Value * 7) and you are done
0 -
Rafael Seward
★ BarTender Hero ★
That worked perfectly. Thank you!
I do have another question pertaining to this subject-
Sometimes the value that shows up is a text, which cannot be multiplied. How can I tell that same script to copy the text and paste it in the new object field?
0
Vous devez vous connecter pour laisser un commentaire.
Commentaires
2 commentaires