Page 1 of 1

Lookup Search Issue

Posted: Mon Apr 11, 2022 3:03 pm
by rrandall
Hi,

I have a baffling problem I am unable to resolve, perhaps someone can get me going in the right direction:

I have a simple lookup on a subform for looking up product codes and descriptions, but it refuses to find any record when given the search phrase “high”. As an example, a record containing the word “highlighter” is found if searching for the phrase “lighter” but not found for any of these input search phrases:

"highlighter"
"high"

I am using versions:
DB - V.4.5-2022.01.30.00
Files: V.4.5-2022.02.01.01

Any ideas?
Capture.PNG

Re: Lookup Search Issue

Posted: Mon Apr 11, 2022 3:17 pm
by kev1n
Hi,

I could replicate that here and think it's not supposed to be like that and I'll look into it.
As a workaround, click the magnifying glass after entering the string to see the lookup form.

Re: Lookup Search Issue

Posted: Mon Apr 11, 2022 3:57 pm
by rrandall
Thank you kev1n :)
I also found this error in nuDebug that might be of help:

Code: Select all

[0] : 
===USER==========

globeadmin

===PDO MESSAGE=== 

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'HIGH'' != ''
					ORDER BY prosup_code' at line 5

===SQL=========== 


					SELECT product_supplier_id, prosup_code, prosup_description
					 FROM product_supplier   JOIN product ON product.product_id = product_supplier.prosup_product_id
					 WHERE prosup_supplier_id = 'a0ba5ff9ec808d1'
					AND (prosup_code LIKE ? OR prosup_description LIKE ?)
					AND ''HIGH'' != ''
					ORDER BY prosup_code
					

===BACK TRACE====

/var/www/html/core/nuform.php - line 829 (nuRunQuery)

/var/www/html/core/nuapi.php - line 79 (nuGetAllLookupList)

Re: Lookup Search Issue

Posted: Mon Apr 11, 2022 8:38 pm
by kev1n
Try this patch:

Replace in nuform.php from line 805 this code block

Code: Select all

	$s				= "
					SELECT $id, $code, $description
					$SQL->from
					$SQL->where
					AND $code = ?
					ORDER BY $code
					";

	$s				= nuReplaceHashVariables($s);
	$t				= nuRunQuery($s, array($C));
with

Code: Select all

	$s				= "
					SELECT $id, $code, $description
					$SQL->from
					$SQL->where
					AND $code LIKE ? AND '$C' != '' 
					ORDER BY $code
					";

	$s				= nuReplaceHashVariables($s);
	
	$t				= nuRunQuery($s, array('%' . $C . '%'));

Re: Lookup Search Issue

Posted: Tue Apr 12, 2022 11:39 am
by rrandall
Hi kev1n,

Thank you, I replaced the code as you suggested, but unfortunately it doesn't work. I still get the same result. However, I don't get any errors in the logs now.

Re: Lookup Search Issue

Posted: Tue Apr 12, 2022 11:45 am
by kev1n
What do you enter, what do you see and what result do you expect?
Video_2022-04-12_114150.gif

Re: Lookup Search Issue

Posted: Tue Apr 12, 2022 3:36 pm
by rrandall
When typing “lighter” as the search phrase and hitting enter, the browse screen pops up with the correct search criteria:
c1.png
c2.png
Doing the same, but using “high” as the search phrase, does nothing but clear the box where the word “high” was typed. I would have expected the same browse screen to pop up with the same 2 records listed, as both contain the word “high”.
c3.png
c4.png

Re: Lookup Search Issue

Posted: Tue Apr 12, 2022 4:01 pm
by kev1n
Doing the same, but using “high” as the search phrase, does nothing but clear the box where the word “high” was typed.
That works for me, see my recording.