Skip to main content

Search

Search

Prompt Screen Data Populated From A Database?

Comments

8 comments

  • Avatar
    Michael Toupin (mtoupin

    If you do a data entry field connected to the database field that you're wanting to display than it will show the results of the query at print time. 

     

    Conditional printing like you're talking about is only available in BarTender 10.1, you can automatically populate a field based off of another value in that version, but not in previous ones.

    0
  • Avatar
    Legacy Poster

    Struggling a bit with your wording so not sure if I can or can't do what I want to do on my label but assume not. Not sure how that fits the other option I thought may be possible. Can I alter the contents of the filled in (or the defaulted contents) of a screen prompt field before printing?

     

    I do a calculation in a VB script taking a filled in prompt field "bags per pallet" and multiply it by a database field "bag weight" and print that result on the label as a barcode. I check the database field to see if it has a bag weight first and if it does I do the calculation. If it is a "tote" it won't have a bag weight but there is an optional screen prompt field that they may enter in if they know the total weight of the tote ahead of time. If something is in that field I replace the calculated value with the contents of that field. 

     

    If Field("Glaicer.Weight") > " " Then

    Value = Format.NamedSubStrings("PerPallet").Value * Field("Glaicier.Weight")

    Else

    Value = ""

    End If

     

    If Format.NamedSubStrings("ToteWgt").Value > " " AND Field("Glaicier.Tote") = "T" Then

    Value = Format.NamedSubStrings("ToteWgt").Value

    End If

     

    Is there a way that I can change the contents of "PerPallet" to be "1" if "Glaicier Tote" = "T"  before it prints the label or am I stuck with the contents from the prompt screen?

    0
  • Avatar
    Domingo Rodriguez
    Moderator

    Is there a way to display that field content on the
    prompt screen seeing the database is accessed prior to bringing up the prompt
    screen or isn't it possible to display any of the database fields on a prompt
    screen?

     

    Yes, this is possible. You would just need to place a text object on your label (or even out of the label design if you don't wish to print it) which will read from the database field "Type". You will then access the "More Options" button for the sub-string and configure a "Prompt" at print time. If you want, you can even make this field appear as "Read Only" in BarTender's data entry form.

     

    At print time, the value of the database field which results from querying the database will be shown in BT's data entry form.

    0
  • Avatar
    Legacy Poster

    That helped, thanks. I think they will be OK for them. On the prompt screen at least now they will know if the item they are printing pallets labels for is a bag item# or a Tote item number and if they are paying attention, they need to replace the default screen data field "Bags per Pallet" with a quantity of 55 with a 1. If they don't, the labels will print saying there are 55 tote bags on the pallet which can't be seeing each one weighs in excess of 1200 lbs.

     

    I'd like to be able to replace the default field value of 55 with 1 during the print process even if they didn't change it on the prompt screen. Is there a place or an event where I can use VB code to make that change to the screen data field "Bags per Pallet" before the first label prints? I'm only wanting to make that change if the database Tote field contains a T. 

    0
  • Avatar
    Domingo Rodriguez
    Moderator

    Yes, also via the "More Options..." button for the sub-string which should show the "Bags per Pallet" quantity, you can make use of "VBScript", "OnProcessData". Paste your code there and check if it works correctly.

     

    You could also create a text object with a sub-string which uses a source of "VBScript" (rather than database field). As the script type, you would choose "EventControlScript". This way, you can control what information to present at different events. E.g. You can use the "OnPostPrompt" event to verify the data entered by the operator at the data entry form, and change it if necessary by using conditional VBScript.

    0
  • Avatar
    Legacy Poster

    Thanks, that first option worked just fine. Added VBScript to the BagsPer Pallet Screen data field, I  checked that new prompted data field sourced from the database and if it's a T, I replace the existing value with 1.

     

    If Field("Glaicier.Tote")<>"T" Then

        Value = Value

    Else

    Value = 1

    End If  

     

    The screen shows the default value of 55 for the field but as long as my script changes the quantity to 1 before printing I'm good with that.

     

    I didn't understand how to use that second option you suggested. I didn't see how a new text object of VBscript would get used but assumed it was a non-printed work field on the label. I used pretty much the same logic loading the initial value from bagsPer Pallet. It ended up changing the BagsPer Pallet field to one (not on the screen) but then the next time I printed the label, the default qty was now 1 instead of 55. I scrapped that idea and went back to the original code. How that should have worked? A question for my education only seeing the code I inserted works fine and I'm happy with the way it executes.  Just curious how the other option should have worked if I had coded it properly? Would the screen have showed the quantity of 1 and reverted back to the default value of 55 if the item prining was not a tote?

    0
  • Avatar
    Domingo Rodriguez
    Moderator

    With the "EventControlScript" VBScript, you just need to make sure that you write the correct data at the appropriate event. If you would like BT on design screen to show a certain value, then use "OnAutoSelectedEvent". By adding some extra code under "OnPostPrompt" you can programmatically modify which value will be displayed for that data source.

     

    For testing purposes, you could create a new BarTender document from scratch and then just place a text object on the label which makes use of the "EventControlScript" VBScript. You can then assign a different value (Value = XY") at the different events and play a bit with the results. 

    0
  • Avatar
    Legacy Poster

    I had a similar problem.  The users wanted to view a database field on the Data Entry screen and possibly enter a different value. 

     

    In Designer 10.1 SR4, you can create a Data Entry Control for a database field.  Within Designer, this allows overwriting.  When the same label is run form Web Print Server, however, the Data Entry control is Read-only.

     

    So in order to provide the users with the desired functionality, I moved the original database field to the side and made it white (on white).  I added a new embedded data field with a Data Entry Control with the prompt "FieldX to appear on label:"  This allowed them to see both fields.  They were instructed to "Update Preview" in order to see the database data, since the information from the last run will be retained.

    0

Please sign in to leave a comment.