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
 impASC and source file headers
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Clairekun

Germany
175 Posts

Posted - 04/07/2020 :  10:55:36 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 2018b
Operating System: Windows 10

Hello,

I would like to know whether there is any way to store header information in a string variable while using impASC multifile, since __HEADER$ only refers to the last imported file and I would need all of them.

My current code creates a series of workbooks and places the data in new worksheets (Options.FirstMode:=0 and Options.Mode:=4). I have read that impFile X-function can be used for this purpose, but it seems way less customizable than impASC.

Thank you.

Claire.

Chris D

428 Posts

Posted - 04/08/2020 :  08:12:09 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
For the active workbook that has imported data:

string sfd$ = page.info.system.import.filedate$;
string sfn$ = page.info.system.import.filename$;
string sfp$ = page.info.system.import.filepath$;

// Dump to show values
sfd$=;
sfn$=;
sfp$=;



I hope this helps.

Thanks,
Chris Drozdowski
Originlab Technical Support
Go to Top of Page

Clairekun

Germany
175 Posts

Posted - 04/08/2020 :  3:13:23 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Okay, I got it working. Describing it briefly here in case anyone encounters the same issue as me.

Metadata is not the info I need, so I actually need a way to access __HEADER$ for every imported file separately. Since the impASC function I was using was for multiple files at once, I thought it was impossible, but there is an actual option (somewhat hidden at the very bottom of https://www.originlab.com/doc/X-Function/ref/Details-of-TreeNodes-in-Import-ASCII, I must say) enabling to run a script after every import:
options.scripts.ScriptAfterEachImport:=

I could call _HEADER$, define the needed strings and paste them as user parameters in columns, so that I could access them later on simply by pointing to the label cell.

It is important to note (unless I've done something wrong, which can easily be the case) that label cells cannot be exclusively numeric (they can either be Text & Numeric, Time or Date), so numeric strings won't work. You will need to assign a double variable to the label cell if you need to perform any calculations with those header values.

I considered the possibility of storing them under the worksheet's user tree (I read this could be done some time ago and I'm really curious about this feature), but making them clearly visible in a label will make me remember what I did if I open the file in a few months.

Edited by - Clairekun on 04/08/2020 3:25:43 PM
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