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
 How to generate dataset names?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ashvilki

USA
10 Posts

Posted - 08/26/2003 :  8:58:34 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi, guys!
I work with imported worksheets with different number of columns. To do column calculations, I was trying to create datasets for each column by creating dataset names like ds0, ds1, ds2 etc using the following script (see below). For obvious reasons, this does not work - both string variable and dataset have the same name. Is there a way around it? (I am sorry for my poor basic C skills...)
Thanks,

Alexei

Worksheet wks1 = Project.ActiveLayer();
UINT ncols = wks1.GetNumCols();
UINT nrows = wks1.GetNumRows();
for (int ij =0; ij<ncols; ij++)
{
String dname2 = ij;
String dname1 = "ds";
String Dname =lstrcat(dname1,dname2) ;
Dataset Dname(wks1, ij);
}

Mike Buess

USA
3037 Posts

Posted - 08/27/2003 :  9:09:23 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Alexei,

Unless you really need to give the datasets specific names (not sure it can be done easily) I'd try something like this...

Worksheet wks1 = Project.ActiveLayer();
UINT ncols = wks1.GetNumCols();
UINT nrows = wks1.GetNumRows();
Dataset ds;
for (int i =0; i<ncols; i++)
{
ds.Attach(wks1,i);
- do what you want to col i -
}

Mike Buess
Origin WebRing Member
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