cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
scott1588
Level IV

Cycle Problem

I have this recurring cycle detected problem that I cannot figure out and I'm hoping someone can help me.

 

See the attached example script. It generates a table. The idea here is I want to label each continuous runs of 1 in Column 1 as an Event with a sequential number.

 

The formula works. But when I make any modifications to the table or Rerun Formulas I get one, two, or sometimes three cycle detected errors. This is just an example table. On my actual data table, I have had to hit Ignore All Cycles sometimes up to a dozen times if I change a column formula or do other editing on the table.

 

Does anyone know what is causing this?

 

Thanks

 

 

New Table( "Cycle Problem",
	Add Rows( 21 ),
	New Table Variable( "P1", 3 ),
	New Column( "Column 1",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values(
			[0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0]
		)
	),
	New Column( "Column 2",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula(
			If(
				Row() == 1, :P1 = 0,
				:Column 1 == 1 & :Column 1[Row() - 1] == 0, :P1 = :P1 + 1,
				:Column 1 == 1, :P1
			)
		),
		Set Selected
	)
)
11 REPLIES 11
scott1588
Level IV

Re: Cycle Problem

@peng_liu , @jthi , and @brady_brady Thank you all for your solutions. I particularly like @jthi 's solution. I never knew Col Cumulative Sum could be used that way. Very simple, efficient, and elegant.

 

I'm still trying to wrap my head around how variable work in JMP. I'm not quite sure I have the whole picture yet but I'm working on it. 

jthi
Super User

Re: Cycle Problem

It can but I'm not 100% sure if you should even though it is one of the better features of JMP Formulas (JMP support told me it is unintended behavior). Here is a wish list item hoping that JMP would acknowledge that it is definitely needed behavior Make using formula expressions in Set Each Value and using expressions as first argument in Col stat... .

 

For the cycle problem and explanation of it, you could contact JMP Support. I could only provide guesses (which might be correct or totally incorrect) as I'm not a JMP developer but I can kinda understand it as it tries to be multiple values at the same time. This might also be a good read I'm Confused About Variables 

-Jarmo