Aller au contenu principal

Recherche

Recherche

Vbscript Date In Past - Message Not Possible

Commentaires

5 commentaires

  • Avatar
    Shotaro Ito
    Hi Erik,
    You can do custom validation in More Options > VB Script > OnProcessData Event.
    When input value doesn't match with condition, you can use CancelPrinting function to correct.

    ex.
    [code]
    If not isDate(Value) Then
    Format.CancelPrinting("Date Format incorrect.")
    Else
    If CDate(Value) < Date Then
    Format.CancelPrinting("Input date was in past.")
    End If
    End If
    [/code]

    [attachment=39:ErrorIfPastDateInput.zip]

    Hope it helps!
    0
  • Avatar
    Legacy Poster
    Hi Shotaru,

    Thanks for your reply!
    This works for now, but I think we are going to fase a problem when we reach the end year.

    On our labels, the date format needs to be entered as "DD MMM" so for example 17 OCT
    When we are near the end year, and they have to enter a date which is in Januari it also says that the date is in the past.

    Any idea how we can sort this out by VB Script or do we also have to enter a year which will not be printed on the label.

    Thanks in advance,

    Erik
    0
  • Avatar
    Shotaro Ito
    Hi Erik,
    I don't have a beautiful answer as it's not possible to determine past date without input year. (You can assume some condition, though.)

    To strip year from input, use a hidden text.
    Create a text (say"Text 1") above of label, then enable user prompt, set onProcessData VB Script above.
    Create another text("Text 2") on label, select datasource as [Label object string] of "Text 1".
    In more options > Truncate, leave 6 characters from left.

    so result will be
    Text 1: "18 OCT 2011"
    Text 2: "18 OCT"
    0
  • Avatar
    Legacy Poster
    [quote name='Shotaro I -Seagull Support' timestamp='1318905955' post='833']
    Hi Erik,
    I don't have a beautiful answer as it's not possible to determine past date without input year. (You can assume some condition, though.)

    To strip year from input, use a hidden text.
    Create a text (say"Text 1") above of label, then enable user prompt, set onProcessData VB Script above.
    Create another text("Text 2") on label, select datasource as [Label object string] of "Text 1".
    In more options > Truncate, leave 6 characters from left.

    so result will be
    Text 1: "18 OCT 2011"
    Text 2: "18 OCT"
    [/quote]

    Hi Shotaru,

    Once again, thanks for your reply!

    I have managed to get this working on my PC, however I am using the trial Enterprise version.
    Somethings says me that the function "Label Object String" is not possible in the Professional edition.

    Am I right ?

    We have about 6 versions of BarTender Professional running troughout the company.

    Thanks in advance,

    Erik
    0
  • Avatar
    Shotaro Ito
    Hi Erik,
    Label Object String is Available from Professional Edition or above, and that's introduced from somewhere around BarTender 7.7.
    So the solution works if you have recent version of BarTender Professional.
    If you use BarTender 6, (truly thanks if so) then it's a good chance to upgrade to the latest version.
    0

Vous devez vous connecter pour laisser un commentaire.