Subscribe Bookmark RSS Feed

How do I pull a Column Info edit as script?

loysius

Community Trekker

Joined:

Jun 5, 2015

Hello everyone,

So I had run my SQL query and created my datatable. Now I wanted to turn my column of numbers into a pretty US currency instead of the brick of numbers it was. I was able to right click on the PricePaid go to Column Info and make the change. Now I can't figure out how to copy that part out so I can add it to my script.

Anyone know how to pull that part out as a script? or perhaps how to change a column format from displaying 9999999.991 to $9,999,999.99?

Thanks for any help or direction with this,

Loysius

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Make a small subset of your table, and format the column for $999,999.99.  Click the little red triangle in the upper left corner and select Copy Table Script.  Paste the script into a script window and you'll see something like this:

New Table( "Untitled 2", Add Rows( 5 ),

     New Column( "PricePaid", Numeric, Continuous,

           Format( Currency( "USD" ), 17, 2 ),

       Set Values( [12345678, 43256443, 345353, 5545352, 53245345] )

     )

);

The relevant portion of the table script is on line 3.   You can pull this out like so:

dt = current data table();

column(dt, "PricePaid") << Format( Currency( "USD" ), 17, 2 );

4 REPLIES
Solution

Make a small subset of your table, and format the column for $999,999.99.  Click the little red triangle in the upper left corner and select Copy Table Script.  Paste the script into a script window and you'll see something like this:

New Table( "Untitled 2", Add Rows( 5 ),

     New Column( "PricePaid", Numeric, Continuous,

           Format( Currency( "USD" ), 17, 2 ),

       Set Values( [12345678, 43256443, 345353, 5545352, 53245345] )

     )

);

The relevant portion of the table script is on line 3.   You can pull this out like so:

dt = current data table();

column(dt, "PricePaid") << Format( Currency( "USD" ), 17, 2 );

loysius

Community Trekker

Joined:

Jun 5, 2015

Thank you PMroz this worked perfectly.

erichill

Staff

Joined:

Oct 1, 2013

PMroz has the answer, but I might add that if you have JMP 12 and you use Query Builder to make your SQL queries, you can interactively format columns returned from a query:

9260_format_column.png

You can also set modeling type for returned columns.  One of the benefits of Query Builder, even if you are comfortable writing your own SQL, is that it has interactive ways to do some of these things so that you might otherwise have to write scripts to do.

Eric

loysius

Community Trekker

Joined:

Jun 5, 2015

Thank you for the response Eric, sadly I'm using JMP 10.