The Origin Forum
File Exchange
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
 using string variables within workbook addresses

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 HyperlinkInsert EmailInsert 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
cpeterbeng Posted - 08/06/2012 : 12:23:47 PM
Origin Ver. 8.6.0 32 bit; WinXP latest build
Hi,
Using a formula in the set column values, is it possible to use a string variable to insert a workbook name into a range variable formula? I want to use a list of workbook names included as a text column in the current workbook. This would allow me to gather statistics from a large number of workbooks.
Something like:
max(r1)
Before Formula Scripts:
string workbookname$ = col(workbookname);
range r1 = [workbookname$]sheet!Col(Column);

C. Peter Bengtson

Interdisziplinäres Zentrum für Neurowissenschaften (IZN)

Universität Heidelberg +49-(0)6221-546484 (lab)

Im Neuenheimer Feld 364 +49-(0)6221-546700 (fax)

69120 Heidelberg, GERMANY
6   L A T E S T    R E P L I E S    (Newest First)
cpeterbeng Posted - 08/14/2012 : 11:29:56 AM
Problem solved. Thanks alot for your help.
Peter
Penn Posted - 08/13/2012 : 9:11:49 PM
Hi Peter,

I think you can merge the two example scripts I provided in my two replies. For example:

range rBook1ColA = [book1]sheet1!col(A);  // column A in book1 sheet1
range rBook1fxColA = [book1]sheet1!col(fxColA);  // column fxColA in book1 sheet1
range rBook1Wks = [book1]sheet1!;  // sheet1 in book1
for(ii = 1; ii <= rBook1Wks.maxRows; ii++)  // loop to get book names for calculation
{
	string strBookname$ = rBook1ColA[ii]$;  // get the book name
	range rr = [strBookname$]sheet1!col(A);  // define the corresponding column A
	rBook1fxColA[ii] = max(rr);  // calculate the maximum and put to column fxColA
}


Penn
cpeterbeng Posted - 08/13/2012 : 10:05:43 AM
Hi Penn,
Your script can generate a list of booknames. I want to use the booknames in a formula. For example in column fxColA of book1 I would like to calculate the maximum value in each of all the Col(A) in books 2 to 5 and have them listed in book1 column fxColA in each row next to the corresponding book name which is listed in column A of book1.



I know I could generate a new statistics output sheet with max values but this is just a starting point example. I want to use more complex equations than just the maximum function and I want to generate these results according to a column of book names.
thanks,
Peter

C. Peter Bengtson

Interdisziplinäres Zentrum für Neurowissenschaften (IZN)

Universität Heidelberg +49-(0)6221-546484 (lab)

Im Neuenheimer Feld 364 +49-(0)6221-546700 (fax)

69120 Heidelberg, GERMANY
Penn Posted - 08/10/2012 : 04:55:48 AM
Hi Peter,

If I got your meaning right, the book name is listed as the following image shows, right?

If so, please try the following script.

range ra = [book1]sheet1!col(A);  // column A
range rwks = [book1]sheet1!;  // sheet1
for(ii = 1; ii <= rwks.maxrows; ii++)  // loop to get all the book names
{
	string strbookname$ = ra[ii]$;  // get the iith book name	
	strbookname$ = ;  // print the book name
}


Penn
cpeterbeng Posted - 08/10/2012 : 03:57:07 AM
The value of your string "workbookname$" remains fixed as "book1". I am trying to assign the entries in a column to a string variable. Something like:
string workbookname$ = col(X); // column(X) contains a text list of the workbook names.
Is it possible to feed text from a column into the value of a string variable somehow?
thanks, Peter
Penn Posted - 08/06/2012 : 8:57:42 PM
Hi,

Yes, of course, you can use the string variable, such as:

Before Formula Scripts:

string workbookname$ = book1;  // workbook name is book1 here
range r1 = [workbookname$]sheet1!col(1);  // use the string variable


Penn

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