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
 Origin Forum
 Set as X by script
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

jpmat

2 Posts

Posted - 05/30/2011 :  06:30:39 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,
I checked nearly everywhere, but I cannot find the proper script command to do what does "right click on a column -> set as -> X", so that any further plot of columns to the right of that one, would use the selected column as X. The "is X" property is part of the column properties, under the subgroup "options", but neither in the "set" nor in the "wproperties" commands can you set this "is X" out of nowhere (no copying the format from another sheet, I just want to change this precise parameter), as far as I know. Could anyone help me with this please?
Thanks
Jean-Pierre
Origin Ver. 8 and Service Release 0
Operating System: XP pro

minimax

348 Posts

Posted - 05/30/2011 :  07:10:27 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
wks.colN.type=4;	//N refers the Nth column in the worksheet


Basically column properties are accessible in wks.col.
Go to Top of Page

jpmat

2 Posts

Posted - 05/30/2011 :  08:09:45 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
great, I did not look deep enough! Thanks. As a subsidiary question, would you know how to replace "Book1_B" in "layer -i Book1_B" by a variable that would point to the current worksheet instead (thus making the script suitable for automation: everytime you open a new sheet, it could work with no change)? I found a workaround for my "set as X" problem earlier (but your answer is a lot more simple of course), but for this latter problem, I still don't see any...
Thanks again!
Go to Top of Page

wbriggs90

USA
5 Posts

Posted - 10/06/2017 :  3:52:52 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
What if we cannot expect the index to be the same always and wan to change column type based off of long name?
Go to Top of Page

nick_n

Finland
125 Posts

Posted - 10/06/2017 :  4:50:49 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

If I understood you correctly, run that in script window:

int ii;
loop(ii, 1, wks.nCols) {if(wcol(ii)[L]$=="X") wks.col$(ii).type=4;}

It will set type 4(X column) for column if long name is "X". Best,


Nikolay
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