I'm quite new at Navision and could use some help. I have written a codeunit to summarize some detail journal lines and then export the summary to a flat file. The user needs to be able to enter an end date. Because there is no Request form, I created a small form to enter the date with a command button to process it. In the OnPush trigger of command button, I put code that called a function in my codeunit and passed a ByVal parameter with the date. The codeunit does not seem to like the datatype of the parmeter. An error message indicates the parameter is not a valid date. I did try using the VARIANT2DATE function, but that didn't seem to work.
Should I use a form like this to get the date?
How do I get the function to recognize the date so I can filter on it?
Thanks,
Shelley
SGM
0
Comments
I think you can use this one instead of creating an extra form to ask for the date.
Another remark : If you want to create a file, it's better to use a dataport instead of a codeunit
Francis
But I think that using a Data port is more easy program a export/import of values.
Variables
Name DataType Subtype Length
Mov_ Contab Record G/L Entry
Window Dialog
Date1 Date
date2 Date
//Ask for date
Window.OPEN ('Insert Min Data filter #1#######'+
'Insert Max Data Filter #2#######',Date1,date2);
Window.INPUT(1,Date1);
Window.INPUT(2,date2);
Window.CLOSE;
//control filters
IF(date2 > Date1) THEN ERROR ('Error');
IF((Date1 =0D) AND (date2=0D)) THEN ERROR('Error');
//aplicate filters
"Mov_ Contab".RESET;
"Mov_ Contab".INIT;
IF(Date1<>0D) AND (date2<>0D) THEN
BEGIN
"Mov_ Contab".SETFILTER("Mov_ Contab"."Posting Date",'%1..%2',Date1,date2);
END
ELSE
BEGIN
IF(Date1<>0D) THEN "Mov_ Contab".SETFILTER("Mov_ Contab"."Posting Date",'%1',Date1);
IF(date2<>0D) THEN "Mov_ Contab".SETFILTER("Mov_ Contab"."Posting Date",'%1',date2);
END;
//....
MESSAGE("Mov_ Contab".GETFILTERS);
Bye
PD: Sorry my English is auful
I will try the dialog window and see if I can get the date that way.
Thank you very much!