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
 Forum for Origin C
 Advanced Batch Processing
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

BryanK

Canada
26 Posts

Posted - 02/12/2014 :  08:08:27 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 9
Operating System:Windows 7x64

Good afternoon,
With my beginning skills in Origin, I have been able to make a template that allows me to batch import csv files with a certain format. I am missing a few features that may require code.

1) Where can I plant code in a template file to add more features?

2) What code can I try to copy the name of a worksheet (i.e. "Sheet1") to the name seen in Project Explorer for that book?

3) What code can I try to copy a slope value from a "Linear Fit; Parameters" table to a Summary book containing values from each batch file?

Thank you in advance for any suggestions,
~Bryan~

greg

USA
1378 Posts

Posted - 02/13/2014 :  12:34:55 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
It isn't clear from your post what's driving the batch import and how a template is involved so I cannot address question 1.

Question 2 is problematic. Project Explorer only shows Child Windows in Origin. A Workbook is an example of a Child Window, but it may contain more that one Worksheet and that information is not displayed in Project Explorer. For the special case of a Workbook containing only one Worksheet, you could set the Workbook Long Name to show the sheet name or some combination, as in:
page.label$ = layer.name$; // Long name has only sheet name
page.label$ = [%H]%(layer.name$); // Long name use formal range notation
You can decide what to show as the page Title:
page.title = 1; // Show just Long Name
page.title = 3; // Show both Short and Long Names

For question 3, you should use the getresults X-Function as follows:
// For Book3 with Report Sheet Linear Fit of Sheet1 C
getresults tr:=mytr iw:=[Book3]"Linear Fit of Sheet1 C"!;
slope = mytr.Parameters.Slope.Value;
ty Value of slope is $(slope);
Go to Top of Page

BryanK

Canada
26 Posts

Posted - 03/17/2014 :  12:56:27 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Greg. Thanks for replying!
1) Right now I have one .opj file with raw data and columns with calculated formulae/graphs. Then I use a SaveTemplateAs command generating a .ogw file. With BatchProcessing... , I think it replaces the raw data for each csv file with this workbook template.

2) The first worksheet of each workbook always contains the name. Where would I feed the code lines you suggested? Into what window?

3) I tried range r2 = 2!Col(14); in the BeforeFormula Scripts with Col(x)= r2 because I don't quite know how to work with the code you suggested (yet!). I think it works.

Thanks again for responding
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