Skip to main content

Search

Search

Date Offset With Date Picker At Time Of Print.

Comments

2 comments

  • Avatar
    Ian Cummings
    Moderator

    Set the manufacture date to be a named data source.  The expiry date should use a VB script expression in the data source.  In the VBS expression use the DateAdd() function to add 42 days to the value of the manufacture date.  Its possible that you might need to use an event based VB script for this.

    0
  • Avatar
    Legacy Poster

    Managed to get it working. Created a VB event script.

     

     

    This code should be applied to the "Expiry Date" and make the manufacture date a named source named "ManufactureDate". The code should be placed in the "Transforms" section of the Data source and is "OnProcessData".

     

    Made this code for "Days e.g 42 days":

     

    'Example: Value = Value + "123", will append 123 to the data source value.
    NewValue = DateValue(Format.NamedSubStrings("ManufactureDate").Value) + "42"
    
    Value = FormatDateTime(NewValue,1)
    

    And this code for "Months e.g. 3 Months"

    'Example: Value = Value + "123", will append 123 to the data source value.
    NewValue = DateValue(Format.NamedSubStrings("ManufactureDate").Value)
    
    NewDateValue = DateAdd("m",3,NewValue)
    
    Value = FormatDateTime(NewDateValue,1)
    

    The values in bold below are the values which are variable.

     

    For Days

    NewValue = DateValue(Format.NamedSubStrings("ManufactureDate").Value) + "42"

     

    For Months

    NewDateValue = DateAdd("m",3,NewValue)

     

    Hope this helps other people.

     

    Thanks.

    0

Please sign in to leave a comment.