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
 Naming the loaded data with the folder name

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
MaxImai Posted - 01/21/2019 : 03:20:20 AM
First of all I would like to thank you very much for this forum.

Unfortunately, I have a problem that I can rename the loaded data when I open a new worksheets. I would like to save the data in a workbook and then open the individual records in sheets and use the respective folder name.

This is the code for the workbooks:

dlgPath;// Open dialog to navigate to main folder
type -a "You have choosen " + path$;

findfolders addpath:=1;

if(folder.GetLength() < 1)
{
type "No subfolders found";
break 1;
}
else
{
int nn = folder.GetNumTokens(CRLF);
type "$(nn) subfolders found";

string strTemp$;
for(int ii = 1; ii <=nn; ii++) // Run for each found folder
{
strTemp$ = folder.GetToken(ii, CRLF)$;
findFiles path:=strTemp$ ext:="*.dat" fname:=results;
int mm = results.GetNumTokens(CRLF);
type "A Total of $(mm) files found";
newbook; // change to newsheet;
impFamos fname:=results$ options.Mode:=1 options.Names.FPathToBk:=1 Options.Names.FNameToBK:=1
Options.Names.FNameToBkFrom:=1
Options.Names.FNameToBkTo:=1;
}
}

Now I would like to use the names for the individual worksheets.
I have already tried to change the commands from "toBk" into "toSht", which unfortunately did not lead to success.

Many thanks.
Max

Origin Ver.: 2019Pro
Operating System: Windows 10 Pro
1   L A T E S T    R E P L I E S    (Newest First)
YimingChen Posted - 01/21/2019 : 12:33:43 PM
Hi Max,

I tried script below which works:
impFamos fname:= "c:\I_010_7-3.dat" Options.Names.FNameToSht:=1
Options.Names.FNameToShtFrom:=1
Options.Names.FNameToShtTo:=1;


Please also check this page for more details:
https://www.originlab.com/doc/X-Function/ref/Details-of-TreeNodes-in-Import-Famos

James

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