Hi guys.
I have a table Header (prim.key=No.) and Line (prim.key=Line No., Header No.) where Header No. is No. from header table because Header Card is connected to Lines listpart using this field.
In my Line table, in OnInsert() i have the code which makes sure i get the date from Header on Line:
IF Header.GET("Header No.") THEN
Date := Header.Date;
It works fine when i first enter the Date in Header and insert something on Line.
But when I wish to change the date on Header it doesn't get changed on Line.
What should I do?
I want, when i change the Date on Header Card, for Nav to check if there are existing lines for that header, and if there are, to ask if I want to change the date. If I confirm, date gets changed on Line. If not, it doesn't.
I really appreciate your help
Thanks
Answers
in the section: Order Date - OnValidate()
as this code does not exist yet, you have to write it yourself.
I have done this and created function needed but it only displays message without actually changing the date on my Line
As Kishorm said, you can find a clear example on the field Shipment Date.
OnInsert()
...
...
Posting Date - OnValidate()
UpdateLines(FIELDCAPTION("Posting Date"),CurrFieldNo <> 0);
...
...
LOCAL LinesExist() : Boolean
Line.RESET;
Line.SETRANGE("Header No.","No.");
EXIT(Line.FINDFIRST);
LOCAL UpdateLines(ChangedName : Text[250];AskQuestion : Boolean)
IF NOT LinesExist THEN
EXIT;
IF AskQuestion THEN
Question := STRSUBSTNO(Txt1,ChangedName);
IF GUIALLOWED THEN
IF DIALOG.CONFIRM(Question,TRUE) THEN BEGIN
END
ELSE
EXIT;
Line.LOCKTABLE;
MODIFY;
Line.RESET;
Line.SETRANGE("Header No.","No.");
IF Line.FINDSET THEN BEGIN
REPEAT
CASE ChangedName OF
FIELDCAPTION("Posting Date"):
IF Line."Header No." <> '' THEN BEGIN
Line.VALIDATE("Price Date","Posting Date");
Line.MODIFY;
END;
END;
UNTIL Line.NEXT = 0;
END;