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
 LabTalk Forum
 impASC and source file headers

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
Clairekun Posted - 04/07/2020 : 10:55:36 PM
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.
2   L A T E S T    R E P L I E S    (Newest First)
Clairekun Posted - 04/08/2020 : 3:13:23 PM
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.
Chris D Posted - 04/08/2020 : 08:12:09 AM
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

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