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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 DeleteRow takes too much time

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
additive Posted - 11/16/2006 : 6:06:54 PM
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
3   L A T E S T    R E P L I E S    (Newest First)
additive Posted - 11/19/2006 : 4:18:20 PM
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
Deanna Posted - 11/16/2006 : 9:32:12 PM
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
cpyang Posted - 11/16/2006 : 8:37:45 PM
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



The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000