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

Highlighted

- 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
(2281 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

Created:
Jun 13, 2019 9:11 AM
| Last Modified: Jun 13, 2019 9:12 AM
(2251 views)
| Posted in reply to message from txnelson 06-12-2019

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

Article Labels

There are no labels assigned to this post.