Using VB Script to change one field based on another フォローする

0
Avatar
Thad Larson

I have Bartender 9.3

I would like to have one text field change (Shift #) based on the input of another (OP),

I have the operator place their initials.  Then I want to assign the shift based on the initials.  Basically because I am not smart enough to do a bunch of IF-THEN statements, so I definitely can't run time-based scripts.  GRRR

So I selected Post Prompt for my option.As you can see, my script does not properly run.  Why?

Based on the input, the "2" should be a "1".  But it is always a 2.  Even if I enter initials not on the list.

Any assistance is greatly appreciated.

4 コメント

0
Avatar
trevor callaghan
コメントアクション Permalink

Can't help too much, I've only just started to use Bartender VB. If Bartender VB scripting can handle case statements that would be the way to go

 

Select case value

Case "AA"

value = 1

Case "AB"

value = 2

and so on, but this will hard code the values and is not really the correct way to code VB, if you can get help from someone to show you how to get the values from a file then your VB code won't need to change just the file data, and anyone can do that.

0
Avatar
Pete Thane
コメントアクション Permalink

Just checking that you are using a Data Entry Form (Prompt at Print Time screen) in to which the users enter their initials, if not the OnPostPrompt script will not trigger. 

I have just mocked up something similar here with a Data Entry Form and it works correctly. The only changes to you VB is I have removed the Print Cancel part and instead have set the Data Entry/Form box to require the users enter a minimum and maximum number of characters as 2 otherwise they cannot proceed plus also added a Value = Vale line at the end of the code.

 

FYI: In later versions of BarTender code like this would not be needed as you can link up a data entry box to either an embedded or a file list box where the users choose/type in a value and BarTender takes either this value or a different value in a second field as the screenshot below is setup. If you use the external file type then if new users are needed you just add this to the text file and save it and BarTender will be bale to use these straight away.

0
Avatar
Thad Larson
コメントアクション Permalink

It might be a revisions constraint.  I am using 9.3.  When I go to make a drop-down box in the prompt design screen, the only options that I see are "Screen Data" and "Visual Basic Script".  I do not have an option for "Embedded Data". 

I have used database for items like this, but I have not seen Bartender sort by entry and print accordingly.  I usually have to select the records that I want to print.

0
Avatar
Pete Thane
コメントアクション Permalink

Screen Data = Embedded Data the name changed in a later version

You may not have all the options available in 9.3 as that version of the software was released over 10 years ago and has since been superseded six times with later releases including BarTender 2021 earlier this month. 

When using the external file method, I mentioned above, this is different to your usual database connection that you suing for populating the data fields and so you don't setup the database queries etc. for this.

サインインしてコメントを残してください。