cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP Security Notice: CVE-2026-109618 and CVE-2026-109619

    JMP promptly initiated a review of its products, services, and relevant infrastructure for exposure to CVE-2026-109618 and CVE-2026-109619.

    Our assessment of JMP products has not identified exposure to these vulnerabilities. Where remediation was required within supporting environments, appropriate security updates and controls have been applied and validated.

    We have identified no evidence of successful exploitation or unauthorized access to JMP systems or customer information associated with these vulnerabilities.

    JMP continues to monitor the issue and relevant vendor guidance. No action is required by JMP customers at this time.

  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
matt_p
Level II

How to multiply multiple columns by a constant?

I am working with a data table near ~250 columns. For about half of the columns, I need to multiply the column by 1000 (for mA).

I would like to do this without having to create a new column every time (reassigning the column).

Throwing this code into my script, I  have

DataTable("Temp")<< (:Col_To_Multiply *= 1000);

This equation is not changing my column at all, and its also not throwing any errors.

This is only for one column, and keep in mind I need to do this for ~125 columns.

Any ideas on the equation or how to do this dynamically would be great.

Thanks in advance!

-Matt

1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User (Alumni) ms
Super User (Alumni)

Re: How to multiply multiple columns by a constant?

Here is one way to do it (the script applies the factor 1000 to all columns. It is rather straighforward to adapt the for-loop to cover only columns of interest, i.e. loop over a list of those columns).

 

 

dt = Current Data Table();
For( i = 1, i <= N Col( dt ), i++,
  Column( i ) << set values( (Column( i ) << get as matrix) * 1000 )
);

 

View solution in original post

2 REPLIES 2
ms
Super User (Alumni) ms
Super User (Alumni)

Re: How to multiply multiple columns by a constant?

Here is one way to do it (the script applies the factor 1000 to all columns. It is rather straighforward to adapt the for-loop to cover only columns of interest, i.e. loop over a list of those columns).

 

 

dt = Current Data Table();
For( i = 1, i <= N Col( dt ), i++,
  Column( i ) << set values( (Column( i ) << get as matrix) * 1000 )
);

 

matt_p
Level II

Re: How to multiply multiple columns by a constant?

Thanks for the help, worked awesome!

 

This was the final code I ended up if anyone else has this question:

 

 

dt = Current Data Table();
For( i = 1, i <= N Col(dt ), i++,
  a=Column(i) << get name;
  if ( contains(a, "Col_To_Multiply"),
  Column( i ) << set values( (Column( i ) << get as matrix) * 1000 ),
 
  );
);

 

Recommended Articles