cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
loysius
Level II

How do I pull a Column Info edit as script?

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
pmroz
Super User

Re: How do I pull a Column Info edit as script?

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 );

View solution in original post

4 REPLIES 4
pmroz
Super User

Re: How do I pull a Column Info edit as script?

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
Level II

Re: How do I pull a Column Info edit as script?

Thank you PMroz this worked perfectly.

Eric_Hill
Staff

Re: How do I pull a Column Info edit as script?

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
Level II

Re: How do I pull a Column Info edit as script?

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