Copying Narration from customised table to G/L Entry table

lavanyaballurgi
Member Posts: 235
Hello experts,
The requirement was to copy first 5 lines of Narration stored in "Posted Narration" table (customised table) to a new field created in "G/L entry" Table. The field in "Posted Narration" table correspond to G/L entry are "Document No. & Posting Date". Now I made a report with a button & made this code to run on button.
WITH lrc_glentry DO BEGIN
ltx_Narration := '';
lin_count := 0;
lrc_PostedNarration.SETCURRENTKEY("Document No.","Posting Date");
lrc_postednarration.SETRANGE("Document No.",lrc_glentry."Document No.");
lrc_postednarration.SETRANGE("Posting Date",lrc_glentry."Posting Date");
IF lrc_postednarration.FINDFIRST THEN
REPEAT
ltx_Narration := ltx_Narration + lrc_postednarration.Narration +'';
lin_count += 1;
UNTIL (lrc_postednarration.NEXT=0) OR (lin_count <= 5);
lrc_glentry.Narration := ltx_Narration;
lrc_glentry.MODIFY(FALSE);
END;
Now the error shows "G/L Entry Entry No. '0' does not exist"
What Am I missing?
The requirement was to copy first 5 lines of Narration stored in "Posted Narration" table (customised table) to a new field created in "G/L entry" Table. The field in "Posted Narration" table correspond to G/L entry are "Document No. & Posting Date". Now I made a report with a button & made this code to run on button.
WITH lrc_glentry DO BEGIN
ltx_Narration := '';
lin_count := 0;
lrc_PostedNarration.SETCURRENTKEY("Document No.","Posting Date");
lrc_postednarration.SETRANGE("Document No.",lrc_glentry."Document No.");
lrc_postednarration.SETRANGE("Posting Date",lrc_glentry."Posting Date");
IF lrc_postednarration.FINDFIRST THEN
REPEAT
ltx_Narration := ltx_Narration + lrc_postednarration.Narration +'';
lin_count += 1;
UNTIL (lrc_postednarration.NEXT=0) OR (lin_count <= 5);
lrc_glentry.Narration := ltx_Narration;
lrc_glentry.MODIFY(FALSE);
END;
Now the error shows "G/L Entry Entry No. '0' does not exist"
What Am I missing?
0
Answers
-
Where did you write code to get lrc_glentry record?0
-
WITH lrc_glentry DO BEGIN.... will not work?/?
If so shall I make a report based on G/L Entry as dataitem instead of FOrm?0 -
You have to either get the g/l entry and repeat through all records or simply create report with g/l entry dataitem and write above code in OnAftergetrecord trigger..0
-
what should I write to get all G/L entry?
IF lrc_glentry FINDFIRST THEN
END;
should work i guess???0 -
IF lrc_glentry FINDSET THEN REPEAT // your code UNTIL lrc_glentry.NEXT=0;
Please read some basic technical documents..0 -
better use FINDSET.lavanyaballurgi wrote:WITH lrc_glentry DO BEGIN.... will not work?Microsoft Certified IT Professional for Microsoft Dynamics NAV
Just a happy frood who knows where his towel is0 -
Thanks... will read :-)0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions