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
 Import using string arrays
 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 - 08/11/2020 :  2:26:44 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 have a complex importing LT code with several for () commands, each one of which addresses a set of subfolders one level deeper than the last.

I need to run the same exact code for 2 different folders, say, A and B. I intend to create a project folder structure where folder A is created, imports the corresponding datasets, and then creates a second folder called B, importing its own datasets.

I created a string array adding A and B. The (very) simplified version of my code is:

string strPath$ = "D:\Samples\";
path$ = strPath$;
stringarray Fols; 
Fols.add("A");
Fols.add("B");
loop(hh,1,Fols.GetSize())
{	
string ProjFols$ = Fols.GetAt(hh)$;
pe_mkdir folder:=ProjFols$ cd:=1;

//Several For commands here

string FolPath$ = strPath$+(Several strings from previous For commands)+ProjFols$;
path$ = FolPath$;

//impASC fumction

pe_cd /
}

The code works perfectly, but only for folder A. Folder B never gets created or imported from.

Am I using Loop comand wrongly? I tried ProjFols$=; first to see if the strings were listed correctly, and they were. Also, it strikes me as weird that it does read A, but not B. If the code made no sense, I wouldn't expect to have anything imported.

Clairekun

Germany
175 Posts

Posted - 08/12/2020 :  5:02:40 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Update: I managed to get it working.

There was a For command between the stringarray loop and the first time ProjFols$ was used (pe_mkdir folder:=ProjFols$); apparently, it will not work correctly if the loop is not directly above.
Go to Top of Page

samajkapoor

India
1 Posts

Posted - 09/20/2020 :  11:53:07 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Is this solve?
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