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
 Attaching integer datasets
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

additive

Germany
109 Posts

Posted - 10/09/2006 :  4:07:30 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (7.5G, SR6):
Operating System: Win2k

Is there a way to attach a dataset based on a worksheet column with long / integer as internal data type? In contrast to a "double column", the attach method fails.

I suppose that is because some mathematical functions might fail for integer types as a message box tells me when changing the data type. But this is rather annoying because I cannot use existing code with ds[] notation ... Thus, I have to check every dataset before attaching or have to change it temporarily ...

Any idea?

--Michael

zachary_origin

China
Posts

Posted - 10/10/2006 :  05:09:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Micheal,

You can define the dataset as a integer dataset using Dataset<int> ds; Alternatively, if the data type for the worksheet column is not known, you can use the GetDataObject() method to get it as a vectorbase and then make manipulation on the data.
The following examples give the details:


void Integer_DataSet(int nCol = 1)
{
Worksheet wks = Project.ActiveLayer();
Dataset<int> dsA;
dsA.Attach(wks,nCol);
dsA.SetSize(20);
dsA[2]=9;

}


void Column_Type_Unknown(int nCol = 1, double ff = 2)
{
Worksheet wks = Project.ActiveLayer();
Column cc(wks, nCol);
if(cc)
{
vectorbase& vb = cc.GetDataObject();
vector vv;
vv = vb;
vv *= ff;
vb = vv;
}
}




Zachary
OriginLab Technical Services.
Go to Top of Page

additive

Germany
109 Posts

Posted - 10/10/2006 :  06:11:57 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Looks like it would be the best to prefer vector base for general worksheet access.
Thanks a lot for your quick answer!

--Michael
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