How to insert a new record in a table after the last record

dynamicsha
Member Posts: 20
How to insert a new record in a table after the last record at run time in microsoft nav through code and transfer the all the fileds of the existing record to the new inserted fields
0
Comments
-
can you explain further??Thinking, programming, coding, developing == Music!0
-
[Topic moved from 'NAV 2009' forum to 'NAV/Navision' forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
If you want to generate Autonumber for new record, you can use No. Series or get last record and increase number by INCSTR function. To copy data from other record you can use TRANSFERFILEDS function.
Yes, euekim is right, If you explain your requirement in details members can help you easily.Rakesh Patel
Navision Developer0 -
If you want to generate Autonumber for new record, you can use No. Series or get last record and increase number by INCSTR function. To copy data from other record you can use TRANSFERFILEDS function.
Yes, euekim is right, If you explain your requirement in details members can help you easily.0 -
I have a table GL Entry.. it has a field Tax amount. This tax amount field is zero for some record and noon zero for some.. i have to insert a new record if i found a tax amount field non zero and transfer its content to new record dat is added in last0
-
Its not advisable to enter records in G/L entry table by customized code, but if its necessory, you can do like this,
GLEntry.RESET;
IF GLEntry.FIND('+') THEN BEGIN
GLEntryNew.INIT;
GLEntryNew."Entry No." := GLEntry."Entry No.";
GLEntryNew.TRANSFERFIELDS(GLEntry,FALSE);
//You can change some field values here, if you want
IF NOT GLEntryNew.INSERT THEN
ERROR('Error Message');
END;Rakesh Patel
Navision Developer0 -
thank rakesh..0
-
dynamicsha wrote:I have a table GL Entry.. it has a field Tax amount. This tax amount field is zero for some record and noon zero for some.. i have to insert a new record if i found a tax amount field non zero and transfer its content to new record dat is added in last
[-X [-X [-X [-X [-X [-X [-X [-X [-X
ABSOLUTELY DO NOT DO THIS.David Singleton0 -
If you need to make any corrections in the GL accounts, you can use your procedure to generate lines in the General Journal, which afterwards to post. I think this is a better approach.
Further on, I would ask you what is the "non-technical" part of your requirement, why you want to interfere into the GL entries? If it is for correcting a wrong posting, then I strongly advice you to do it through a General Journal.Boris
*
Please, do not frighten the ostrich,
the floor is concrete.0 -
rmpatel22 wrote:Its not advisable to enter records in G/L entry table by customized code, but if its necessory, you can do like this,
GLEntry.RESET;
IF GLEntry.FIND('+') THEN BEGIN
GLEntryNew.INIT;
GLEntryNew."Entry No." := GLEntry."Entry No.";
GLEntryNew.TRANSFERFIELDS(GLEntry,FALSE);
//You can change some field values here, if you want
IF NOT GLEntryNew.INSERT THEN
ERROR('Error Message');
END;
This must be the worst advise ever. ](*,) ](*,) ](*,) ](*,) ](*,)David Singleton0 -
David Singleton wrote:This must be the worst advise ever. ](*,) ](*,) ](*,) ](*,) ](*,)0
-
Hi David Singleton, I agree that my advise is wrong thats why in beginning I mentioned "Its not advisable to enter records in G/L entry table by customized code, but if its necessory"
dynamicsha, don't do it as per my advise, All experts also telling not to add record G/L Entry table by this way.Rakesh Patel
Navision Developer0 -
rmpatel22 wrote:Hi David Singleton, I agree that my advise is wrong thats why in beginning I mentioned "Its not advisable to enter records in G/L entry table by customized code, but if its necessory"
dynamicsha, don't do it as per my advise, All experts also telling not to add record G/L Entry table by this way.
if someone asks you how to set their head on fire, the correct advise is to tell them NOT to set their head on fire, you don't suggest it as a bad idea and then show them how to do it*.
* OH wait I did that didn't IDavid Singleton0 -
Really? I thought it was cool to randomly create copies of G/L Entry records
There is nothing random with this code, it will always error out, so it is mostly harmless \:D/0 -
SLF25 wrote:Really? I thought it was cool to randomly create copies of G/L Entry records
There is nothing random with this code, it will always error out, so it is mostly harmless \:D/
Well spotted, I didn't even read it in detail. But yes the ERROR('Error Message") will pop up every time.David Singleton0 -
SLF25 wrote:There is nothing random with this code, it will always error out, so it is mostly harmless \:D/Kai Kowalewski0
-
Kowa wrote:There are NSC's where you will get fired instantly for code like this that writes directly to a ledger table without using the proper posting routine. [-X
In Germany maybein some other countries maybe not.
David Singleton0
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