cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar

easy way to add rows (with values) to a data table

☐ cool new feature
☐ could help many users!

☐ removes a „bug“

☐ nice to have

☑  nobody needs it

 

For Table boxes, there is a nice command 

 

<< add row( list of values)

to add rows. As an argument, one can submit a list of the values - extremely elegant and useful for dirty coding

 

 

https://community.jmp.com/t5/Discussions/Collection-of-quot-funny-quot-JSL-newbie-questions/m-p/5590...

 

The command 

 

<< add row( ... )

can even be sent to data tables. Then a row is added, but  unfortunately, without values.

 

 

As Jarmo found out, there is a way to specify the values, but it's much more complicated:, especially if the data table has more than a single column:
https://community.jmp.com/t5/Discussions/Collection-of-quot-funny-quot-JSL-newbie-questions/m-p/5590...  

 

 

 

 

 

 

dt << Add Row({"Column 1"n = 1});

 

 

 

 

 

 

 

My wish:
A command like 

<< add row( list of values)

which also works for data tables.

 

more wishes submitted by  hogi_2-1702196401638.png

4 Comments
jthi
Super User

There could be a reason why Add Rows is so strict.

 

How would you like that command to behave when user doesn't add enough values? You will end up with very messy table with this

Names Default To Here(1);
New Window("test",
	tb = Table Box(String Col Box("string col", {"a"}), Number Col Box("number col", {1}))
);
tb << add row({"b"});
tb << add row({"b", 2});

jthi_0-1666365569749.png

 

You can kinda do this already with data table subscripting (this is what I use from time to time, if I have to add values to ALL columns):

Names Default To Here(1);
dt = New Table("test",
	New Column("Col1", Numeric),
	New Column("Col2", Numeric),
);

dt << Add Rows(1);
dt[N Rows(), 0] = [1 2];

dt << Add Rows(1);
dt[N Rows(), 0] = [1];

Second one will throw because you are trying to add less values to the row than there are columns

jthi_1-1666365678531.png

With custom function this could be handled, but how would know from which side to drop values? Left, right or maybe middle? Or what would happen if data types do not match?

hogi
Level XII

Hm, there are many other functions in JMP which have a problem if the user doesn't proved the values that were expected

 

On the other hand, it would be so super-easy to add rows and the values in one rush, just by handing over the list of values to data tables - like it's possible for Table Boxes.

hogi
Level XII

Thanks @jthi . The idea with the data table subscripting is very useful

hogi
Level XII

@Sarah-Sylvestre 
low prio -> can be closed and reactivated once the important ones are finished.