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
 LabTalk Forum
 Graph Title, Worksheet Name and Layer Title
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

cqy2016

Germany
10 Posts

Posted - 08/18/2016 :  06:52:41 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): Origin 2015
Operating System:WIN 7
Hi,

We have a problem with the Graph Title.
We have all datas from different DUTs imported into different sheets, and the names we want to use are part of the long names of each sheets.
We actually want to use the first 20 Characters including _ as Graphic title, and use 8 Characters from the middle of long names as layer title.(each graph has 18 layers).
Currently we use a combination of labtalk and template to create our graph, and in the template we used %(1,@WS) to use the sheet name. However, is there anyway we could trim it?

Looking forward to your reply.

Thanks and best regards!

CQY

yuki_wu

896 Posts

Posted - 08/19/2016 :  01:33:33 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi CQY,

You can extract the first nCount characters from a string by String::Left.
http://www.originlab.com/doc/LabTalk/ref/String-obj#Left

You can also extract a substring of length nCount characters starting at position nFirst from a string by Strting:Mid.
http://www.originlab.com/doc/LabTalk/ref/String-obj#Mid

Hope it helps.

Yuki
OriginLab
Go to Top of Page

cqy2016

Germany
10 Posts

Posted - 08/19/2016 :  03:10:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by yuki_wu

Hi CQY,

You can extract the first nCount characters from a string by String::Left.
http://www.originlab.com/doc/LabTalk/ref/String-obj#Left

You can also extract a substring of length nCount characters starting at position nFirst from a string by Strting:Mid.
http://www.originlab.com/doc/LabTalk/ref/String-obj#Mid

Hope it helps.

Yuki
OriginLab




Hi Yuki,

Thanks for the reply,i think the way of trimming a string could work.
At the same time our problem was also, how to get the string from the worksheet short name, and how to put it as a label into our graph.
For example, if we use in the template %(1,@WS) in script, and give the value to a string variable it won't work.
For example, if we use: string str1$=%(1,@WS) will it work?
And for using the trimmed string as a label, could you give an example?
Currently we use something like : label -a (-600) 731 \p200(xxx)
Could you tell us which formular should we put in xxx?

Thanks and best regards!

CQY
Go to Top of Page

yuki_wu

896 Posts

Posted - 08/19/2016 :  05:37:52 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi CQY,

I think you can try the scripts as follow:

str$ = %(1,@W); //Get the name of the first worksheet
%A = str.left(3)$; // Extract the first 3 characters from the worksheet name
label -s %A; //Place a new label on a graph 

Yuki
OriginLab

Edited by - yuki_wu on 08/19/2016 05:39:46 AM
Go to Top of Page

cqy2016

Germany
10 Posts

Posted - 08/19/2016 :  06:42:07 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by yuki_wu

Hi CQY,

I think you can try the scripts as follow:

str$ = %(1,@W); //Get the name of the first worksheet
%A = str.left(3)$; // Extract the first 3 characters from the worksheet name
label -s %A; //Place a new label on a graph 

Yuki
OriginLab





Hi Yuki,

Everything works now perfectly, thanks a lot.
Wish you a nice weekend!

Best regards!

CQY
Go to Top of Page

cqy2016

Germany
10 Posts

Posted - 08/22/2016 :  04:35:31 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Yuki,

Good day.
Do you also know the labtalk code to let all worksheets in a workbook to show long name?
Like currently what i do is right click on a worksheet, then select show and then select "long name if available", however, sometimes i have 16 or more worksheets in one workbook, is there a way to do this automatically?

Regards!

CQY
Go to Top of Page

yuki_wu

896 Posts

Posted - 08/23/2016 :  03:28:40 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi CQY,

layer.namemode = 0; 
//0 = Show Long Name if available, 1 = Short Name(default), 2 = Long Name 


This property of layer can determines how sheet name should display.
More detailed can be found on this page:
http://www.originlab.com/doc/LabTalk/ref/Layer-obj

Yuki
OriginLab
Go to Top of Page

cqy2016

Germany
10 Posts

Posted - 08/23/2016 :  08:50:57 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by yuki_wu

Hi CQY,

layer.namemode = 0; 
//0 = Show Long Name if available, 1 = Short Name(default), 2 = Long Name 


This property of layer can determines how sheet name should display.
More detailed can be found on this page:
http://www.originlab.com/doc/LabTalk/ref/Layer-obj

Yuki
OriginLab



Hi Yuki,

Yep, it works perfectly.
Thanks again.

Best regards!

CQY
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