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
 Origin Forum
 Partial Import using keywords

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
Kujo Posted - 06/21/2019 : 05:18:58 AM
Hi!
I'm trying to set up an import filter that allows me to do a partial import of a certain part of my files. Unfortunately this part isn't always between the same number of lines but the desired data is separated by certain keywords.
So in particular the data starts after the keyword "elustart" and ends after "elustop".

So it looks like this:


useless useless useless
useless useless useless

ELUSTART

col1 col2 col3
col1 col2 col3
col1 col2 col3
col1 col2 col3

ELUSTOP

useless useless useless
useless useless useless




Is there any way I can automate the import of this data so I don't have to manually copy it or manually check the lines it is in?
I've been looking quite a bit for a way to do this, including labtalk scripts (the way I would probably prefer) but to no avail so far.

Hope you have ideas on this.

Thanks!
3   L A T E S T    R E P L I E S    (Newest First)
Kujo Posted - 06/24/2019 : 04:58:06 AM
Thank you for your help, unfortunately when using the given script I receive an error "scn.GetToken(1, "_")$" and the imported data is not getting cropped.

Also, I sent you the original data as requested.

#Edit: OK the error seems to come from a part of another script I'm using with my import filter. With a fresh filter using only your script (slightly modified) it works, thank you.

range r1 = col(A);
n = r1.getSize();
ns = lookup("ELUstart :", r1, data(1,n));
wks.deleteRows(1,ns+1);

n = r1.getSize();
ns = lookup("ELUstop :", r1, data(1,n));
wks.deleteRows(ns-1,n);
YimingChen Posted - 06/21/2019 : 2:41:19 PM
Hi,

Would you mind sharing your real data with us? We would like to improve our CSV data connector on partial import, maybe we can import partial rows with some syntax like ELUSTART:ELUSTOP. If you would like to share, please send your data to <tech@originlab.com>. Thank you.

James
YimingChen Posted - 06/21/2019 : 2:22:26 PM
Hi,

In Import Wizard tool, under Header Lines page, uncheck the box Auto Determine Header Lines, make sure Number of Main header lines and subheader lines are both set to 0. Go all the way to last page, use the following script in Script After Each File Imported.

James


range r1 = col(A);
n = r1.getSize();
ns = lookup("ELUSTART", r1, data(1,n));
wks.deleteRows(1,ns+1);

n = r1.getSize();
ns = lookup("ELUSTOP", r1, data(1,n));
wks.deleteRows(ns-1,n-ns+2);



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