Still wrestling with getting queries correct

I seem to be having far to much trouble with all the different ways to query: This is the error I am receiving.

Lucee Error (expression)
Message can’t cast [i] string to a number value
Stacktrace The Error Occurred in
C:\inetpub\wwwroot\Citidel5\coldbox\system\web\context\ExceptionBean.cfc: line 567

This is my function in the handler:

function create( event, rc, prc ){
oConcern = populateModel( “concern” );
oConcern.setUserID( auth().getUserId() );
oConcern.setbusinessID( createUUID() );
validate( oConcern )
.onSuccess( ( result ) => {
concernService.create( oConcern );
cbMessageBox().info( “Business created!” );
relocate( “concerns” );
} )
.onError( ( result ) => {
cbMessageBox().error( result.getAllErrors() );
new ( argumentCollection = arguments );
} );

This is the function in the concernServices model:

function create( required oConcern ) {
var id = createUUID();

	//directoryCreate( '/centralizedAssets/Internal/#ID#' );
	//directoryCreate( '/centralizedAssets/Projects/#ID#' );
	//directoryCreate( '/centralizedAssets/Staff/#ID#' );
	//directoryCreate( '/centralizedAssets/HR/#ID#' );
		.insert( {
		"ID"					: oConcern.setbusinessID(),
		"concernName"			: oConcern.getconcernName(),
		"businessAddressOne"	: oConcern.getbusinessAddressOne(),
		"businessAddressTwo"	: oConcern.getbusinessAddressTwo(),
		"businessCity"			: oConcern.getbusinessCity(),
		"businessState"			: oConcern.getbusinessState(),
		"businessZipcode"		: oConcern.getbusinessZipcode(),
		"businessPrimaryPhone"	: oConcern.getbusinessPrimaryPhone(),
		"Country"				: oConcern.getCountry(),
		"timeInBusiness"		: oConcern.gettimeInBusiness(),
		"Description" 			: oConcern.getDescription(),
		"datecreated"			: now(),
		"userIDfk"				: oConcern.getUserID()
//userquery = wirebox.getInstance('QueryBuilder@qb');
	query.newQuery().from( "staff_concern" )
		.insert( {
			"userIDfk" = auth().getUserId(),
			"concernIDfk" = #id#
		} );

	relocate( "concerns" );

And this is the concern Model:

//property name="concernService" inject;
//property name="bcrypt" inject="@BCrypt" persistent="false";

property name="ID";
property name="concernName";
property name="businessAddressOne";
property name="businessAddressTwo";
property name="businessCity";
property name="businessState";
property name="businessZipcode";
property name="businessPrimaryPhone";
property name="Country";
property name="timeInBusiness";
property name="Description";
property name="dateCreated";
property name="userIDfk";


Thank you in advance for the help!!


I managed to fix this but I still don’t exactly understand what was happening!!!

It seems like there could be a few things going on, hard to say without more info.

Does your concern Model define its constraints with this.constraints? That wasn’t in what you posted.

I would also suggest using cbDebugger if you aren’t already. It has helped me track down bugs and resolve issues more times than I can count.

Just my $0.02, Have a great day!

i did not have any constraints, I made everything as simple as I could to try to find what the issue was. I was setting these two values:
oConcern.setUserID( auth().getUserId() );
oConcern.setbusinessID( createUUID() );

in the handler. When I removed them and set them in the concernServices model the error went away. It’s now back in my update object so I have no idea???

Additionally, I can’t seem to use auth().getUserId() in the concernServices model, even with the paramater set for auth at the top it says it has no function auth. I am confident if I can figure this coldbox system out it will be so much better than the old school way I came up with. I was using coldfusion in 95 when it was basically a bunch of perl scripts!!! LOL Fusebox was the last style I used!

Lucee Error (expression)
Message can’t cast [i] string to a number value
Stacktrace The Error Occurred in
C:\inetpub\wwwroot\Citidel5\coldbox\system\web\context\ExceptionBean.cfc: line 567

565: commaposarr = reFindNoCase( “,”, string, 1, true );
566: if ( commaposarr.pos[ 1 ] != 0 ) {
567: commapos = “i” + commaposarr.pos[ arrayLen( commaposarr.pos ) ];
568: }
569: }
called from C:\inetpub\wwwroot\Citidel5\coldbox\system\web\context\ExceptionBean.cfc: line 445
called from C:\inetpub\wwwroot\Citidel5\coldbox\system\exceptions\Whoops.cfm: line 352
called from C:\inetpub\wwwroot\Citidel5\coldbox\system\Bootstrap.cfc: line 682
called from C:\inetpub\wwwroot\Citidel5\coldbox\system\Bootstrap.cfc: line 422
called from C:\inetpub\wwwroot\Citidel5\coldbox\system\Bootstrap.cfc: line 506
called from C:\inetpub\wwwroot\Citidel5\Application.cfc: line 120
Java Stacktrace lucee.runtime.exp.CasterException: can’t cast [i] string to a number value
at lucee.runtime.op.Caster.toDoubleValueViaDate(
at lucee.runtime.op.Caster.toDoubleValue(
at lucee.runtime.op.Caster.toDoubleValue(
at lucee.runtime.op.Operator.plusRef(
at system.web.context.exceptionbean_cfc$cf.udfCall3(/coldbox/system/web/context/ExceptionBean.cfc:567)
at system.web.context.exceptionbean_cfc$cf.udfCall(/coldbox/system/web/context/ExceptionBean.cfc)
at lucee.runtime.type.UDFImpl.implementation(
at lucee.runtime.type.UDFImpl._call(
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(
at lucee.runtime.PageContextImpl.getFunction(
at system.web.context.exceptionbean_cfc$cf.udfCall3(/coldbox/system/web/context/ExceptionBean.cfc:445)
at system.web.context.exceptionbean_cfc$cf.udfCall(/coldbox/system/web/context/ExceptionBean.cfc)