![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 5 of 5 total |
![]() |
Thu, Jun 9 2016 6:33 PM | Permanent Link |
Trinione | Anyone know how to copy the existing dataset record to a new record?
I was thinking I could copy the fields to an array, ds.Insert(true), then loop thru the array and assign the value via ds.Columns[i].Assign(aValue[i]); As in: ------------------------------------------------------------ var aValue: variant; begin // Create a variant array SetLength(aValue, ds.ColumnCount - 1); // read values into the array for i := 0 to (ds.ColumnCount - 1) do begin aValue[i] := ds.Columns[i]; end; // append a new record ds.Insert(true); // Put array values into new record for i := 0 to (ds.ColumnCount - 1) do begin ds.Columns[i].Assign(aValue[i]); end; ------------------------------------------------------------ Though no error messages appear, when another form includes the form this code is on I get a 'Compilation |
Fri, Jun 10 2016 3:42 AM | Permanent Link |
Matthew Jones | Trinione wrote:
> Though no error messages appear, when another form includes the form > this code is on I get a 'Compilation Knowing the error would help! 8-) -- Matthew Jones |
Fri, Jun 10 2016 5:30 AM | Permanent Link |
Uli Becker | SetLength(aValue, ds.ColumnCount - 1);
Should be SetLength(aValue, ds.ColumnCount); Uli |
Fri, Jun 10 2016 7:44 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | << Anyone know how to copy the existing dataset record to a new record? >> You normally should use the Assign method: http://www.elevatesoft.com/manual?action=viewmethod&id=ewb2&comp=TDataValues&method=Assign (TDataRow descends from TDataValues) However, that will also copy the row ID, which you don't want to do. So, I'll have to add a parameter to indicate whether you want to copy the row ID and the row values, or just copy the row values. Tim Young Elevate Software www.elevatesoft.com |
Fri, Jun 10 2016 11:29 AM | Permanent Link |
Trinione | << You normally should use the Assign method:
http://www.elevatesoft.com/manual?action=viewmethod&id=ewb2&comp=TDataValues&method=Assign (TDataRow descends from TDataValues) However, that will also copy the row ID, which you don't want to do. So, I'll have to add a parameter to indicate whether you want to copy the row ID and the row values, or just copy the row values. >> Tim: The two dataset approach came to me as the simplest solution, and the Assign method fits right up that alley. And I was wondering about how the ID field/s would be ignored. Is there a simple HotFix in the meantime? If not, I can just wait. (Don't want to distract the 2.05 rollout). |
This web page was last updated on Monday, September 25, 2023 at 03:00 PM | Privacy Policy![]() © 2023 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |