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
 Append a string vector to a dataset in a worksheet
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

GaussianFit

38 Posts

Posted - 12/23/2012 :  11:43:01 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.1 SR3
Operating System: Windows 7

Does anyone know how to append a string vector to a dataset that's attached to a column in a worksheet? I'm trying to use something like the following to append a string vector (which inherits its length from a dataset "dMyData" in worksheet A) to dataset "dMyNewData" attached to a column in worksheet B:

vector<string> vctMyText;
vctMyText.SetSize(dMyData.GetSize());
// inherit length from dMyData (a dataset attached to a column of worksheet A

for(j=0;j<vctMyText.GetSize();j++)
{
vctMyText[j]="My Text Content";
}

dMyNewData.Append(vctMyText, REDRAW_REFRESH);
// dMyNewData is dataset of worksheet B

when compiling it returns an error:
Error, Member function Dataset::Append not defined or does not have matching prototype.

Of course I could just append dataset dMyData to dataset dMyNewData, but I want to append an arbitrary string vector which is NOT attached to any column data in a worksheet, only inheriting the length from a worksheet column. It looks that Append function doesn't allow appending a vector to a dataset but I don't know why.

Cecilia_syy

65 Posts

Posted - 12/24/2012 :  04:22:43 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,
The dataset could not be string, that is why the error massage show. You can change your code to:

vector<string> vs;
vector<string> vctMyText;
vctMyText.SetSize(dMyData.GetSize()); 
col.GetStringArray(vs);
//col is the column you want to put dMyNewData in worksheet B

for(int j=0;j<vctMyText.GetSize();j++)
{
vctMyText[j]="My Text Content";
}
vs.Append(vctMyText);
col.PutStringArray(vs);


Cecilia
OriginLab Corp.

Edited by - Cecilia_syy on 12/24/2012 04:23:43 AM
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