Skip to main content

Search

Search

How to use value from drop down list as a value in another objects script

Comments

8 comments

  • Avatar
    Joe Knight

    So I have progressed 1 step further in learning.  I can now make it display on the label itself.  I linked the part number label to the named datasource, which is the linked data source for the drop down.  That made it so when I picked a value in the drop down that became the new named datasource, then I used selection=Format.NamedSubStrings("DropDownList").Value in the script on the quantity field on the label and it shows the quantity based on what I pick

    Perfect, except I need the quantity to ALSO update on the drop down list as I am selecting.  It needs to be able to be manually adjusted if the quantity is different for this specific job.

    I have a quantity box on the Data Entry Form but it remains empty no matter what I pick, until I click OK and go to the actual label at which time it is populated from the script.  The script currently resides in the OnNewRecord subroutine.  If I move it to the AutoSelectedEvent, then it populates instantly but only with the default first item in the drop down.  It doesn't change after each selection, nor does it change when I go to the label.

    Any help out there?

    0
  • Avatar
    Peter Thane

    Hi Joe,

    I think it is all a time a thing when the "events" are actioned. Autoselected is when the label is opened so not what you want I dont think and I think the OnNewRecord is prior to the Data Entry/Prompting screens. The OnNewRecord is more connected with Database connections rather than dropdown list situations (ie via the Database Connection Setup for database sourced fields).

    Pete

     

    0
  • Avatar
    Peter Thane

    Hi Joe,

    I just had a chance to do some testing and I am not sure you can do what you want but if you email me through a copy of your label format I can have a look and and see if there is an alternative route. My email address is info (at) dcatonline.co.uk

    Pete 

    0
  • Avatar
    Shotaro Ito

    BarTender's data entry form cannot refer to currently entered value on the form.

    Similar issue discussed in here with an alternative - you can get 2 fields in once, duplicate the text by Object Value, then remove first half / bottom half.
    https://support.seagullscientific.com/hc/en-us/community/posts/216550387-List-Box-Selection-To-Populate-Multiple-Substrings-Values-From-Excel-File

    0
  • Avatar
    Joe Knight

    I figured out how to do what I was trying to do.  I had a simple input form with a drop down list pulling its list items from a parts database.  I picked a part.  The second field was a manual (optional) quantity field.  If data was entered I wanted that quantity printed on the label, if it was left blank then I wanted the quantity pulled from the database based on the part number.  The 3rd field was just a lot number manual entry linked to a label.

    I linked the drop down list to a named data source so that whatever value I choose would end up on the label which referenced the named data source as its source.  Then in the quantity label, initially it was just pulling the quantity from the database based on the part number.  What I ended up doing was creating a second named data source and linking that to the quantity input field on the form.  I then edited the input label on the label and added in a quantity variable and threw in an if then statement that said if the quantity named data source was 0 (default - meaning the input form was left blank), then pull from the DB, threw in an else statement at the end that said value=quantity (from the named data source), and it works perfectly.

    If I don't enter a quantity the named datasource remains a value of 0 and the script pulls it from the database, if I enter something it's not 0 and the "else" fires and uses whatever value the named data source now has from the input on the form

    ~dim statements

    selection=Format.NamedSubStrings("DropDownList").Value
    quantity=Format.NamedSubStrings("QuantityField").Value

    If quantity = 0 then

    original script pulls quantity from db

    else

    value = quantity

    end if

    0
  • Avatar
    Aziz Adilov

    Hello Joe Knight,

     

    I'm new to Bartender. I saw your solution and it seems like it might work for me.

    I'm trying to create a label/form with two related objects. In object 1 user inputs products sku and object 2 is populated with product description for the sku in object 1, pulled from excel database( my first though was to use Vlookup function, which I tried in VB Script, but I got an error, I'm not very good at that). I need to do similar thing for two more objects, but it should be the same process as for object 1 and 2.

    I think I understand what you did with your process, just don't know how. There is so much information on bartender online, I can't organize it to figure out how to do what I need to do.

    If you could point me to topics describing the steps you took or if you have an idea on how should I approach my process.

     

    Thank you,

     

    Aziz.

    0
  • Avatar
    Peter Thane

    Hi Aziz,

    It sounds like for your solution all you need to do is link the label to your spreadsheet as a database connection and then create a filter for the SKU input field, linking all the appropriate label fields to the matching columns in the spreadsheet.

    That would be far simpler than trying to use VB to do this for you.

    Pete

    0
  • Avatar
    Aziz Adilov

    Thank you very much for your suggestion, Pete!

    I'll give it a try.

    Regards,

    Aziz.

     

    0

Please sign in to leave a comment.