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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Attaching integer datasets

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 HyperlinkUpload FileInsert 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
additive Posted - 10/09/2006 : 4:07:30 PM
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
2   L A T E S T    R E P L I E S    (Newest First)
additive Posted - 10/10/2006 : 06:11:57 AM
Looks like it would be the best to prefer vector base for general worksheet access.
Thanks a lot for your quick answer!

--Michael
zachary_origin Posted - 10/10/2006 : 05:09:35 AM
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.

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