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
 joining columns in worksheets
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Qiang

UK
16 Posts

Posted - 07/22/2003 :  10:29:48 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi just a quick question,

I have 2 worksheets that come from FFT so FF1 and FF2 are their names. I'd like to extract all the columns from these 2 into an empty worksheet which I initially created. I have OriginPro. the code at the moment is:

void SP_JoinWorkSheets(string WinName)
{
Worksheet wks;
wks.Create("..\..\..\Origin\Resources\empty.otw", CREATE_VISIBLE_SAME);

if(wks.GetPage().Rename(WinName))
printf("Page renamed\n");
else
printf("Failed to rename page\n");

WinName=wks.GetPage().GetName();
printf("name=%s\n",WinName);

wks.joinMode=0;
[wks(WinName)!]wks.join(wks(FF1));
[wks(WinName)!]wks.join(wks(FF2));

}

Hoever it doesn't work. First the joinmode doesn; work and neither do the lines that follow. I get the eror message that function or variable wks not found??!!

thanks

Qiang

easwar

USA
1965 Posts

Posted - 07/22/2003 :  3:20:19 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Qiang,

You are mixing Origin C and LabTalk code here. It is possible to execute LabTalk commands from OC using the LT_execute command, or to set properties of LabTalk objects from OC using the LabTalk.Object.Property method, but it is not possible to just write LabTalk commands inside the OC code.

I would rewrite your function as below:

Easwar
OriginLab.


void SP_JoinWorkSheets(string WinName, string WinName1, string WinName2)
{
// create the new worksheet
Worksheet wks;
wks.Create("..\..\..\Origin\Resources\empty.otw", CREATE_VISIBLE_SAME);

if(wks.GetPage().Rename(WinName))
printf("Page renamed\n");
else
printf("Failed to rename page\n");


// Set joinMode property of wks object in LabTalk
LabTalk.wks.joinMode = 0;

// Build a string of LabTalk command to join the first worksheet
string strCmd = wks.GetPage().GetName() + "!wks.join(" + WinName1 + ")";
// Execute the LabTalk command
LT_execute(strCmd);

// Repeat for second worksheet
strCmd = wks.GetPage().GetName() + "!wks.join(" + WinName2 + ")";
LT_execute(strCmd);
}


Go to Top of Page

Qiang

UK
16 Posts

Posted - 07/23/2003 :  05:12:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hey,

Thanks a lot! It works alright!

Qiang
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