Hey Guys.. its Sunday & I am working to complete my assignment. well here is my issue
I want to concatenate data from first 5 lines of text field named "Bill Detail"(customized field) present in Sales line .. into a text field of sales header named "invnarration". My code works but it doesnt update the last line's data in header field. why?
Here is my code
lin_counter := 0;
lrc_SalesHeader.GET("Document Type", "Document No.");
lrc_SalesLine.SETRANGE("Document Type", "Document Type");
lrc_SalesLine.SETRANGE("Document No.", "Document No.");
lin_SalesLineCounter := lrc_SalesLine.COUNT;
IF lrc_SalesLine.FINDSET THEN
REPEAT
lin_counter += 1;
IF lin_counter < lin_SalesLineCounter THEN
ltx_Narration += lrc_SalesLine."Bill Detail" + ' '
ELSE
ltx_Narration += lrc_SalesLine."Bill Detail";
UNTIL (lrc_SalesLine.NEXT = 0) OR (lin_counter = 6);
MESSAGE(ltx_Narration);// just to check ltx_narration variable.
lrc_SalesHeader.InvNarration := ltx_Narration;
lrc_SalesHeader.MODIFY(FALSE);
0
Answers
1) Why you are using the lin_SalesLineCounter at all?
2) Why you are getting the SalesHeader, when you already have it in Rec?
Cleared code:
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
By the way using you code I am getting this error
Microsoft Dynamics NAV Classic
The Sales Header does not exist.
Identification fields and values:
Document Type='Quote',No.=''
OK
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
right?
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
well I want to update the salesheader.invnarration field everytime someone enter data in salesline."Bill detail".
Shall I put the code on "Bill Detail" - OnValidate? Or you can propose me a better location?
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
If I want to update Invnarration before posting the invoice so where should I put the code? Codeunit 80 or 81?
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Why its not a good idea to put the codes in codeunit which runs after we push "post" button?
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.