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
 sum two columns to another
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

bubbas

Germany
Posts

Posted - 10/12/2006 :  07:59:40 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5E
Operating System: WIN XP

Hi,

i'm new to OriginC & have a question.

I have a worksheet with different columns. Now i want to take lets say the column labeled "A" and a secon one "B". I want to create a new worksheet with a specific name and put there a column with the name "C" which contains the result of A+B lets say.

I have tried around but was not able to put the data of a Dataset to a column and the column to the worksheet :(

hope somebody can help me!

thanks

bubbas

Edited by - bubbas on 10/12/2006 08:00:46 AM

zachary_origin

China
Posts

Posted - 10/12/2006 :  09:19:11 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
you can learn from the examples in Origin:Help: Progamming: Origin C Language Reference: Composite Data Type: Dataset to see how to manipulate the columns.
Here is a simple example as your requirment:
void AddTwoCols()
{
Worksheet wks = Project.ActiveLayer();
Dataset dsColA(wks,0);
Dataset dsColB(wks,1);
if( wks.Columns.Count()==2 ) wks.AddCol();
Dataset dsColC(wks,2);
dsColC = dsColA + dsColB;
}





Zachary
OriginLab Technical Services.
Go to Top of Page

bubbas

Germany
Posts

Posted - 10/12/2006 :  09:38:36 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
hey thank you very much zachary!

my problem is more the creation of a new worksheet with a specific name. then inserting there the ColC also with a specific name. i don't want to change the original worksheet containing colA and colB.

Thx in advance!

vale

Edited by - bubbas on 10/12/2006 09:43:43 AM
Go to Top of Page

zachary_origin

China
Posts

Posted - 10/12/2006 :  10:53:28 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply

void AddTwoCols()
{
Worksheet wks = Project.ActiveLayer();
Worksheet wks2;
wks2.Create();

Dataset dsColA(wks,0);
Dataset dsColB(wks,1);
Dataset dsColAA(wks2,0);
Dataset dsColBB(wks2,1);
if( wks2.Columns.Count()==2 )
wks2.AddCol();
Dataset dsColCC(wks2,2);
dsColAA = dsColA;
dsColBB = dsColB;
dsColCC = dsColA + dsColB;
wks2.GetPage().Rename("WorksheetName");
wks2.Columns(2).SetName("ColumnNameHere");
}


Zachary
OriginLab Technical Services.
Go to Top of Page

bubbas

Germany
Posts

Posted - 10/12/2006 :  11:55:17 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
thanks, thanks :) it works!!!

ciao

bubbas
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