Hi Guys,
Been using Appgini for several months now to try and create an inventory management program for my company. Everything is coming along good however I am running into one problem I cant figure out how to solve. We have an autolookup filed and when the user scans a barcode into that field it pulls back the information on the skid, such as product number and case count.
Where I am having a problem is if I have a barcode with the value 10 and one entered with the value 100, when they scan barcode 10 it also pulls back 100 in the drop down menu. Is there any way for me to limit the auto lookup to exact matches only. If they scan barcode 10 I don't want it to pull back 10, 100 and 1000 as well.
Auto Lookup show only exact match
Re: Auto Lookup show only exact match
Do you have other lookup fields in your application? If not, this would do the trick: Open the generated "ajax_combo.php" in a text editor and find this line:
and modify it to:
Beware that if you have other lookup fields, the above would cause them to return exact matches only.
Code: Select all
$wheres[] = "{$field['parent_caption']} like '%{$search_term}%'";
Code: Select all
$wheres[] = "{$field['parent_caption']}='{$search_term}'";

- DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
- Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.
- Need personalized consulting on your specific app and customizations? Book an online call with me here.
Re: Auto Lookup show only exact match
Thanks for the code it worked perfectly! And the fast response is much appreciated, is it possible to change the code to have the quick search filed at the top act the same way, return only exact matches?
Re: Auto Lookup show only exact match
I spoke to soon, when I changed like to = and type in a value it returns no results even though the value exist in the lookup table. Should I use ==?
Re: Auto Lookup show only exact match
Hmm .. == is not part of SQL syntax and won't work ... maybe this might work:
Code: Select all
$wheres[] = "{$field['parent_caption']} like '{$search_term}'";

- DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
- Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.
- Need personalized consulting on your specific app and customizations? Book an online call with me here.