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
 "past Link" in origin C
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Mathias.list@posteo.de

Germany
4 Posts

Posted - 03/15/2021 :  09:49:35 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi everyone, I have data (Min, Max, Median )in coulumns of a worksheet as output of statistics function (DEscriptive Statistics/ statistics on columns). The data is grouped like below.
Group1 |Group2 | Min | Max | Median |...
a | c | 1 | 3 | 2 |...
a | d | 2 | 4 | 3 |...
b | c | 6 | 8 | 7 |...
b | d | 7 | 9 | 8 |...

I have to put them in sheet in the pattern:

Group2 | Min a | Max a| Median A
c | 1 | 3 | 2
d | 2 | 4 | 3

in general I know how to do this with Origin C but is there a way to link the data in the new sheet, to the data in the source sheet in a similar way to "right klick"/"Paste Link" in the GUI. My internet reseach and my attepts to find something related in the documentation were not successfull.
Thanks in advance!


Origin Ver. 2021 and Service Release: 9.8.0.200
Operating System: Win 10 (64 bit)

Chris D

428 Posts

Posted - 03/15/2021 :  10:49:34 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
My more learned Origin C guru colleagues may provide a better way to do it, but here is code that will achieve what you want:

void copy_paste_link(const Worksheet& wks_in, int col_in, int row_in, const Worksheet& wks_out, int col_out, int row_out)
{
    string str1 = wks_in.MakeRangeString(wks_in.Columns(col_in).GetName(), NULL, 0, -1);
    string str2;
    str2.Format("cell://%s[%u]", str1, row_in + 1);
    wks_out.SetCell(row_out, col_out, str2);
}

void abc()
{
	Worksheet wks = Project.ActiveLayer();
	copy_paste_link(wks,0, 0, wks, 1, 1);
}



Thanks,
Chris Drozdowski
Originlab Technical Support
Go to Top of Page

Mathias.list@posteo.de

Germany
4 Posts

Posted - 03/15/2021 :  11:04:44 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Chris! Looks like the "MakeRangeString" is what I was looking for, I will check it out.
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