Datefield on request form

NabucoNabuco Member Posts: 65
Hi all
Being rather a novice in Navision coding i have a problem and can't se the solution myself:

In a report (2009 SP1) I have defined a Global var. with type Date. Have placed this in on the requestform with a calculated initial value - shows correctly.
When user alter this date I get the error-message: The date formular '011010' contains a number that is too large. The number must be in the range 0-9999.

Why numbers in a date-field?
Anyone know a solution to this?

Thanks in advance

Answers

  • SavatageSavatage Member Posts: 7,142
    So you created a new variable type DATE.

    With that you can enter any date into that field ...
    ...but the below messages shows something else is going on here.

    The two things in your message I would look at are:
    "with a calculated initial value.."
    "The date formula....."


    What is your code?
    What formula are you using?
    What are you trying to accomplish?
  • NabucoNabuco Member Posts: 65
    Hi thanks for taking time to view this.

    The Global var. of type DATE I initiate with a datecalc.:

    MaxDate := CALCDATE('<-7Y>',TODAY);
    RemDate := Maxdate;

    The Then user should be allowed to enter another date in MaxDate and I will make a check to ensure that the date cannot be later than the RemDate (IT is to be used when delete som very special journals which by law we are obligated to keep for at least 7 years.
  • vaprogvaprog Member Posts: 1,141
    Nabuco wrote:
    I will make a check to ensure that the date cannot be later than the RemDate
    How did you program that check?

    If you activate the debugger while entering the date on the request form, what code causes the error (gets the focus in the debugger)?

    Did you set any properties or triggers on the control for MaxDate?
  • SavatageSavatage Member Posts: 7,142
    You say a user should be able to enter another Maxdate.

    But Maxdate isn't what the users are actually changing.
    they are changing the value of "TODAY" in your maxdate calculation.

    So you need to accomplish figuring that out.

    Like they can either enter a date or it uses today as a default, or how ever you want it to be.
    eith that or just make the remdate = entered date directly in some part of the code.

    perhaps you're missing something you didn;t mention beacuse it soulds like it should work.
  • NabucoNabuco Member Posts: 65
    Thanks both to Vaprog and Savatage for taking time to look at this.
    Sorry Vaprog, the debugger does not help here, the error turn up before debugger catch the error.

    Savatage, it is on the "InitReport" trigger I initiate the MaxDate and REMdate.

    I use Integer as run-tabel with MaxIteration=1 and then on the requestform the user has the opportunity to amend this MaxDate and then on the "OnAfterGetRecord" trigger I have the following:

    IF MaxDate > RemDate THEN
    ERROR('Txt001');
  • vaprogvaprog Member Posts: 1,141
    Your programming, as far as you told us, will work.
    vaprog wrote:
    Did you set any properties or triggers on the control for MaxDate?
    Please check the DateFormula property on the control for MaxDate on the request form.
  • NabucoNabuco Member Posts: 65
    Vaprog: Thanks for the "eyeopener". Unintentionally the property was set to YES - it Works fine now
Sign In or Register to comment.