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
GreenisBTFL
Level I

Reference portion of array/list indirectly

Using JMP 17.0.0, Windows 10.

I've been unsuccessful at finding documentation on what I want to do, and it seems not to be as easy as I thought it would be...

 

What I want is to update a table (dtJ) with columns from another table (dtN), but not define precisely how many columns to add, as the amount of columns to be added may differ each time my For loop runs. 

For( r = 1, r <= N Items( dtlist ), r++,
	dtN = Open( myPath || mySiteanalysis || dtlist[r] || myFilepost );
	dtNnames = dtN << Get Column Names ();
	dtNnamesv = N Items(dtNnames);

	dtJ << Update(
		With( dtN ),
		Match Columns( dtJ:dtJnames(r+13) = dtN:dtNnames(1) ),
		Add Columns from Update Table( dtN:dtNnames(2::dtNnamesv) ),
		Replace Columns in Main Table( None )
	);
	Close( dtN, nosave );
);

 

The columns to add from dtN should start at column 2 through the last column in dtN.  Apparently, 

2::dtNnamesv

nor other variations of it work.

 

Any guidance to this rather easy question would be greatly appreciated.  

1 REPLY 1
jthi
Super User

Re: Reference portion of array/list indirectly

Try changing

dtJ:dtJnames(r+13)

to

dtJ:dtJnames[r+13]

and so on (you use square brackets with indices)

mylist = {"a", "b", "c"};

Show(mylist[2::3]);
-Jarmo