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
 GraphPage GetName() and SetName()
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

newuser_ca

70 Posts

Posted - 10/26/2012 :  2:11:56 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin 8.5/8.6 in Win7

It is very interesting. See the example below:


void test()
{
foreach (GraphPage grPg in Project.GraphPages) {
grPg.Destroy();
}
GraphPage gp;
gp.Create("Origin");

string name1 = "AB_CDEFG05_2006020100003";
printf("%s\n", name1);
gp.SetName(name1);
string name2 = gp.GetName();
printf("%s\n", name2);

}


You will assume that "name1" and "name2" are the same. But it is not.
The results will be:
AB_CDEFG05_2006020100003
AB_CDEFG05_200602010003


Why Origin eats "0" in the name?

greg

USA
1378 Posts

Posted - 10/26/2012 :  5:31:12 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Origin Page has Long Name and Short Name just like Origin Columns have Long Name and Short Name. Historically (pre 8.0 days), these were referred to as Name and Label. Additionally, Short Names are treated like a variable name and have a length restriction of 24 characters.

Any attempt to name (Short Name) an object with more than 24 characters will trigger some internal code that truncates the name. There is some internal code which also looks at the end of a name so I think what happens here is that Origin decides the name needs to be shorter and that '3' is more important than '0' so the '0' gets dropped.

The Name methods deal exclusively with Short Name. The Long Name is the Label (string) property of a page. Here is how you might re-write your example:

void testthis()
{
foreach (GraphPage grPg in Project.GraphPages)
{
grPg.Destroy();
}
GraphPage gp;
gp.Create("Origin");

string name1 = "AB_CDEFG05_2006020100003";
printf("%s\n", name1);
gp.SetName(name1); // This 'attempts' to set the Short Name
gp.Label = name1; // Set the Long Name
string name2 = gp.GetName();
string label1 = gp.Label;
printf("%s, %s\n", name2, label1);

}

The lesson here should be : any time you set a name, check to make sure you know what the name is really going to be.
Go to Top of Page

newuser_ca

70 Posts

Posted - 10/29/2012 :  10:40:07 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you very much.
It is working now.
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