Calculated field from data base field
Hi
I throw an error message when trying to calculate km from m input from an Excel data base. The dB field is named Length.
I created a new field on the label. Data type - I set to Number. Data Source I set Type: Visual Basic Script. Script Type: Event Control Scripts.
In the editor, on OnAutoSelectedEvent, I entered Value = "10000" as a place holder. Then, on OnNewRecord, I entered Value = and double clicked the Length field from Database Fields, on the right. This filled in Value = Field("ExcelLabel.Sheet1.Length"). On a new line, I entered Value = Value / 1000. Closed the editor, then clicked Preview.
Error: BarTender Warning Message #3912. Field Name ExcelLabel.Sheet1.Length has not been declared. To declare a field, insert ReferenceField("ExcelLabel.Sheet1.Length") at the top of your script. So, I did that. Preview again, new error.
Error: BarTender Warning Message #3912 OnNewRecord(Line2): Field name ExcelLabel.Sheet1.Length was not found.
I am puzzled since I used an existing data base field name. The Excel file has four records with data in each for Length. I test printed Length in meters from the data base yesterday. I welcome your comments. Thank you!
Steve
-
Peter Thane
★ BarTender Hero ★
I wonder if it is the word length that is causing an issue for some reason.
If it is not already on the label, add a text field linked to the Length database field but then make it a named field (say LengthDB for example). Then adjust your VB to link to the Named Data Source rather than the database field itself
0
Vous devez vous connecter pour laisser un commentaire.
Commentaires
1 commentaire