T O P I C R E V I E W |
newuser_ca |
Posted - 10/26/2012 : 2:11:56 PM 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? |
2 L A T E S T R E P L I E S (Newest First) |
newuser_ca |
Posted - 10/29/2012 : 10:40:07 AM Thank you very much. It is working now. |
greg |
Posted - 10/26/2012 : 5:31:12 PM 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.
|
|
|