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 create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

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

Optimize "for each row"

Hello,

I have this script on the Big Class table.

On large tables, it takes too much time.

Is there some other quicker way?

 

 

AgesList = {13,14};
for each row(dt, if(Contains(AgesList ,dt:Name("Age"))>0,dt:Name("height")=-1));

 

 

Thanks.

 
 
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
pmroz
Super User

Re: Optimize "for each row"

This might be faster

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
AgesList = {13, 14};
ages_rows = dt << get rows where(contains(ageslist, dt:age));
dt:height[ages_rows] = -1;

View solution in original post

2 REPLIES 2

Re: Optimize "for each row"

There are a few unnecessary elements in your script. I do not know if they would add that much time, though. Here is a stripped-down, cleaner version:

 

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

AgesList = {13, 14};

For Each Row(
	If( Contains( AgesList, dt:age ),
		dt:height = -1;
	);
);
pmroz
Super User

Re: Optimize "for each row"

This might be faster

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
AgesList = {13, 14};
ages_rows = dt << get rows where(contains(ageslist, dt:age));
dt:height[ages_rows] = -1;

Recommended Articles