cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to move from signal modeling to system modeling at the first JMP Aerospace Analytics webinar. Register. June 18, 1 p.m. US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
dadawasozo
Level IV

counting total item in each cell that contain different pattern

Hi,
I want to get the total count of the item in the cell under setting columns. Can someone give me suggestion how I can code it so it will take the value under :setting column and count the total number like what shown under :Total Items. Many Thanks.

dadawasozo_0-1649977351362.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: counting total item in each cell that contain different pattern

Here is the formula for the column Total Items, that I came up with.

count = 0;
i = 1;
While( Word( i, :setting, "," ) != "",
	theWord = Word( i, :setting, "," );
	If( Contains( theWord, "-" ) | Contains( theWord, ":" ),
		Show( Row(), theWord );
		count = ((count + Num( Word( 2, theWord, "-:" ) )) - Num( Word( 1, theWord, "-:" ) )) + 1;
	,
		count
		++);
	i++;
);
count;

 

Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: counting total item in each cell that contain different pattern

Here is the formula for the column Total Items, that I came up with.

count = 0;
i = 1;
While( Word( i, :setting, "," ) != "",
	theWord = Word( i, :setting, "," );
	If( Contains( theWord, "-" ) | Contains( theWord, ":" ),
		Show( Row(), theWord );
		count = ((count + Num( Word( 2, theWord, "-:" ) )) - Num( Word( 1, theWord, "-:" ) )) + 1;
	,
		count
		++);
	i++;
);
count;

 

Jim
dadawasozo
Level IV

Re: counting total item in each cell that contain different pattern

This is amazing! I was only able to do one type str count. I learn new thing. Thanks a lot.

Recommended Articles