Hello there experts.
I am trying to "INSERT" table row entries while running the report.
I have something like this on the ONAFTERGETRECORD
Count := Count + 1;
TempGLEntry.INIT;
TempGLEntry."No." := FORMAT(Count,5);
TempGLEntry.INSERT;
My problem is that, it wasn't writing the data to the table.
I have tried to use other tables and temporary table too but had no success.
Is it possilble on "REPORT" objects to "INSERT" or create records to other table while it is running?
I just wanted to store some field content from that report, e.g. "GL Account No." that I can use it later for processing and comparison.
Thank you in advance for your advice.
0
Answers
Make sure the code in the OnAfterGetRecord trigger is actually executing. (What is your data item and what are the filters on it?)
Since you're not setting "Entry No." which is the primary key for "G/L Entry" and you're not catching the INSERT with a conditional my guess is it is not executing at all. Otherwise you'd get an error that says the entry already exists.
My Blog - nav.education
Why are you inserting GL Entries anyway? You should not be doing that. Create general journal lines and post those and let NAV take care of processing those into GL entries.
RIS Plus, LLC
1. Check the Property of the TempGLEntry record variable and ensure the Temporary is set to No.
2. Run your report through the debugger and ensure the report is looping properly.
3. Make sure you know what you're doing by inserting directly into the G/L Entry table or else the Navision Gods will strike down on you without mercy.
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
2. in a report you can insert / modify / delete datas in real tables also in temp. tables
3. use debugger to see what your report do
4. Do you really want to insert G/L Entries in the database or only temp. for example for a special sort :?:
Regards
I actually have an existing report based on GLEntry table. It works fine. But I have another report requirement that is the same "Detailed Report" but the Total Per GL Account Summary should be greater than 100K.
So I was planning to create two DATAITEMS.
a. The first one would be non-printing, and should be able to create GL Code and accumulate the amount. (THIS IS THE PART WHERE I WOULD LIKE TO CREATE A RECORD)
PROBLEM: I have to use a temporary table to store the content.
b. The second dataitem which is the same GL Entry table, but I have to check the existence of it in the temporary "TABLE GENERATED FROM FIRST LOOP", if it is greater than 100K.
Is this a good idea or is there a better way to do it. I am new to accessing or creating temporary table. Thanks a lot.
You should get some training on NAV development, you would be amazed at how simple these things can be.
RIS Plus, LLC
RIS Plus, LLC