Skip to main content

Search

Search

Calculating A Date Using A Dropdown List

Comments

5 comments

  • Avatar
    Legacy Poster
    Hello
    I am not sure if this is possible or not

    We have some products which we send out as samples
    Now these samples have a date they are tested and another date on which they need to be retested
    I have created two text field and have the first one on the current date
    The second one can be offsetted using the bartender date offset option
    But thats fixed

    What i need is have a dropdown box in the prompt window
    Which prompts the user to select the time frame of the retest in no of months From 1 to 12 months.

    Depending on the selection the second field auto populates by adding 3 months from the system date and so on

    Can someone please show me how i can do this
    I have attached the .btw file

    Thanks in advance
    0
  • Avatar
    Shotaro Ito
    [quote name='RahulF' timestamp='1336634549' post='2375']
    Hello
    I am not sure if this is possible or not

    We have some products which we send out as samples
    Now these samples have a date they are tested and another date on which they need to be retested
    I have created two text field and have the first one on the current date
    The second one can be offsetted using the bartender date offset option
    But thats fixed

    What i need is have a dropdown box in the prompt window
    Which prompts the user to select the time frame of the retest in no of months From 1 to 12 months.

    Depending on the selection the second field auto populates by adding 3 months from the system date and so on

    Can someone please show me how i can do this
    I have attached the .btw file

    Thanks in advance
    [/quote]

    Hi RafulF,
    when datasouce has offset value, you can use More Option(Transform) > OnProcessData Event to create a date with offset.
    DateAdd function would help.

    [code]
    'create offset date from current value'
    oDate = DateAdd("m", Value, Date)

    'format date'
    oMonth = Month(oDate)
    if oMonth < 10 Then oMonth = "0" & oMonth

    oDay = Day(oDate)
    if oDay < 10 Then oDay = "0" & oDay

    Value = oDay & "." & oMonth & "." & Year(oDate)
    [/code]

    see attached document.
    0
  • Avatar
    Legacy Poster
    Hi Shotaro
    Thanks for your help
    It is exactly what i wanted to do
    i've done it exactly like you have said
    But for some reason the date don't change on my label
    Can you have a look at my .btw file and advise me when i am going wrong
    I am using your code as it without any changes
    and i can't get it to work and i don't know why

    0
  • Avatar
    Shotaro Ito
    Your format working fine here - Is there any error shown? How about when print preview? Did my sample posted worked in your environment?
    0
  • Avatar
    Legacy Poster
    Its working now
    Thanks for your help Shotaro - Your a legend

    0

Please sign in to leave a comment.