ORM isIn() casting

I have a query using isIn() with a list that needs to go to a short.
ex. isIn(“field”, “1,2,3”)
field is cast as a short in the property. (tinyint in MSSQL DB)
Also tried and array [1,2,3] and couldn’t get to work.

Any easy way to do this? I can move everything to .or() and each item but that is a pain.

For each item in the array, you might need to apply autoCast() – autoCast - ColdBox ORM Module

criteria = getInstance("EntityName").newCriteria();
results = criteria
	.isIn("field", [1, 2, 3].map( (item) => {
		return criteria.autoCast("field", item); })
	.map( (item) => {
		return item.getMemento();

I hope that helps.

Can you paste the exception it throws. Usually isIn() expects the array. You can also cast an array to an array of specific types by adding [] to your javacast. javaCast( "int[]", array )

Tried that get “argument type mismatch”.

The other error is double to short if I don’t JavaCast() the array.

FYI. The Exception screen always show the wrong line numbers in the right top code screen. I am using 6.8.0-snapshot. Can’t get Commandbox to update to 6.8.0+4. Guess I will have to uninstall and re-install Coldbox.

Can you report more in order to help you. Maybe posting your entities and db types