Count number of rows in column, with matching characterHi,
I'm trying to wirte a jsl code to get a count of the number of strings(rows) with a certain specified characters at a certain position within the column.
Eg. I want to get the count of the number of the rows containing sting "1" between the rows containing only three "P" characters
In this case, the row count would be 26. Please advice.

Thanks,
Jackie
Automation and ScriptingRe: Count number of rows in column, with matching characterThanks Craige!
Re: Count number of rows in column, with matching characterCraige,
Neat solution
Re: Count number of rows in column, with matching characterHere's a pattern matching idea
dt = Open( "/Z:/data table_sample.jmp" );
// turn the column into a string
txt = Concat Items( dt:column1 << getvalues, "" );
Pat Match(
txt,
"PPP" + Pat Pos() >> pos + Pat Span( "1" ) >> run + "PPP" +
Pat Test(
Show( pos + 1, Length( run ) );
0; // this time the test fails to make it retry the match
)
);
pos + 1 = 30;
Length(run) = 26;
pos + 1 = 88;
Length(run) = 26;
Re: Count number of rows in column, with matching character@jthi
So it can be store in a variable maybe N_rows something. No, it has to be 3Ps in a row and yes ignore the calculate for other Ps
Re: Count number of rows in column, with matching characterWhere do you want to store those results? Can there be more or less than 3Ps in row and if there can be, should the calculation for those Ps be ignored?