Prompt Screen Data Populated From A Database? S’abonner

0
Avatar
Legacy Poster


 

Don't know if this is possible or not but I am on BT 9.4 I'm printing a label that
gets some of its data from a database and other data from prompt fields. When I
go to print, the first prompt is a query prompt for the item# of the database
record I want to retrieve. Once that is validated, I get the normal prompt screen I designed with
the fields I want to print in addition to the fields used from the database.

 

One of the database fields is "Type", a 1 character field that will either be blank or
contain a "T". 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?

 

The user needs to blank out the default value of a prompt field "bags per pallet" if the item they are printing a label for has a T in the "Type" field in the database.

My other option would be to somehow change the contents of the "bags per pallet"
prompt filed automatically if the database record has a T in the "Type" database field.

 

Is either Doable?


 

 

8 commentaires

0
Avatar
Michael Toupin (mtoupin
Actions pour les commentaires Permalien

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
Actions pour les commentaires Permalien

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
Modérateur
Actions pour les commentaires Permalien

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
Actions pour les commentaires Permalien

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
Modérateur
Actions pour les commentaires Permalien

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
Actions pour les commentaires Permalien

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
Modérateur
Actions pour les commentaires Permalien

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
Actions pour les commentaires Permalien

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.

Vous devez vous connecter pour laisser un commentaire.