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
 Append a string vector to a dataset in a worksheet

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
GaussianFit Posted - 12/23/2012 : 11:43:01 PM
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.
1   L A T E S T    R E P L I E S    (Newest First)
Cecilia_syy Posted - 12/24/2012 : 04:22:43 AM
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.

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