HelpSpot Help Desk Software | HelpSpot Blog | HelpSpot Support

How to limit query to accept just entered values from Live Lookup?


#1

I have a query that pulls all customers from the table. I have more than 10k records. I want to limit my query to output just entered values from the table. My current code pulls out all records. Can anyone help me with that. Thanks in advance.

Here is my code:

<?xml version="1.0" encoding="utf-8"?><cfsilent>
<cfquery name="myQuery" datasource="Customers">
    SELECT  CustomerId,FirstName,LastName
    FROM    Customer
</cfquery>
<!--- These are standard elements which can be inserted back into a request --->
</cfsilent>
<livelookup version="1.0" columns="first_name,last_name"><cfoutput query="myQuery">
<customer>
    <customer_id>#XMLFormat(CustomerId)#</customer_id>
    <first_name>#XMLFormat(FirstName)#</first_name>
    <last_name>#XMLFormat(LastName)#</last_name>
</customer></cfoutput>
</livelookup>

#2

This could be why it doesn’t work at all (in your other thread). Perhaps all 10K can’t be pulled out in time. You may want to try limiting the number of results for now to see if that gets things working in general.

I’m not sure this is the right place to get Coldfusion help though. Live Lookup just passes in the data via GET or POST whichever you’ve selected.


#3

I fixed this problem and works fine now but just for the records that I limit in my query. How I can pass the values from Live Lookup to limit my query ex. FirstName, LastName , Customer Id. If I enter any of these values I want to get customers that match entered values?


#4

Great! For that you’ll need to get the values from GET or POST (whichever you’ve selected) in Coldfusion and pass them to your query. You’d need to check the Coldfusion docs for that.