Text field search not working

Why does this find an existing record:

var fsGoal = forms.goal_browse.foundset.duplicateFoundSet();
fsGoal.find();
fsGoal.goal_student_id = student_uid;
if(assessment_uid) {
	fsGoal.goal_assessment_id = assessment_uid;
} else {
	fsGoal.goal_assessment_id = "^=";  
} 
fsGoal.created_d = globals.UTIL_dateTimeFrom4D(aFieldStr[3-1], aFieldStr[4-1]); 			
recs = fsGoal.search();

… but this does not:

var fsGoal = forms.goal_browse.foundset.duplicateFoundSet();
fsGoal.find();
fsGoal.goal_student_id = student_uid;
fsGoal.goal_text = goalText
if(assessment_uid) {
	fsGoal.goal_assessment_id = assessment_uid;
} else {
	fsGoal.goal_assessment_id = "^=";  
} 
fsGoal.created_d = globals.UTIL_dateTimeFrom4D(aFieldStr[3-1], aFieldStr[4-1]); 			
recs = fsGoal.search();

When tested in the interactive console, the value of fsGoal.goal_text and goalText are the same,

“New annual goal [781] for Carlson, Jeffrey…”

… and when I try in the console,

(fsGoal.goal_text == goalText)

…it returns true -???

The action for the second search (in the performance data) appears as follows:

select goal_assessment_goal_id from assessment_goal where created_d = ? and goal_assessment_id = ? and goal_text between ? and ? and goal_student_id = ? and tenant_id = ? order by goal_assessment_goal_id asc limit ?

Thank you,
Don

The ellipsis ‘…’ in your value is interpreted by Servoy as a hint to build a ‘between’ query.

I would get rid of the ellipsis and replace them with ‘%’, something like:
fsGoal.goal_text = goalText.replace(‘…’, ‘%’);

Are ellipsis the only metacharacters to be concerned about? The goals can be detailed, longish things – there might be other metacharacters in them. Isn’t there some way to turn off what Servoy is doing?

Thank you,
Don

Have a look in the wiki: http://wiki.servoy.com/display/public/D … +with+Data especially the section about ‘Special Operators’

Hi Patrick,

Yes, I have read through those operators several times and have used them where relevant. But I need to do full-text searches regardless of content. Isn’t there a way to turn the meta stuff off for a particular search? Maybe a leading character that indicates to Servoy that it should treat all the subsequent text as literal?

Thank you,
Don