cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
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