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
ENTHU
Level IV

Help with error message - Argument is wrong type in access or evaluation of 'Contains'

I need to check if the columns contain either of the 2 strings and then replace column value with value in another column.

Here's the code -

For(i=1,i<= NRows(dt),i++,
if(contains(:step[i],"NA")| contains(:step[i],".") ,
:step[i] = description[i];
)

);

 

But I get an error saying - argument is wrong type in access or evaluation of 'Contains'

What am I doing wrong here?

1 REPLY 1
txnelson
Super User

Help with error message - Argument is wrong type in access or evaluation of 'Contains'

I beleive the issue is that your column called "description" is not properly being scoped.  It needs to have a ":" in front of its reference ":description".

Here is an example using a sample data table, that does what you want

Names Default To Here( 1 );
dt = Open("$SAMPLE_DATA/Big Class.jmp");
For( i = 1, i <= N Rows( dt ), i++,
	If( Contains( :Name[i], "TIM" ) | Contains( :Name[i], "ROBERT" ),
		:Name[i] = :Sex[i]
	)
);
Jim

Recommended Articles