BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
pmroz

Super User

Joined:

Jun 23, 2011

Set column width with JSL?

Is there a way to set the display width of a column using JSL?  When I create a table, by default the columns are too wide.  I've tried playing around with set column width but it doesn't work.

I know that the column width is stored somewhere, because if I set the column widths manually, save the dataset, and then open it again, voila the widths are preserved.  I just don't know how to do it in JSL.

Thanks!

2 ACCEPTED SOLUTIONS

Accepted Solutions
mattf

Community Trekker

Joined:

Jun 23, 2011

Solution

Set column width with JSL?

Hi:

dt = New Table( "test");

dt << New Column( "new");

column("new") << Get Field Width();  // default 10;

column("new") << Set Field Width(30);

column('new") << Get Field Width(); // now shows 30;

Show Properties(:new);  // log shows  a large number of properties, including field width;

Hope this helps,

-Matt

Highlighted
David_Burnham

Super User

Joined:

Jul 13, 2011

Solution

Re: Set column width with JSL?

Peter

Version 12 has a new column message: Set Display Width.


Try( Column(dtCopy,"Viable cell density") << Set Display Width(120) ):

Try( Column(dtCopy,"Viable cell density") << Set Display Width(120) );

Dave

-Dave
6 REPLIES 6
mattf

Community Trekker

Joined:

Jun 23, 2011

Solution

Set column width with JSL?

Hi:

dt = New Table( "test");

dt << New Column( "new");

column("new") << Get Field Width();  // default 10;

column("new") << Set Field Width(30);

column('new") << Get Field Width(); // now shows 30;

Show Properties(:new);  // log shows  a large number of properties, including field width;

Hope this helps,

-Matt

pmroz

Super User

Joined:

Jun 23, 2011

Set column width with JSL?

Hi Matt,

That works if the column title is short.  However I have longer column names, and it appears that you can't set the field width to anything shorter than the column header.  For example:

dt = New Table( "test");

dt << New Column( "Curr Serious");

column("Curr Serious") << Get Field Width()// default 10;

column("Curr Serious") << Set Field Width(30);

column("Curr Serious") << Set Field Width(3); // shrinks the column but not to 3

ms

Super User

Joined:

Jun 23, 2011

Set column width with JSL?

For that situation you could use a short dummy name to force the apparent width to obey the field width.

dt = New Table( "test");

col=dt << New Column( "Curr Serious");

colname=col<<get name;

col << Set Field Width(30);

col<<set name("qqq");  // Any short unused temporary name

col << Set Field Width(3); // shrinks the column but not to 3

col<<set name(colname); // Reset column name, without changing width

However, controlling the table appearance by setting the field width property is not a general solution or comparable to manually changing column with by dragging the border. For instance, if the width is set to fewer characters than the cell content "###" or similar is shown instead of the value.

tatarjj

Community Trekker

Joined:

Mar 13, 2018

Re: Set column width with JSL?

I have tried all the suggested solutions in this thread and none of them work.  I am using JMP 13.2.1. 

  1. Set Width does nothing if the column title exceeds the width you are trying to set. 
  2. Set Dispaly Width does nothing if the column title exceeds the width you are trying to set.. 
  3. If I name the column something short like "xxx", set the width to 5, set the display width to 5, and then leave the column named as "xxx" then the column width stays narrow.  However, as soon as I use the code column("xxx") << Set Name("Some long column name"); then the width of the column expands to try to (unsuccessfully) fit the column name.

So, the original question remains: does JMP have a way to set the column width using JSL, or do I have to manually adjust the column widths on these hundreds of columns and dozens of JMP files myself?  It's real easy to tell someone to "just do it manually" when you're not the one having to do it hundreds of times across dozens of files. :(

robust1972

Community Trekker

Joined:

Jan 15, 2014

Re: Set column width with JSL?

hi, Matt

Can I set the column width to fit the longest title and cell content for few columns? Recently I tried to color the cells to draw wafer maps but I have to manually adjust the width of columns.

Thanks!

Highlighted
David_Burnham

Super User

Joined:

Jul 13, 2011

Solution

Re: Set column width with JSL?

Peter

Version 12 has a new column message: Set Display Width.


Try( Column(dtCopy,"Viable cell density") << Set Display Width(120) ):

Try( Column(dtCopy,"Viable cell density") << Set Display Width(120) );

Dave

-Dave