Skip to main content

Search

Search

2 Different Date Format, One Prompt For The User

Comments

7 comments

  • Avatar
    Ian Cummings
    Moderator
    What version/build of BarTender is in use? Yes this will make a huge difference to the answer.
    0
  • Avatar
    Legacy Poster
    Hi Ian

    We are using BarTender Automation - Version 9.4 SR1 Build 2760

    Kind regards,,

    Erik
    0
  • Avatar
    Ian Cummings
    Moderator
    I suggest you upgrade to the latest service release for starters:

    http://www.bartenderbarcodesoftware.com/label-software/fixes_94.aspx

    Unfortunately, there were many changes in v10 to make handling dates much easier, therefore we will need to do this the old way by VB script.

    In my example we will assume that the date prompt is under a sub-string share name of "btDate" which we can then reference in code:

    Value = DatePart("d", Format.NamedSubStrings("btDate").Value) & UCase(MonthName(DatePart("m", Format.NamedSubStrings("btDate").Value), True))

    Value = DatePart("y", Format.NamedSubStrings("btDate").Value) & DatePart("m", Format.NamedSubStrings("btDate").Value) & DatePart("d", Format.NamedSubStrings("btDate").Value)

    Note that instead of concatenating these VB script expressions into a single line, you could split them up into separate sub-strings to specify validation rules such as minimum number of digits padding on the left with zero when needed.
    0
  • Avatar
    Legacy Poster
    Thanks for your help so far Ian,

    I just tested this and this seems to work, however I need to do quite some with truncation and combining fields, but works.

    Thanks again,

    Erik
    0
  • Avatar
    Legacy Poster

    I also would like some help with this type of problem.

    I need the date in the barcode and barcode human readable to be YYMMDD (SSCC format) and a 2nd text field to be DD/MM/YYYY from one user input.

     

    Any help

    Thanks

    David

    0
  • Avatar
    Canguita

    Hello David P.

     

    Thank you very much for your post.

     

    In this case that you can do is:

     

    1. Create a text in your label and provided it with a shared name (for example MyDate)
    2. Link this text with a Text Input Box
    3. In your BarCode add a VBscript as datasource with "Event Control Scripts" as Script Type. This VBscript should have this code in OnPostPrompt event

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

     

    After on each object you will need to format the Date as you need.

     

    I've attached you a very simple file where you will find that you need.

    0
  • Avatar
    Legacy Poster

    Thanks for the demo file - That works for me

    0

Please sign in to leave a comment.