I have a GetDates function like this:
GetDates(BOM : Record "BOM Component";VAR StartDate : Date;VAR EndDate : Date)
// Called from OnAfterGetRecord in form 36
IF BOM.GET("Parent Item No.",BOM."Line No.") THEN BEGIN
//MESSAGE(FORMAT(BeginDate));
StartDate := BeginDate;
EndDate := EndDate;
END
And I hava a from 36 where I call the function:
//ItemAdditionBeginDate := 0D;
ItemAdditionBeginDate := ItemAdditionHallo.BeginDate;
//ItemAdditionEndDate := 0D;
ItemAdditionEndDate := ItemAdditionHallo.EndDate;
ItemAddition.GetDates(Rec,ItemAdditionBeginDate,ItemAdditionEndDate);
ItemAddition.GetRegelkorting(salesLine, ItemAddition.Regelkorting);
But the problem is dat every time you add a new date in the form it copies the value to the other row, like this:
So how to solve that the dates are not been copied.
Thank you
I declare getDates in TABLE 50012:
GetDates(BOM : Record "BOM Component";VAR StartDate : Date;VAR EndDate : Date)
// Called from OnAfterGetRecord in form 36
IF BOM.GET("Parent Item No.",BOM."Line No.") THEN BEGIN
//MESSAGE(FORMAT(BeginDate));
StartDate := BeginDate;
EndDate := EndDate;
END
And this is for setDates:
SetDates(BOM : Record "BOM Component";VAR StartDate : Date;VAR EndDate : Date)
// Called from OnValidate of start and end dates in form 36
BOM.INIT;
"Item No." := BOM."Line No.";
"Parent Item No." := BOM."Parent Item No.";
//Stuklijst."Line No." := BOM."Line No.";
StartDate := StartDate;
EndDate := EndDate;
IF NOT MODIFY THEN
INSERT;
oke, I have it now like this:
SetDates(BOM : Record "BOM Component";VAR startDateparm : Date;VAR EndDateparam : Date)
// OnValidate of start and end dates in form 36
BOM.INIT;
"Item No." := BOM."Line No.";
"Parent Item No." := BOM."Parent Item No.";
BeginDate := startDateparm;
EndDate := EndDateparam;
IF NOT MODIFY THEN
INSERT;
but the dates are still copying from the previous record. If I go to a other record:
Thanks for answer my questions about your process. Check the last image. you are inserting or modifying the BOM table.
This is your code:
SetDates(BOM : Record "BOM Component";VAR StartDate : Date;VAR EndDate : Date)
// Called from OnValidate of start and end dates in form 36
BOM.INIT;
"Item No." := BOM."Line No.";
"Parent Item No." := BOM."Parent Item No.";
//Stuklijst."Line No." := BOM."Line No.";
StartDate := StartDate;
EndDate := EndDate;
IF NOT MODIFY THEN
INSERT;
If you check the las image you can see the parameters StartDate
and EndDate
are correct, but when you assign this values to BOM table fields (StartDate, EndDate
) the values are in blank.
This happend because your parameters have the same name as the fields the BOM table
Change your code for this:
SetDates(BOM : Record "BOM Component";VAR parmStartDate : Date;VAR parmEndDate : Date)
//Declare new variable of BOM table, recBOM - record - BOM
// Called from OnValidate of start and end dates in form 36
recBOM.INIT;
recBOM."Item No." := BOM."Line No.";
recBOM."Parent Item No." := BOM."Parent Item No.";
recBOM.StartDate := parmStartDate;
recBOM.EndDate := parmEndDate;
IF NOT recBOM.MODIFY THEN
recBOM.INSERT;