cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
mostarr
Level IV

Insert() Not Functioning as Hoped

I'm using Insert() as indicated in the Scripting Index,

Insert(list, stuff, <optional index>);

I'm excluding the optional index in my case.

 

To test my code, I created a dummy variable, temp, initiated it with

temp = {};

then every iteration of my for loop (where other things work and I'm sure it is basically structured correctly--though I realize that is a vague statement and possibly has some holes in it) I add the result of an output variable to temp. Outside after the for loop I Write() temp. The result is an empty list, {}.

 

I don't know why Insert() isn't working, even in "test mode".

 

=(

 

Thank you all for being such an accommodating community. I realize I throw a lot of errors your way.

Mike

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Insert() Not Functioning as Hoped

A quick guess is that you really want to use
Insert Into()
Jim

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: Insert() Not Functioning as Hoped

A quick guess is that you really want to use
Insert Into()
Jim
mostarr
Level IV

Re: Insert() Not Functioning as Hoped

Thank you muchly, @txnelson, I don't know why that works but it does. JMP is such a strange language to me, coming from Python.

Jeff_Perkinson
Community Manager Community Manager

Re: Insert() Not Functioning as Hoped

The documentation for List Operators and Functions is useful here.

Insert Into()

Insert Into(list, x, <i>)

Inserts a new item (x) into the list at the given position (i). If i is not given, the item is added to the end of the list. This function does change the original list.

Insert()

list = Insert(list, x, <i>)

Returns a copy of the list with a new item (x) inserted into the list at the given position (i). If i is not given, the item is added to the end of the list. This function does not change the original list.

 

-Jeff