To assign values in the Header to the Lines.

Hi Team,

In the Header table, my fields are No. (code=10), PV Type (Option=Purchase of Tbills,Short Term,Staff Advance) Global Dimension 1 Code/Dept.

In the Lines table, my fields are No (code=10), Account Type (Option=G/L Account.Bank Account,Vendor,Customer), Account No.,Global Dimension 1 Code/Dept.

In the Header table under Global Dimension 1 Code Validate() I wrote this below

IF Lines.GET("No.") THEN BEGIN
  IF Lines."Global Dimension 3 Code" = '' THEN
    Lines."Global Dimension 3 Code" := PV."Global Dimension 3 Code";
  Lines.MODIFY;
END;

After run the Page, once I chose Global Dimension 1 Code/Dept in the Header of the page is not reflecting on the Lines

Thanks.

Sorry, but I’m not clear understand your start description. Could you clarify description?

  • I can’t see where you “receive” (find) data for variable PV (it is for PV.“Global Dimension 3 Code”).

Could you set Breakpoint on the line with PV.“Global Dimension 3 Code” and check what data do you have here?

The PV is a variable in the Global Variable and its representing table Header.

Lines.RESET;
Lines.SETRANGE(No,"No.");
IF Lines.FINDFIRST THEN BEGIN
 IF Lines."Global Dimension 3 Code" = '' THEN
   Lines."Global Dimension 3 Code" := "Global Dimension 3 Code";
END;
  

That is the new code I wrote above and after debugging I discovered the Lines.No = ‘’ and there is a relationship between the Header and Lines

which is No=FIELD(No.) under the Lines in the Card

Thanks

and I can see lineS.

if you need to update all lines you need to write loop - something like Repeat…until Lines.Next = 0;

Only want to update Lines.Global Dimension 3 Code once I choose Header.Global Dimension 3 Code in the Page.

Thanks

I think you need to have something like:

Lines.RESET;
Lines.SETRANGE(No,“No.”);
//if you need to update Empty values only you need to write: Lines.SETFILTER(“Global Dimension 3 Code”,’%1’, ‘’)
IF Lines.FINDFIRST THEN
Lines.MODIFYALL(“Global Dimension 3 Code”, “Global Dimension 3 Code”, TRUE|FALSE);

P.S. we can “speak about” - esage of the “Lines.SETRANGE(“Global Dimension 3 Code”,’’)” instead of “Lines.SETFILTER(“Global Dimension 3 Code”,’%1’, ‘’)” or absence|presence of the line “IF Lines.FINDFIRST THEN…” but it is linked with version of NAV and quantity of records in the table…

Lines.RESET;
Lines.SETRANGE(No,"No.");
IF Lines.FINDFIRST THEN
 Lines.MODIFYALL("Global Dimension 3 Code","Global Dimension 3 Code",TRUE);

Its not seeing the Lines.No = ‘’ and its not passing the “Global Dimension 3 Code” of the Header to the Lines

NAV 2018

I added this below code to OnInsert () of Lines(Table)

IF PVHeader.GET(No) THEN BEGIN
  VALIDATE("Global Dimension 3 Code",PVHeader."Global Dimension 3 Code");
END;

Thank you, RedFoxUA