Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

cf8 cfinput spry autosuggest - error invoking cfc

Posted on 2007-10-17
8
Medium Priority
?
975 Views
Last Modified: 2008-01-30
This code works;

<cfinput name="sfCname#counter#" id="sfCname#counter#" size="40" autosuggest="cfc:400comps.tsijobads.getCompanies({cfautosuggestvalue})" maxResultsDisplay="50">

<cffunction name="getCompanies" access="remote" returntype="string">
<cfargument name="term" type="any" required="false" default="">
<cfset var CnameQry = "">
<cfquery name="CnameQry" datasource="AS400" dbtype="ODBC" maxrows="50">
SELECT rtrim(ltrim(csnam1)) as cname, rtrim(ltrim(csstat)) as state, rtrim(ltrim(cscity)) as city, csrec## as companyid
FROM cstatic
WHERE UPPER(csnam1) LIKE <cfqueryparam cfsqltype="cf_sql_varchar" value="#ucase(left(arguments.term,255))#%">
order by csnam1,cscity
</cfquery>
<cfreturn ValueList(CnameQry.cname)>
</cffunction>

---------------------------------------------------------------------------------------------------
This code does not;

<cfinput type="text" name="sfiname#counter#" id="sfiname#counter#" autosuggest="cfc:400comps.tsijobads.getIndividualsH({cfautosuggestvalue})" maxResultsDisplay="50">

<cffunction name="getIndividualsH" access="remote" returntype="string">
<cfargument name="term" type="any" required="false" default="">
<cfset var IndivQry = "">
<cfquery name="IndivQry" datasource="AS400" dbtype="ODBC" maxrows="50">
SELECT rtrim(ltrim(isfnam)) as FNAME, rtrim(ltrim(islnam)) as LNAME, rtrim(ltrim(istitl)) as ITITLE, iswfon as WPHONE, isrec## as RECNUM
FROM istatic
WHERE UPPER(islnam) LIKE <cfqueryparam cfsqltype="cf_sql_varchar" value="#ucase(left(arguments.term,255))#%">
ORDER by islnam,isfnam
</cfquery>
<cfreturn ValueList(IndivQry.isfnam)>
</cffunction>

----------------------------------------------------------------------------------------------------
I don't think the mapped folder is the problem. I solved part of the problem by changing the function output type to "string" and returning a list. Some of the examples and cfml ref are just plain wrong. Hard to believe, huh.

I just noticed that I have a type of "text" on one cfinput and not the other. I just tested it without "text" and it didn't make a difference.

0
Comment
Question by:larksys
  • 3
  • 3
7 Comments
 
LVL 9

Expert Comment

by:73Spyder
ID: 20100450
Nothing jumps right out,  have you been able to run the 2nd query on the DB server itself without any errors?
0
 
LVL 1

Author Comment

by:larksys
ID: 20103349
I tried using the following code but get a "file in use" error. That may have something to do with the original error.


<cfform id="f1form" name="f1form" action="jbrectest.cfm" method="post">
<cfset f1="">
<cfinput id="f1" name="f1" type="text">
  <cfquery name="IndivQry" datasource="AS400" dbtype="ODBC" maxrows="5">
             SELECT rtrim(ltrim(isfnam)) as FNAME, rtrim(ltrim(islnam)) as LNAME, rtrim(ltrim(istitl)) as ITITLE, iswfon as WPHONE, isrec## as RECNUM
             FROM istatic
                WHERE UPPER(islnam) LIKE '#ucase(f1)#%'
         ORDER by islnam,isfnam
         FOR READ ONLY                  
      </cfquery>
   
<cfoutput query="IndivQry">
#IndivQry.isfnam# &nbsp; #IndivQry.isfnam# <br />
</cfoutput>    
</cfform>
</html>
0
 
LVL 9

Expert Comment

by:73Spyder
ID: 20103692
I've used an AS400 before but this line "       FOR READ ONLY       "  is prolly giving you the "file in use " error.


Try it without that.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 9

Expert Comment

by:73Spyder
ID: 20103853
Correction:

I've never used an AS400 before.

0
 
LVL 1

Author Comment

by:larksys
ID: 20103998
With out the "For Read Only" I get the error. That's why I put it in. I was also getting "variable F1 not defined" before I put in the cfset. The orginal Spry Framework code still works on that table ISTATIC. I can import from ISTATIC into Excel.
0
 
LVL 1

Accepted Solution

by:
larksys earned 0 total points
ID: 20104213
The following code works;

<cfform id="f1form" name="f1form" action="jbrectest.cfm" method="post">
<cfparam name="f1" default="ADAMS">
<cfinput id="f1" name="f1" type="text">
  <cfquery name="IndivQry" datasource="AS400" dbtype="ODBC" maxrows="5">
             SELECT *
             FROM istatic
                WHERE UPPER(islnam) LIKE '#ucase(f1)#%'
         ORDER by islnam,isfnam                  
      </cfquery>
<br />    
<cfoutput query="IndivQry">
#IndivQry.isfnam# &nbsp; #IndivQry.islnam# <br />
</cfoutput>    
</cfform>
0
 
LVL 1

Expert Comment

by:Vee_Mod
ID: 20780667
Closed, 500 points refunded.
Vee_Mod
Community Support Moderator
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question