跳至主內容

搜尋

搜尋

Help about calculate using data base field + data form

評論

5 條評論

  • Avatar
    Peter Thane

    You will need to use a Visual Basic Script routine to achieve this.

    1. As the discount amount is not shown on your label, add a field to the side of the label (so it wont actually be printed but can be referenced) and using the Change Data Source Name button, give this field a name, I just called mine "Discount" for the code below
    2. On your Data Entry Form, link the user entry field to the "Discount" field
    3. For your amount field, change the Type to Visual Basic Script and choose the Event Controlled Script option and then press the Edit with.... button (you may also want to set the Data Type to number so that the final field goes to two decimal places). See the image below for the VB settings and I have also ringed the Change Data Source Name button mentioned in 1. above

     

     

    1.   
    1
  • Avatar
    Peter Thane

    Seemed to have submitted that without finishing it

    • In the central edit box with the OnAutoselectedEvent highlighted, change the entry to Value = 100 (to give the field a default value to stop an error being displayed)
    • Next scroll down the left hand column and highlight OnIdenticalCopies and in the central box add the following

    Value = Format.NamedSubStrings("FullPrice").Value   SEE NOTE BELOW

    Value1 = 100- Format.NamedSubStrings("Discount").Value

    Value = (Value * Value1)/100

     NOTE: for the top line, type Value = and then in the column on the right select/double click on the database field where the full price amount is retained. This will change your line to something like Value = Field(<Database name\/table\field name>). value. My label was not linked to a database but just a named text field on my test label. Repeat this action on the second line but instead choose the name of the field you entered in 1 above from the Named Data Sources options in the right hand column.

    • close to come out of the VB screen and that should be it 
    1
  • Avatar
    Altivo Almeida

    Hi Pete, Thank you, work fine !!

    0
  • Avatar
    Kiran Babu

    Hi Peter. With Bartender 2019/2021 do we have any easier option to achieve this? If VB script is the only solution, can you suggest any source to learn more on the VB scripting for Bartender so that I can leverage Bartender to the most.

    0
  • Avatar
    Peter Thane

    No I do not think anything has changed to amend this. BarTender is a label printing program and not designed in it's basic form to carry out maths functions. It does do some automatically as part of the process, such as calculating check digits of barcodes but for anything else then you either need to perform these functions outside of BarTender and then tell it what to print or else use the inbuilt VB script to achieve this. 

    Sorry I am not sure, all my stuff is self taught from either messing around with it or from googling solutions on line and modifying and implementing these to suit. I expect there maybe courses etc you can go on to learn how to program VB/VB script if you want to go that far.

    1

登入寫評論。