I want to create function or report which copy and paste record, but in same table.
Example:
I have Table1 with key KEY001(auto-increment), and i want to copy rows KEY001,KEY002... and past in the end of the Table.
As @Sowkarthika has stated above you can/should use the TRANSFERFIELDS function to copy the fields from one record to another. In addition to this you must set the key field to 0 before you call the INSERT method so that the next auto-increment value can be assigned.
Well TRANSFERFIELDS won't work if he works in the same table since it transfers the fields depending on field ID.
Not sure what you're trying to do.
Do you want to find first few values and then to add them at the end of your table?
Well TRANSFERFIELDS won't work if he works in the same table since it transfers the fields depending on field ID.
Not sure what you're trying to do.
Do you want to find first few values and then to add them at the end of your table?
Of course TRANSFERFIELDS will work in the same table, e.g....
Customer1.TRANSFERFIELDS(Customer2);
...will work perfectly well where both Customer1 and Customer2 records are for Table 18 for example.
Ya I agree that you need to write this piece of code or else you can set 0 as InitValue property but the point is I have had experienced a case where i dint need to do any of these things, seems magical but it do happened.
My experience is that the AutoIncrement field does need to specifically be set to 0 prior to inserting the record as @mohana_cse06 has stated. The MSDN help also states that this should to be done ...
If you want to insert a record, be sure that the value in this field is blank before you insert the record. This is even more critical when you are using the SQL Server Option.
Answers
Not sure what you're trying to do.
Do you want to find first few values and then to add them at the end of your table?
Of course TRANSFERFIELDS will work in the same table, e.g....
...will work perfectly well where both Customer1 and Customer2 records are for Table 18 for example.
Write some code like like this
Customer1.INIT;
Customer1.TRANSFERFIELDS(Customer2);
Customer1.INSERT;
Customer 2 should hold all those entries which you want to copy.
If the Key is Autoincrement then it will handle the Primary value itself you even dont have to worry on this.
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/
Customer1.INIT;
Customer1.TRANSFERFIELDS(Customer2);
Customer1."No." := 0;
Customer1.INSERT;
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
Ya I agree that you need to write this piece of code or else you can set 0 as InitValue property but the point is I have had experienced a case where i dint need to do any of these things, seems magical but it do happened.
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/
https://msdn.microsoft.com/en-us/library/dd338603.aspx