cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

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

How to set values for columns when adding rows?

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Add Rows( 1, At End, {:name},{"Freddy"});

Hi,

 

I'm trying to add rows, and then set values for each column in the data table but it only adds a row without any values. What am I doing wrong in my script?

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to set values for columns when adding rows?

I'm not 100% sure if you can set n or "location" when setting specific values, but values will get added to end by default (I think).

 

Below is example from Scripting Index. It will add new row with name colum set to "David" and age column set to 15.

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Add Rows({name = "David", age = 15});

Also see this Scripting Guide > Data Tables > Rows > Add Rows 

 

-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: How to set values for columns when adding rows?

I'm not 100% sure if you can set n or "location" when setting specific values, but values will get added to end by default (I think).

 

Below is example from Scripting Index. It will add new row with name colum set to "David" and age column set to 15.

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Add Rows({name = "David", age = 15});

Also see this Scripting Guide > Data Tables > Rows > Add Rows 

 

-Jarmo

Recommended Articles