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
WebDesignesCrow
Super User

How to add Continuous Count row with IF statement

Hi Expert,

 

How can I add a new column (D) that able to add count row IF "CompareSeqVsAlarmDP" is 1 in sequence using JSL?

I can reproduce this condition in Excel using IF statement : IF((C27=0),0,(C27+D26)).

But still unsuccessful to convert the IF condition in JMP. 

I think something wrong with my IF statement. My JSL statement is as below:

dt1:New Column << Set Formula(If(:"CompareSeqVsAlarmDP=z"n == ., 0, :"CompareSeqVsAlarmDP=z"n + (:New Column - 1)))

WebDesignesCrow_0-1701944140251.png

WebDesignesCrow_1-1701945079338.png

thank you in advance!

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User

Re: How to add Continuous Count row with IF statement

Here is how I would handle your issue

This formula starts the count off as 0 and then increments it if   "CompareSeqVsAlarmDP=z" is not a 0

As Constant( count = 0 );
If( :"CompareSeqVsAlarmDP=z"n != 0,
	count++,
	count = 0
);
count;
Jim

View solution in original post

WebDesignesCrow
Super User

Re: How to add Continuous Count row with IF statement

Thank you very much @txnelson !

The step gives a better logic.

Just for my future revision, this is how to do it in manually.

WebDesignesCrow_1-1701998747011.png

 

The script for New Column: (i just change ; to +)

 

As Constant( count = 0 )
+If( :CompareSeqVsAlarmDP == !0,
count++,
count = 0
);

 

 

 

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: How to add Continuous Count row with IF statement

Here is how I would handle your issue

This formula starts the count off as 0 and then increments it if   "CompareSeqVsAlarmDP=z" is not a 0

As Constant( count = 0 );
If( :"CompareSeqVsAlarmDP=z"n != 0,
	count++,
	count = 0
);
count;
Jim
WebDesignesCrow
Super User

Re: How to add Continuous Count row with IF statement

Thank you very much @txnelson !

The step gives a better logic.

Just for my future revision, this is how to do it in manually.

WebDesignesCrow_1-1701998747011.png

 

The script for New Column: (i just change ; to +)

 

As Constant( count = 0 )
+If( :CompareSeqVsAlarmDP == !0,
count++,
count = 0
);