I've been working on building an advanced search for a database, but I can't
get it past 2 variables(and arguments). I can't do it as simply as just
searching all fields, I have 8 separate arguments I would like to be able to
use in the search. My current code is as follows:
<cfcomponent displayName="findFlavor">
<cffunction name="FlavorNameSort"
access="remote"
returnType="query"
output="false"
>
<cfargument name="flavorName" type="string" required="false"/>
<cfargument name="wynnStarrNumber" type="string" required="false"/>
<cfargument name="natArt" type="string" required="false"/>
<cfargument name="kosher" type="string" required="false"/>
<cfargument name="gmoFree" type="string" required="false"/>
<cfargument name="phase" type="string" required="false"/>
<cfargument name="application" type="string" required="false"/>
<cfquery name="flavorNameQuery" datasource="frank">
SELECT *
FROM wynn
WHERE flavorName like '%#arguments.flavorName#%'
AND wynnStarrNumber like '%#arguments.wynnStarrNumber#%'
AND natArt like '%#arguments.natArt#%'
AND kosher like '%#arguments.kosher#%'
AND gmoFree like '%#arguments.gmoFree#%'
AND phase like '%#arguments.phase#%'
AND application like '%#arguments.application#%'
ORDER BY flavorName asc
</cfquery>
<cfreturn flavorNameQuery />
</cffunction>
</cfcomponent>
What it's returning now when I debug in flash(I checked, and it IS sending all
the variables correctly), is that it tells me that the function FlavorNameSort
doesn't exist with those arguments. Also I checked out the server, and it's
updating fine, because when I switched it to have only 2 arguments, it works
fine.
HELP HELP HELP Please!!
-Tom
sonoflight - 22 Dec 2004 19:14 GMT
What about showing the AS code? That might help.
Just a few quick stabs. Is flash sending all the vars as strings? Are you
sending the vars as named arguments?
myComp.findFlavor({flavorName:"nameofflavor",wynnStarrNumber:"number",etc});
Tomdogggg - 22 Dec 2004 19:43 GMT
Nah, it's sending everything perfectly, it's just having trouble figuring it
out. Here's the code that works(all i did to change it for the extra arguments
is make more text inputs and make them all params and then it didn't work
anymore but sent everything):
submitButton.onPress = function(){
var params = new Object();
params.wynnStarrNumber = wynnStarrNumberField.text;
params.flavorName = flavorNameField.text;
flavorService.flavorNameSort(params);
}
function flavorNameSort_Result(result)
{
flavorDataGrid.setDataProvider(result);
flavorReturnLocal = "Your search results include " + result.getLength() + "
records.";
}
flavorDataGrid.getProductList();