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
 String array population by workbook 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
Clairekun Posted - 07/25/2022 : 8:27:00 PM
Origin Ver. and Service Release (Select Help-->About Origin): 2018b
Operating System: Win10

Hello,

I have many workbooks separated into 2 types of short name: the first starts with an At, the second starts with an Ox.

I would like to create 2 different string arrays: one for At workbook names, and another for Ox.

To test my code, I created a project with 1 At workbook and 1 Ox workbook only. I have tried the following:
doc -e W
{
	string sName$ = page.name$; //Example: A550C360d0p5z
	string sNameAt$;
	string sNameOx$;
	
	if (Left(sName$,1)$ == "A")	sNameAt$ = sName$;
	if (Left(sName$,1)$ == "O")	 sNameOx$ = sName$;
	
	ArrSampAt.Add(sNameAt$);
	ArrSampOx.Add(sNameOx$);
}


What I got was: both arrays had 2 entries: one empty, and the other one with the correct name.

Why is this happening?

Is there a simpler way to achieve this? I thought it might be simpler to collect all workbook names in an array to later separate them in two groups, so that Origin would only work with text entries instead of looping through books (which should be easier?), but I can't seem to make it work. Maybe I am overthinking.
2   L A T E S T    R E P L I E S    (Newest First)
Clairekun Posted - 07/29/2022 : 10:42:35 PM
Than you, it worked!

While your suggestion is a really good idea, right now I don't have the time to study its implementation. I'll go back to it whenever I need to do something similar again.
aplotnikov Posted - 07/26/2022 : 01:09:18 AM
doc -e W
{
	string sName$ = page.name$; //Example: A550C360d0p5z
	
	if (Left(sName$,1)$ == "A") {
		ArrSampAt.Add(sName$);
	} else {
		if (Left(sName$,1)$ == "O") {
			ArrSampOx.Add(sName$);
		}
	}
}


Instead of many workbooks with complicated names you may use a single large workbook with a column containing corresponding workbook IDs. In this case you can apply column filtering (e.g., to select data with certain ID) that works fast. Moreover it may simplify further data processing and/or data scrolling for interactive data analysis. A certain increase of data size seems to be a reasonable compromise for convenience.

MfG

Alexei

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