Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Trouble adding a list to a Table Box

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jun 12, 2019 6:52 PM
(1866 views)

I am a newbie at JSL and I know I am missing something simple...

My code is:

```
For(i = 1, i<= NItems(x), i++,
rowNum = totByBox << Get Rows Where( :BOXID == x[i]);
xlist[i] = totByBox:FreeSpace[rowNum];
);
show(xlist[1]);
New Window ("Plasmids Location",
Table Box(
Number Col Box("Box ID", nDTbyVec[0, 1] ),
String Col Box("Vector# ", nDTbyVec[0, 2]),
Number Col Box("# of Vial", nDTbyVec[0, 4]),
Number Col Box("Space Available ", xlist),
));
```

Where I have xlist collect numbers from a data table. When I show xlist in the console, it is:

xlist = {[34], [93]};

I think I will have to convert it to {34, 93} if I hope to add it to the Number Col Box. Is there anyway to accomplish this..?

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

What you have done, is to place a matrix value into each of the 2 elements of your list. You can clear that, by setting each of the List values, to the 1st element of each of your matricies. In your case, each matrix only has one element, therefore, the following code will reset the elements in the list to simple scaler values:

```
xlist = {[34], [93]};
xlist[1]=xlist[1][1];
xlist[2]=xlist[2][1];
show(xlist);
```

The results of the Show() is:

`xlist = {34, 93};`

Jim

3 REPLIES 3

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

What you have done, is to place a matrix value into each of the 2 elements of your list. You can clear that, by setting each of the List values, to the 1st element of each of your matricies. In your case, each matrix only has one element, therefore, the following code will reset the elements in the list to simple scaler values:

```
xlist = {[34], [93]};
xlist[1]=xlist[1][1];
xlist[2]=xlist[2][1];
show(xlist);
```

The results of the Show() is:

`xlist = {34, 93};`

Jim

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Trouble adding a list to a Table Box

Thank you for your help. That definitely worked.

Do you know if there is a funciton that can quickly convert something like this to a list? Another way I was able to take your suggestion and make it more flexible is to use a for loop where:

```
for( i = i, i<= NItems(xlist), i++,
xlist[i] = xlist[i][1];
);
```

I was just wondering if there is a built in function or another more efficient way I can do this,

Thank you again

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Trouble adding a list to a Table Box

I do not know of a better way than using a For() Loop. However, I suggest that you look at the place in your code, where you are creating the elements in the list, and see if as you insert an element into the list, that you convert the matrix to a scaler at that point.

Jim