The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 DeleteRow takes too much time
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

additive

Germany
109 Posts

Posted - 11/16/2006 :  6:06:54 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version: 7.5 SR6
Operating System: Windows 2000

Hi!
Can you tell me why this takes so long for datasets with 10000 rows and more?
for (int iRow = ds.GetSize()-1; iRow >= 0; iRow--)
{
newWks.DeleteRow(iRow);
}
Well, I just want to delete specific rows, but even without condition it takes quite a long time. I want to filter the data of a source worksheet and then put the result into a new worksheet. So I've created a copy (method 'CreateCopy') and delete the rows I want to remove. Does is go faster by copying the data into an empty worksheet? Importing data goes much faster.

Can anyone help me with this? I have to handle data > 100000 rows and maybe 20 columns (double and long data columns mixed, 3...20 MB).
Thank you so much!

Michael


Edited by - additive on 11/16/2006 6:15:21 PM

cpyang

USA
1406 Posts

Posted - 11/16/2006 :  8:37:45 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Looks like you need to delete specified rows and I am afraid there is no good solution until the upcoming Origin 8, which has this new function designed exactly for this purpose:


/**
Parameters:
wksDest = [output] The Worksheet where the extracted data is copied onto, if unattached a new Worksheet is created.
vnRowIndices = [input] Row indices to extract, 0-offset
vnColIndices = [input] Column indices to extract data, if wksDest is the current worksheet, all columns not in this list will be deleted
Return:
TRUE if succesful FALSE otherwise
SeeAlso:
Worksheet::SelectRows
*/
BOOL Extract(Worksheet& wksDest, const vector<uint>& vnRowIndices, const vector<uint>& vnColIndices);




CP


Go to Top of Page

Deanna

China
Posts

Posted - 11/16/2006 :  9:32:12 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Michael.

If the rows to be delete are adjacent, I think you can try to use DeleteRange().

This function is a member function of Worksheet Class. The prototype is as follows:
BOOL DeleteRange(int nRowBegin, int nColBegin, int nRowEnd, int nColEnd, BOOL bInsertNotDelete = false);

It seems that it is faster than looping and using DeleteRow() in some cases.

Deanna
OriginLab Technical Services

Edited by - Deanna on 11/16/2006 10:00:40 PM
Go to Top of Page

additive

Germany
109 Posts

Posted - 11/19/2006 :  4:18:20 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you very much!

I'm looking forward to working with OriginC 8
Meanwhile I will use the DeleteRange() method which works rather fast!

--Michael
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000