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
johnm
Level III

for loop stopping

I'm stumped at the moment on an issue with a FOR loop.  (using JMP16)  

// open a window
mywindow = New Window(" xyz ", .....etc.);

// create journal
myjrn = mywindow << journal window; 

For( i = 1, i <= 100, i++,  

// do a lot of lines of lines requiring about 5' run time.
	// periodically journal objects.

	Close All( data tables, no save )
);  // end to for loop

// SAVE the journal:
myjrn << save journal( "my.jrn" );

The loop stops after an iteration. 

(I can restart the loop after the for (i=1, i<=100, i++,   stops and doesn't proceed to i=2. 

for (i=2,i<=100, i++,  stops and doesn't proceed to i=3.

for (i=3,i<=100, i++, stops and doesn't process to i=4. 

 

Welcoming thoughts on what is causing this? resolution?

 

Thanks,

John

 

 

4 REPLIES 4

Re: for loop stopping

Does each code in each iteration depend on the data tables that you are closing within the For() function?

Jeff_Perkinson
Community Manager Community Manager

Re: for loop stopping

Without seeing all the code it's difficult to diagnose.

 

First check the log window for any errors.

 

If there are none, then I'd start with looking at the value of i after the For() loop. I suspect you'll find it's greater than 100. Then you need to see where it is getting changed inadvertently. This can occasionally happen with name collisions with columns in a data table. If you just can't figure out where that could be happening, try changing the i to something else and see if it starts working. That will confirm the name collision.

-Jeff
txnelson
Super User

Re: for loop stopping

Is it possible that somewhere in your Fro() loop, that you are setting the variable "i" to a large value?

Jim
David_Burnham
Super User (Alumni)

Re: for loop stopping

Do you have other parts of code using "i" as a variable?  Could the variable be getting reassigned (e.g. if you are using user-defined functions)?

-Dave