Author |
Topic |
|
AdamJH
2 Posts |
Posted - 06/17/2013 : 4:43:23 PM
|
I want to set up a batch process where two columns are imported from a plain text file, columns A and B. Column B is then multiplied by a column of constant values, column C, producing column D. The multiplication was done using set column values.
The batch process import works fine, but deletes column C. I tried using set column values:
col(c) = range f2011x10
with script
range f2011x10 = [book1]"sheet1"!col(B)
But this simply deletes column B in the sheet I want to copy from.
I also tried a script in the import filter, but this did not work either.
I am at a bit of a loss on how to do this, any help would be greatly appreciated.
Adam |
|
snowli
USA
1388 Posts |
Posted - 06/17/2013 : 5:53:01 PM
|
Hi Adam,
Maybe the best would be you send your opj or template and one sample text file to tech@originlab.com?
The syntax you used is wrong. Don't add "range" after = sign in formula box in Set Column Values. When u use the syntax, did it work?
You mentioned col(C) are some constant values. Do you mean it's some constant values from Book1 sheet1 col(B)? So the worksheet you want to set formula on isn't book1 sheet1? Is it another sheet in book1 or a new workbook, e.g. Book2? You may not need to have col(C) then. U only need to add one extra column. In Set Column Values dialog Before formula script as: range f2011x10=[book1]"Sheet1"!col(B)
Formula as f2011x10*coL(B) so book1 sheet1's column B times current sheet's column B.
Have you look at our Set Column Value related videos on our website? E.g. This video may help. http://www.originlab.com/Index.aspx?go=Support/VideoTutorials&pid=2009
Thanks, Snow Li OriginLab Corp.
|
Edited by - snowli on 06/17/2013 5:55:20 PM |
|
|
AdamJH
2 Posts |
Posted - 06/18/2013 : 03:10:33 AM
|
Thanks,
I just got the syntax wrong when typing it into the forum box, it was without range in the workbooks, and does not work.
The formula you suggested works, but causes the save workbook as analysis template option to be greyed out, so it can not be saved for batch process. |
|
|
snowli
USA
1388 Posts |
Posted - 06/18/2013 : 09:51:11 AM
|
Hi Adam,
Do you mean you have Book1, Sheet1 with col(B) values. Then you want to import multiple text files to new workbooks or worksheets and add a new column (C) in each new worksheet which equals col(B) of Book1 sheet1. Then add new col(D) where each has col(C)*col(B) of current sheet?
I did try save as analysis is grayed out when using the syntax i suggested below. So I will check what may be the cause.
But at the same time, I think using Import wizard to import multiple text files will be fine.
E.g. E.g. u already have Book1, Sheet1. And col(B) is filled with constant values. Click Import wizard. Select multiple text file u want to import. Choose Import Mode: Start New Books or Start New Sheets. On the last page, check Save Filter. Give a Filter file name. e.g. add_columnC&D
Check Specify advanced filter options checkbox and click Next button. Enter the following script to run at the end of each import. range f2011x10 = [book1]"sheet1"!col(B); col(C)=f2011x10 ; col(D)=col(C)*col(B); Click Finish. --> All files will be imported with col(C) and col(D) calculated as well.
U can use this filter in the future to import such data and get col C and D.
Thanks, Snow |
|
|
snowli
USA
1388 Posts |
|
|
Topic |
|
|
|