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
 LabTalk Forum
 Re-import data
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

tib

Switzerland
105 Posts

Posted - 10/24/2003 :  1:10:31 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
That's the way you usually import multiple files

if(fdlog.MultiOpen()!=0/0) {
loop(aaa,1,fdlog.Multiopen.count) {
fdlog.get(A,aaa);
win -t wks Origin; // open new template;
open -w %A; // import data;
};
};

If a worksheet already exists Origin gives an error message
"Name already used... please enter a new name" and forces you to enter a new name.
But if I want to re-import or overwrite the data how do I do this with LabTalk???

You could check for the window before importing but for this you need the worksheet name (usually =filename)
In the upper case %A consists of Path+Filename+Extension.
Is there a convenient LabTalk function to split %A into these three parts? Something like fdlog.path$, fdlog.name$, fdlog.ext$ ???
Thanks, Tilman.

PS.
Did you know that for example
fdlog.path$ would result in c:\data\new
whereas
%X would give you c:\data\new\
The backslash will make things even more inconsequent.



Mike Buess

USA
3037 Posts

Posted - 10/24/2003 :  5:48:02 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Tilman
quote:
But if I want to re-import or overwrite the data how do I do this with LabTalk???


win -r %H junk; // rename worksheet
open -w %A;
quote:
Is there a convenient LabTalk function to split %A into these three parts? Something like fdlog.path$, fdlog.name$, fdlog.ext$ ???

This isn't documented in 7.0, but I just tried there and it works.

fdlog.MultiOpen();
fdlog.get(A,1,0); // %A = full path\name of 1st file
fdlog.get(A,1,1); // %A = file name without extension
fdlog.get(A,1,2); // %A = file extension only
%B=fdlog.path$; // file path (yes, oddly enough w/o trailing '\')

Hope that helps.

Mike Buess
Origin WebRing Member
Go to Top of Page

tib

Switzerland
105 Posts

Posted - 10/24/2003 :  8:49:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike, thanks a lot!

For completeness you have to add to the first issue:

fdlog.MultiOpen();
fdlog.get(A,1,1); // %A = file name without extension;
if (exist(%A)==2) { // check if wks with filename exist already;
win -r %A junk; // rename;
win -a junk; // needs to be activated;
}
else {
win -t data Template; // new template
};
open -w %A;

Your second suggestion works perfect. Thanks!
I have the suspicion that there are a lot of features not properly documented in Origin...
However, trial an error is very time consuming. So please, dear Origin developers, update the help files! See also my request for complete documentation on layer.cmap...




Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 10/24/2003 :  9:37:47 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I'm pretty sure that fdlog.get(A,n,m) was introduced in one of the later 7.0 SRs, probably SR4. I'd look for the documentation in 7.5.

Mike Buess
Origin WebRing Member
Go to Top of Page

tib

Switzerland
105 Posts

Posted - 10/25/2003 :  08:33:38 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Ok, let's wait for V7.5 documentation
But to be honest I would have expected
fdlog.get(A,1,0); // the full string
fdlog.get(A,1,1); // the path including "\"
fdlog.get(A,1,2); // the filename without extension
fdlog.get(A,1,3); // the extension
But anyway it works, so I shouldn't complain...
Tilman.

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