CFFUNCTION question

I am trying to run a function like:
<cfoutput>#F_name#</cfoutput>
<CFFUNCTION NAME="F_name">
... generates some tables and reports ...
</cffunction>
Instead of the tables, I have a coded string of characters.
Am I missing something here ?
Should the function be in CF component ?
Thanks for help !

If your function generates output, then the below would work.
<cfoutput>#F_name()#</cfoutput>
But I'm guessing you're not generating output and just doing
calculations, you need to return the value using something like
<cffunction name="F_name">
<cfset a = 1>
<cfset b = 2>
<cfreturn a + b>
</cffunction>

Similar Messages

  • How to delete 1st 2 rows in a csv/excel file?

    Hi,
    Is there a way to read a csv file and delete the 1st 2 rows  (or any no. of rows I would like to)?
    I'm currently using Ben Nadel's GREAT piece of code (Parsing CSV Values into a Coldfusion query) found at http://www.bennadel.com/index.cfm?dax=blog:501.view as follows:
    <!--- Read file --->
    <cffile action="read" file="#variables.uploadedFile#" variable="csvResult">
    <!--- Invoke method to convert csv data to query --->
    <cfinvoke component="components.csvToQuery" method="CSVToQuery" returnvariable="qCsvData">
         <cfinvokeargument name="CSV" value="#trim(variables.csvResult)#">
         <cfinvokeargument name="FirstRowIsHeadings" value="true">
    </cfinvoke>
    I need to manipulate qCsvData to delete the 1st 2 rows.
    Any ideas would be most welcome.
    Thanks and regards,
    Yogesh Mahadnac

    Hi Joseph,
    Thanks again for your brilliant answer!
    I still need you help by the way, if you don't mind, of course!
    I've based myself on your logic and tried to implement it differently.
    (apologies if it's a bit complicated. it's almost 1 o'clock in the morning here, and sleep is getting over...)
    Here is what I've done:
    Now, I know that I need to ignore the 1st 2 rows, which means, my headers in fact start on the 3rd row.
    I've created my column names dynamically and then added rows to my query object.
    <cffunction name="removeRecords" returntype="Query" output="false" description="I remove records from a query.">
         <cfargument name="queryObject" type="Query" required="true" hint="Query to remove records from" />
         <!--- Initialise function local variables --->
         <cfset var myQry = QueryNew("")>
         <cfset var i = 0>
         <cfset var j = 0>
         <cfset var columnName = "">
         <cfset var columnList = "">
         <cfset var tempList = arguments.queryObject.columnList>
        <!--- Loop query --->
        <cfloop index="i" from="1" to="#arguments.queryObject.recordcount#">
            <!--- Ignore 1st 2 rows, 3rd row is header --->
            <cfif i gt 2>
                <cfif i eq 3><!--- Create headers --->
                    <!--- Loop column list (column_1, column_10, ...) --->
                    <cfloop index="j" from="1" to="#listLen(tempList)#">
                        <cfset item = ListGetAt(tempList,j)>
                        <!--- Remove blank spaces --->
                        <cfset columnName = replaceNoCase(trim(arguments.queryObject[item][i])," ","_","All")>
                        <!--- Remove slash --->
                        <cfset columnName = replaceNoCase(trim(columnName),"/","_","All")>
                        <!--- Create column name --->
                        <cfset QueryAddColumn(myQry,columnName,"cf_sql_varchar",ArrayNew(1))>
                        <!--- Create list of column names --->
                        <cfset columnList = columnList & columnName & ",">
                    </cfloop>
                    <!--- Remove trailing comma --->
                    <cfset columnList = left(columnList,len(columnList)-1)>
                <cfelse><!--- As from 4th row, we add 1 new row to myQry for each iteration --->
                    <!--- Add rows --->
                    <cfset QueryAddRow(myQry)>
                    <cfloop index="j" from="1" to="#listLen(tempList)#">
                        <cfset item = ListGetAt(tempList,j)>
                        <cfset fieldValue = trim(arguments.queryObject[item][i])>
                        <cfset col = listGetAt(columnList,j)>
                        <cfset QuerySetCell(myQry,col,fieldValue)>
                    </cfloop>
                </cfif>
            </cfif>
        </cfloop>
         <cfreturn myQry>
    </cffunction>
    Question:
    Is there a simpler way to do the following?
    <cfset columnName = replaceNoCase(trim(arguments.queryObject[item][i])," ","_","All")>
    <cfset columnName = replaceNoCase(trim(columnName),"/","_","All")>
    I'm trying to replace all blank spaces and any "/"  between words with an "_".
    I know we can use Regular Expressions to do it much simpler, but I'm not very familiar with the syntax.
    I'd be grateful if you could please provide me with the correct syntax.
    Thanks in advance.
    Best regards,
    Yogesh

  • Cffunction returntype question

    I've got a function (below) in a CFC that executes a stored
    procedure. The procedure has 2 input parameters and a single output
    parameter. I want to cfoutput the value of the output parameter in
    the procedure. The procedure does it's job in CF if I don't return
    the output parameter. I keep having problems with the
    returnvariable type. I've output returntypes of query in the past
    without any problem, but never a single calculated value. The value
    being output by the procedure is a long integer.
    <!--- FUNCTION --->
    <cffunction name="myFunctTest" hint="ProcedureTest"
    returntype="??????">
    <cftry>
    <cfstoredproc procedure="myProc" username='#this.user#'
    password='#this.pass#' datasource='#this.dSource#'>
    <cfprocparam type="Out" cfsqltype="cf_sql_integer"
    variable="OutputID"><!--- Output variable I want to return
    --->
    <cfprocparam type="In" cfsqltype="CF_SQL_INTEGER"
    value='#this.par1#' dbvarname="myPar1">
    <cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR"
    value='#this.par2#'dbvarname="myPar2">
    </cfstoredproc>
    <cfcatch type="any">
    <cfreturn "Error in Function...">
    </cfcatch>
    </cftry>
    <cfreturn ??????>
    </cffunction>
    <!--- FUNCTION CALL --->
    <cfinvoke component="cfc.myCFC" method="myFunctTest"
    returnvariable="??????">
    <cfinvokeargument name="user" value="#myUser#">
    <cfinvokeargument name="pass" value="#MyPass#">
    <cfinvokeargument name="dSource" value="#myDSource#">
    <cfinvokeargument name="par1" value="#Form.MyPar1#">
    <cfinvokeargument name="par2" value="#Form.MyPar2#">
    </cfinvoke>
    Thanks in advance
    Roy.

    Combine,
    Are your stored procedure parameters defined in the same
    order you are using them in your CFSTOREDPROC tag? Bear in mind
    that the dbvarname attribute is ignored in CF6+.

  • Newbie question about component and UDF usage.

    This will be the 1st time I'm coding a component and UDF. I
    kind of understand the concept but not sure about how to write it
    in detail.Such as passing the parameter, etc.
    I'm starting to write a user login, verifying users before
    allowing them to enter into the app.
    So I have 2 fields in my login form, Login and password.
    Upon submitting this form, on the actionpage.cfm I'm calling
    a component. This is how I call the component:
    <CFINVOKE Component="cfc/loginaction"
    Method="AuthentiCateUser" ReturnVariable="UserInfo">
    Then in my Component I have the following:
    <CFCOMPONENT>
    <CFFUNCTION Name="AuthentiCateUser" RETURNTYPE="Query"
    hint="Use for user login">
    <CFARGUMENT Name="login" Type="Structure"
    Required="true">
    <CFARGUMENT Name="password" Type="Structure"
    Required="true">
    <!--- checking user authentication --->
    <CFQUERY NAME="Authenticate" DATASOURCE="sendfast">
    SELECT * FROM tblcustomer WHERE Login = '#Login#' AND
    Password = '#Password#'
    </CFQUERY>
    <CFRETURN AuthentiCateUser>
    </CFFUNCTION>
    </CFCOMPONENT>
    When I run this code, I got error, it said :
    The parameter LOGIN to function AuthentiCateUser is required
    but was not passed in.
    The error occurred in
    C:\CFusionMX\wwwroot\KDt_Mod\userloginaction.cfm: line 18
    16 : <CFSET
    UserLoginInfo["Password"]="#Form.Password#"> 17 : 18 :
    <CFINVOKE Component="cfc/loginaction" Method="AuthentiCateUser"
    ReturnVariable="UserInfo">
    19 :
    My question is:
    What should I do in order to pass #Form.Login# and
    #Form.Password# to my UDF within my component?
    I'm using CFMX 6 and Micrisift SQL 8

    I've applied cfinvokeargument and my login and password were
    passed to my component.
    But I'm facing new problem: Where should I write my
    authentication? should I write user authentication within my
    component or
    loginaction.cfm (the calling template)
    What I mean by authentication is something like this:
    <CFIF #Authenticate.RecordCount# IS NOT 0>
    <cfset session.CustomerID
    ="#Authenticate.customerid#">
    <cfset session.Name ="#Authenticate.Name#">
    <CFCOOKIE NAME="UserLoginIn"
    VALUE="12345_pn#Authenticate.customerid#">
    <cflocation url="index.cfm?loc=home">
    <CFELSE>
    <script language="JavaScript">
    alert("Username/password is not found, plese try again");
    history.go(-1);
    </script>
    <cfabort>
    </CFIF>
    If I keep this code in my loginaction.cfm what is returned
    from my function is not recognized by the component, the error said
    Authenticate.RecordCount is not recognized.
    Also I'm still confuse with what should I put in the
    RETURNTYPE. If I put query, it gave me error, also, what is
    returned by CFRETURN.
    This is my component:
    <CFCOMPONENT>
    <CFFUNCTION Name="AuthentiCateUser" RETURNTYPE="Query"
    hint="Use for user login">
    <CFARGUMENT Name="login" Type="Structure"
    Required="true">
    <CFARGUMENT Name="password" Type="Structure"
    Required="true">
    <!--- checking user authentication --->
    <CFQUERY NAME="Authenticate" DATASOURCE="sendfast">
    SELECT * FROM tblcustomer WHERE Login = '#Login#' AND
    Password = '#Password#'
    </CFQUERY>
    <CFRETURN AuthentiCateUser>
    </CFFUNCTION>
    </CFCOMPONENT>

  • ColdFusion.Ajax.submitForm ResultHandler Question

    I am developing an CF Ajax based solution in which I use
    ColdFusion.Ajax.submitForm to pass form values to a CFC for
    processing via Java Script. My question is related to the Java
    Script resultHandler and whether or not there is an easy way to
    return the results from the CFC to handler.
    My Java Script looks like this...
    function InsertRec() {
    ColdFusion.Ajax.submitForm('MyForm',
    'service.cfc?method=InsertRec', resultInsertHandler,
    resultErrorHandler);
    My CFC looks like this.. (condensed)
    <cffunction name="insertRec" access="remote" output="no"
    returntype="numeric">
    <cfargument name="NAME">
    <cfargument name="Phone">
    <cfquery name="recInsert" datasource="#request.DS#">
    <cfset NEW_NUMBER = updatedNum( )> <-- Getting new #
    from another table via CFC
    INSERT INTO MYTABLE
    (NUMBER, NAME, PHONE)
    Values (' #NEW_NUMBER# ' , ' #ARGUMENTS.NAME# ' , '
    #ARGUMENTS.PHONE# ' )
    </cfquery>
    <cfreturn NEW_NUMBER>
    </cffunction>
    What I'm trying to do is return the value of NEW_NUMBER from
    the CFC back to resultInsertHandler so I can use it in a Java
    Script alert msg. Any ideas or thoughts would be greatly
    appreciated.
    Regards
    Martin Franklin

    MMFranklin wrote:
    > What I'm trying to do is return the value of NEW_NUMBER
    from the CFC back to
    > resultInsertHandler so I can use it in a Java Script
    alert msg. Any ideas or
    > thoughts would be greatly appreciated.
    Something like this I would presume.
    function resultInsertHandler(returnMsg)
    alert(returnMsg);

  • First CFC question

    Ok, I'm working on my first CFC, and having some problems.
    The code I have
    so far is:
    <cfcomponent displayname="duplicate" hint="Duplicates
    local club
    tournaments">
    <!--- This function retrieves all customers from the
    database --->
    <cffunction name="getinfo"
    hint="Gets all tournament info from the database">
    <cfquery name="DuplicateTournamentList"
    datasource="SalleBoise">
    select * from clubtournaments
    where TournID=#session.tid#
    </cfquery>
    <cfset NewEventName=DuplicateTournamentList.TournName>
    <cfset NewEventDesc=DuplicateTournamentList.TournDesc>
    <cfset
    NewDateTime=dateadd("m",2,dateformat(TournDateTime,"mm/dd/yyyy"))>
    <cfset
    NewTournFoil=DuplicateTournamentList.TournFoilEvent>
    <cfset
    NewTournEpee=DuplicateTournamentList.TournEpeeEvent>
    <cfset NewType=DuplicateTournamentList.EventType>
    <cfset
    NewDuplicate=DuplicateTournamentList.TournDuplicated>
    <cfquery name="NewTourn" datasource="SalleBoise">
    insert into clubtournaments
    (TournName,TournDesc,TournFoilEvent,TournEpeeEvent,EventType,TournDateTime,TournDuplicate d)
    values
    (#NewEventName#,#NewEventDesc#,#NewTournFoil#,#NewTournEpee#,#NewType#,#NewDateTime#,#NewD uplicate#)
    </cfquery>
    <cfquery name="UpdateOldTourn" datasource="SalleBoise">
    update clubtournaments
    set TournDuplicated=1
    where TournID=#session.tid#
    </cfquery>
    </cffunction>
    </cfcomponent>
    And I'm calling it with:
    <cfinvoke component="duplicate.cfc" method="getinfo">
    And I'm getting:
    Error Occurred While Processing Request
    Could not find the ColdFusion Component or Interface
    duplicate.cfc.
    Ensure that the name is correct and that the component or
    interface exists.

    The 1 question I have with your code that is different than
    mine is the
    query. Mine, I had hoped would take the info from the
    previous event,
    and add a number of months to it before adding it into the
    table.
    It looks like yours simple duplicates the event without
    changing that
    date, correct?
    Azadi wrote:
    > first, rtfm about <cfinvoke> tag. the component
    attribute needs a
    > dot-delimited path to your cfc, i.e. if your cfc is
    stored in a
    > components folder under web root and your calling
    template is also in
    > the webroot: component="components.duplicate"
    >
    > then, it is not a good practice to access outside
    variables from within
    > the cfc - in your case you are accessing session vars.
    you better pass
    > them in to your cfc as arguments when you invoke it and
    have
    > <cfargument> tags in your function that accept
    them (see code at the bottom)
    >
    > <cfinvoke component="components.duplicate"
    method="getinfo"
    > tid="#session.tid">
    >
    > or
    >
    > <cfinvoke component="components.duplicate"
    method="getinfo">
    > <cfinvokeargument name="tid"
    value="#session.tid#">
    > </cfinvoke>
    >
    > then, variable scoping - always scope any cfc vars with
    var: <cfset var
    > somevar = something>. this will help you avoid
    variables confusion when
    > your calling page has vars with same names.
    >
    > then, even inside cfc, you should always use
    <cfqueryparam> tags in your
    > queries.
    >
    > as for your queries - the 3 of them can be combined
    easily into one.
    >
    > so your function in the end can look something like:
    > [note: query syntax is db-specific; check your db for
    correct syntax to use]
    >
    > <cffunction name="getinfo"
    > hint="Gets all tournament info from the database"
    returntype="boolean"
    > output="no">
    > <cfargument name="tid" required="yes"
    type="numeric">
    > <cfset var DuplicateTournamentList = "">
    > <cfset var result = true>
    > <cftry>
    > <cfquery name="DuplicateTournamentList"
    datasource="SalleBoise">
    > INSERT INTO clubtournaments
    > (TournName, TournDesc, TournFoilEvent, TournEpeeEvent,
    EventType,
    > TournDateTime, TournDuplicated)
    > SELECT TournName, TournDesc, TournFoilEvent,
    TournEpeeEvent, EventType,
    > TournDateTime, 1 AS TournDuplicated
    > FROM clubtournaments
    > WHERE TournID = <cfqueryparam
    cfsqltype="cf_sql_integer"
    > value="#arguments.tid#">
    > </cfquery>
    > <cfcatch type="any">
    > <cfset result = false>
    > </cfcatch>
    > </cftry>
    > <cfreturn result />
    > </cffunction>
    >
    > and your cfinvoke something like the examples above.
    >
    > hth
    >
    >
    > Azadi Saryev
    > Sabai-dee.com
    >
    http://www.sabai-dee.com/

  • Cffunction valitation error

    Hi,
    I have a form where I  fill a customer-no. into an input field and get the customer name using databinding.
    This works fine, but when I put non-numeric values into customer-no I get following error:
    Error invoking CFC customer.cfc : The CUST_ID argument passed to the getcustomer function is not of type numeric. [Enable debugging by adding 'cfdebug' to your URL parameters to see more information]
    The message is correct, but how can I avoid to run the getcustomer function when the value is not numeric?
    Here is my code:
    The form:
    <cfinput type="text" name="customer_no" style="width:140;background-color:yellow" maxlength="10"  validate="integer" validateat="onblur"   message="Customer No. format is integer">
    <cfinput type="text" name="customer_name" style="width:170" maxlength="200" bind="cfc:customer.getcustomer({customer_no})" readonly="yes">
    customer.cfc:
    <cfcomponent >
    <cffunction name="getcustomer" access="remote" returntype="string" output="yes"  >
        <cfargument name="cust_id"   type="numeric"  required="true" >
                     <cfset  r_customer = "">
             <cfquery name = "select_customer" dataSource = "x">
            SELECT name
            FROM customer
            WHERE id =  <cfqueryparam   cfsqltype="cf_sql_numeric" value="#arguments.cust_id#" >
            </cfquery>
    <cfreturn r_customer>
    </cffunction>
    </cfcomponent>

    biene22 wrote:
    The message is correct, but how can I avoid to run the getcustomer function when the value is not numeric?
    That is a trick question! The attribute bind="cfc:customer.getcustomer({customer_no})" implies that the function will run automatically, whether or not customer_no is numeric.

  • Cffunction - Accepting and Returning PDFs in memory

    Hello,
    This is something that I should probably know by now in my CF career, but up until now I have never thought/had to do this type of thing.
    I have defined a couple functions that I would like to handle accepting, manipulating, and returning PDFs in memory. What data types should I be using for accepting and returning the PDF in memory between functions?  I would prefer to stay away from "any" if possible, but let me know if that is the only choice.
    <cffunction name="AddMeUhWaddaMak" returntype="any" access="public" output="no">
            <cfargument name="src" type="any" required="yes">
            <cfargument name="name" type="string" required="no">
                   <cfpdf action="addWatermark"
                            source="#arguments.src#"
                            name="#arguments.name#"
                             ...>
                         <cfreturn arguments.name>
    </cffunction>

    Thanks again for the advice.  I was doing a little tinkering around with isPDFObject() just to see how it works and came to another question. See below..
    <cfdocument format="pdf" name="test2">
    test
    </cfdocument>
    <cfdump var="#isPDFObject(test2)#"><cfabort>
    The result says "NO", even though when I dump out "test2" it shows up as binary.

  • Cffunction returntype

    If I have a cffunction within a cfc that simply does an
    update on the DB should I use returntype="void"?
    How about not even specifying the returntype?
    Thanks!

    Tend to agree here - if you havea requirement for strong
    typing you probably
    shouldn't be using coldfusion. These days, it seems we either
    want to work
    with dynamic languages or more tradiotonal "compiled"
    languages. And the
    choice for dynamic languages is usually made on "the need for
    speed" at
    development time - strong typing would seem to run contrary
    to this idea.
    Btw - even in compiled languages (java, c#) you can still get
    type errors at
    runtime - compliler cannot catch them all unfortunately. (eg;
    cast errors,
    null reference errors)
    "Hal B. Helms" <[email protected]> wrote in
    message
    news:f72sfs$los$[email protected]..
    > The question is one of whether ANY typing should be
    used. The goal of
    > typing
    > variables is "type safety" -- the assurance that no data
    type mismatches
    > can
    > occur. In a strongly-typed language such as Java or C#,
    this happens at
    > compile
    > time and it's very helpful.
    >
    > In a weakly-typed language such as ColdFusion or Ruby,
    the only time
    > type-checking can be done is at run time. This is much,
    much less helpful.
    > My
    > own personal opinion is to omit all typing of variables.
    There's so little
    > to
    > gain and quite a cost involved (beyond the finger
    typing).
    >

  • Javascript inside cffunction

    I have a really stupid question, but I need to use some javascript in a cffunction in a cfc.
    Is this possible?
    I am trying to use google maps geocode to get the latitude and longitude for addresses and it works in a cfm page, but doesn't in the cffunction.
    the below converts the data to json and sends it to a cfc, the cfc then write the data to a file.
    the overall goal is to call the service and get this information back in cfml if all possible. we are using google maps api v3.
    here is my code:
    testget.cfm
    <cfajaxproxy cfc="cfc.mycfc" jsclassname="gs">
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript">
       var geocoder;
           geocoder = new google.maps.Geocoder();
           var address = 'your street, your city, your state, your zipcode';
        geocoder.geocode( {address: address}, function(results, status) {
          if (status == google.maps.GeocoderStatus.OK && results.length) {
         // You should always check that a result was returned, as it is
         // possible to return an empty results object.
         if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
          var e = new gs();
          var jsonObj = ColdFusion.JSON.encode(results[0].geometry.location);
          var json = e.updateLatLng(jsonObj);
    </script>
    mycfc.cfc
    <cffunction name="updateLatLng" access="remote" >
    <cfargument name="latlng" >
    <cfset i = deserializeJSON(latlng) >
    <cfset lat = i.Yd />
    <cfset lng = i.$d />
    <cffile action = "write"
    file = "C:\ColdFusion8\wwwroot\dev.zipoodle.com\jsontest.txt"
    output = "cfclat = #lat# and cfclng = #lng#" >
    </cffunction>

    it actually work as a proof of concept of sending the data to the cfc and writing to a text file.
    <cffunction name="updateLatLng" access="remote">
    <cfargument name="latlng">
    <cfset i = deserializeJSON(latlng)>
    <cfset lat = i.Yd />
    <cfset lng = i.$d />
    <cffile action = "write"
    file = "C:\ColdFusion8\wwwroot\dev.zipoodle.com\jsontest.txt"
    output = "cfclat = #lat# and cfclng = #lng#">
    </cffunction>
    This would actually take my geocode results and create a cf variables of lat and lng.  I thought then I could use these to update the db.
    but I use flex a my application so using the cfm example would only work if I use this in my page and call it from flex. Which is an option, but the problem is getting the data back into flex from the cfc. If I used a cfajaxproxy and set the result handler to come back, then I need a platform to get the results from the cfc back to flex.
    Does the geolocation have to occure after the record is created?  Is it ok to do it before like you where doing in your first post?
    No I would prefer to get this information before creating the record, but I was afraid of the cftransaction waiting on the geocode data to come back...time out... Either way before or after doesn't matter to me, I would prefer before, becuase of a single entry, but I am open for suggestions.

  • 1st UDF and questions

    Ok, I got some code working on a page, and would like to now
    see about
    putting it in a UDF...
    The UDF right now looks like:
    <cffunction name="classSort" output="false">
    <cfargument name="eventType" type="string"
    required="yes">
    <cfset temp_var=1>
    <cfloop list="arguments.eventType" delimiters=","
    index="i">
    <cfset full_var_temp_var=#i#>
    <cfset temp_var=temp_var+1>
    </cfloop>
    <cfswitch expression="full_var_1">
    <cfcase value="f">
    <cfif var_temp_2 gte 15>
    <cfif rates.C gte 2>
    <cfif rates.B gte 2 or rates.D gte 2>
    <cfif rates.A gte 2 and rates.B gte 2>
    <img src="images/A1.gif" width="94" height="29">
    <cfelseif rates.D gte 2 and rates.E gte 2>
    <img src="images/C1.gif" width="94" height="29">
    <cfelse>
    <img src="images/B1.gif" width="94" height="29">
    </cfif>
    </cfif>
    </cfif>
    </cfif>
    </cfcase>
    </cfswitch>
    </cffunction>
    And I'd be passing arguments in the form of functin(f,30)
    What I'm trying to do is get the image filename sent back so
    I can display
    it on the page.
    Am I on the right track here???

    Well, I changed the function to:
    <cffunction name="classSort" output="false">
    <cfargument name="eventType" type="string"
    required="yes">
    <cfif eventType gte 15>
    <cfif rates.C gte 2>
    <cfif rates.B gte 2 or rates.D gte 2>
    <cfif rates.A gte 2 and rates.B gte 2>
    <cfset retImage="images/A1.gif">
    <img src="images/A1.gif" width="94" height="29">
    <cfelseif rates.D gte 2 and rates.E gte 2>
    <img src="images/C1.gif" width="94" height="29">
    <cfelse>
    <img src="images/B1.gif" width="94" height="29">
    </cfif>
    </cfif>
    </cfif>
    </cfif>
    <cfreturn retImage>
    </cffunction>
    Now my question is, in the code that's calling the function,
    the image isn't
    displaying..... I tried <img
    src="#classSort(foilCount.recordcount)#">
    Is that not correct?
    "Ian Skinner" <[email protected]> wrote in message
    news:[email protected]...
    > Steve Grosz wrote:
    >> Ok, I got some code working on a page, and would
    like to now see about
    >> putting it in a UDF...
    >>
    >> The UDF right now looks like:
    >>
    >> <cffunction name="classSort" output="false">
    >> <cfargument name="eventType" type="string"
    required="yes">
    >>
    >> <cfset temp_var=1>
    >> <cfloop list="arguments.eventType" delimiters=","
    index="i">
    >> <cfset full_var_temp_var=#i#>
    >> <cfset temp_var=temp_var+1>
    >> </cfloop>
    >>
    >> <cfswitch expression="full_var_1">
    >> <cfcase value="f">
    >> <cfif var_temp_2 gte 15>
    >> <cfif rates.C gte 2>
    >> <cfif rates.B gte 2 or rates.D gte 2>
    >> <cfif rates.A gte 2 and rates.B gte 2>
    >> <img src="images/A1.gif" width="94"
    height="29">
    >> <cfelseif rates.D gte 2 and rates.E gte 2>
    >> <img src="images/C1.gif" width="94"
    height="29">
    >> <cfelse>
    >> <img src="images/B1.gif" width="94"
    height="29">
    >> </cfif>
    >> </cfif>
    >> </cfif>
    >> </cfif>
    >> </cfcase>
    >> </cfswitch>
    >>
    >> </cffunction>
    >>
    >> And I'd be passing arguments in the form of
    functin(f,30)
    >>
    >> What I'm trying to do is get the image filename sent
    back so I can
    >> display it on the page.
    >>
    >> Am I on the right track here???
    >
    > Wow that is some obtuse logic there. I'm going to go
    with that you know
    > why you are doing all that looping at the beginning.
    >
    > The first thing I'm seeing is an incompatibility with
    output="false" and
    > <cfif...>...<img ...> logic.
    >
    > This code is attempting to output <img...> tags
    but that is disallowed in
    > the <cffunction...> tag. You either need to allow
    output - which would
    > also include all the white space in the function if
    steps are not taken to
    > control it. Or save the <img....> tag code into a
    string variable and
    > then return that variable at the end of the function
    with a <cfreturn ...>
    > tag.
    >
    >

  • Simple CFC question

    So I can finally get around to learning proper usage of
    cffunctions and CFCs, I'm working on a quick test app to get the
    basics down. My question has to do with return types.
    For example, I have a function called "updateUser". A form
    passes the usual info along with a userID into the function.
    If the update is successful, I want to display a message "You
    have updated the user."
    I'm getting hung up on the return types - specifically the
    use of a boolean return. Assuming if the update goes ok, the
    boolean return would be true. How can I test for this back on the
    update page?
    If return type is true - display success message
    else if it's false - display an error message
    I guess I could put some additional cfreturns in the function
    and return a message string, but this just doesn't seem right?

    To expand a bit on what Simon mentioned, here's how you might
    structure the CFC Method/Function to return a boolean:
    <cffunction name="updateUser" access="public"
    returntype="boolean">
    <cfargument name="userId" type="numeric"
    required="true"/>
    <cfargument name="username" type="string"
    required="true"/>
    <cfargument name="email" type="string"
    required="true"/>
    <cfset updateOk = true />
    <cftry>
    <cfquery datasource="dsn" name="qryUpdateUser">
    update user set username='#arguments.username#' where userId
    = #arguments.userId#
    </cfquery>
    <cfcatch type="database">
    <cfset updateOk = false />
    </cfcatch>
    </cftry>
    <cfreturn updateOk/>
    </cffunction>
    If the query above runs without an error, the value of
    updateOk remains true. If there is an error in the DB, the CFCATCH
    block will be run, setting the value of updateOk to false.
    At the end of the function, the value of updateOk is returned
    to the calling page/code block.
    Then, with the code Simon provided, you can use this in your
    calling page:
    <cfif updateUser(userID, name,. email)>
    Success
    <cfelse>
    Failure
    </cfif>
    Wasn't sure if you were just having trouble on the calling
    page (where you want to output the success/failure message or with
    how to return the boolean value from the function as well. Hope
    this helps.

  • Questions on Print Quote report

    Hi,
    I'm fairly new to Oracle Quoting and trying to get familiar with it. I have a few questions and would appreciate if anyone answers them
    1) We have a requirement to customize the Print Quote report. I searched these forums and found that this report can be defined either as a XML Publisher report or an Oracle Reports report depending on a profile option. Can you please let me know what the name of the profile option is?
    2) When I select the 'Print Quote' option from the Actions drop down in the quoting page and click Submit I get the report printed and see the following URL in my browser.
    http://<host>:<port>/dev60cgi/rwcgi60?PROJ03_APPS+report=/proj3/app/appltop/aso/11.5.0/reports/US/ASOPQTEL.rdf+DESTYPE=CACHE+P_TCK_ID=23731428+P_EXECUTABLE=N+P_SHOW_CHARGES=N+P_SHOW_CATG_TOT=N+P_SHOW_PRICE_ADJ=Y+P_SESSION_ID=c-RAuP8LOvdnv30grRzKqUQs:S+P_SHOW_HDR_ATTACH=N+P_SHOW_LINE_ATTACH=N+P_SHOW_HDR_SALESUPP=N+P_SHOW_LN_SALESUPP=N+TOLERANCE=0+DESFORMAT=RTF+DESNAME=Quote.rtf
    Does it mean that the profile in our case is set to call the rdf since it has reference to ASOPQTEL.rdf in the above url?
    3) When you click on submit button do we have something like this in the jsp code: On click call ASOPQTEL.rdf. Is the report called using a concurrent program? I want to know how the report is getting invoked?
    4) If we want to customize the jsp pages can you please let me know the steps involved in making the customizations and testing them.
    Thanks and Appreciate your patience
    -PC

    1) We have a requirement to customize the Print Quote report. I searched these forums and found that this report can be defined either as a XML Publisher report or an Oracle Reports report depending on a profile option. Can you please let me know what the name of the profile option is?
    I think I posted it in one of the threads2) When I select the 'Print Quote' option from the Actions drop down in the quoting page and click Submit I get the report printed and see the following URL in my browser.
    http://<host>:<port>/dev60cgi/rwcgi60?PROJ03_APPS+report=/proj3/app/appltop/aso/11.5.0/reports/US/ASOPQTEL.rdf+DESTYPE=CACHE+P_TCK_ID=23731428+P_EXECUTABLE=N+P_SHOW_CHARGES=N+P_SHOW_CATG_TOT=N+P_SHOW_PRICE_ADJ=Y+P_SESSION_ID=c-RAuP8LOvdnv30grRzKqUQs:S+P_SHOW_HDR_ATTACH=N+P_SHOW_LINE_ATTACH=N+P_SHOW_HDR_SALESUPP=N+P_SHOW_LN_SALESUPP=N+TOLERANCE=0+DESFORMAT=RTF+DESNAME=Quote.rtf
    Does it mean that the profile in our case is set to call the rdf since it has reference to ASOPQTEL.rdf in the above url?
    Yes, your understanding is correct.3) When you click on submit button do we have something like this in the jsp code: On click call ASOPQTEL.rdf. Is the report called using a concurrent program? I want to know how the report is getting invoked?
    No, there is no conc program getting called, you can directly call a report in a browser window, Oracle reports server will execute the report and send the HTTP response to the browser.4) If we want to customize the jsp pages can you please let me know the steps involved in making the customizations and testing them.
    This is detailed in many threads.Thanks
    Tapash

  • Satellite P300D-10v - Question about warranty

    HI EVERYBODY
    I have these overheating problems with my laptop Satellite P300D-10v.
    I did everything I could do to fix it without any success..
    I get the latest update of the bios from Toshiba. I cleaned my lap with compressed air first and then disassembled it all and cleaned it better.(it was really clean insight though...)
    BUT unfortunately the problem still exists...
    So i made a research on the internet and I found out that most of Toshiba owners have the same exactly problem with their laptop.
    Well i guess this is a Toshiba bug for many years now.
    Its a really nice lap, cool sound (the best in laptop ever) BUT......
    So I wanted to make a question. As i am still under warranty, can i return this laptop and get my money back or change it with a different one????
    If any body knows PLS let me know.
    chears
    Thanks in advance

    Hi
    I have already found you other threads.
    Regarding the warranty question;
    If there is something wrong with the hardware then the ASP in your country should be able to help you.
    The warranty should cover every reparation or replacement.
    But I read that you have disasembled the laptop at your own hand... hmmm if you have disasembled the notebook then your warrany is not valid anymore :(
    I think this should be clear for you that you can lose the warrany if you disasemble the laptop!
    By the way: you have to speak with the notebook dealer where you have purchased this notebook if you want to return the notebook
    The Toshiba ASP can repair and fix the notebook but you will not get money from ASP.
    Greets

  • Question regarding NULL and forms

    Hi all, i have a survey that im working on that will be sent via email.
    I'm having an issue though. if i have a multiple choice question, and the user only selects one of the choices, all the unselected choices return as NULL. is there a way i can filter out anytihng that says "NULL" so it only shows the selected options?
    thanks.
    here is the page that retrieves all the data. thanks
    <body>
    <p>1) Is this your first visit to xxxxxxx? <b><%=request.getParameter("stepone") %></b>
    </p>
    <p> </p>
    <p>2) How did You Learn About xxxxxxx?</p>
    <p><b><%=request.getParameter("steptwoOne") %></b>
      <br>
        <b><%=request.getParameter("steptwoTwo") %></b>
      <br>
        <b><%=request.getParameter("steptwoThree") %></b>
      <br>
        <b><%=request.getParameter("steptwoFour") %></b>
      <br>
        <b><%=request.getParameter("steptwoOther") %></b>
    </p>
    <p> </p>
    <p>3) What was your main reason for visiting xxxxx?</p>
    <p><b><%=request.getParameter("stepthreeOne") %></b>
        <br>
          <b><%=request.getParameter("stepthreeTwo") %></b>
        <br>
          <b><%=request.getParameter("stepthreeThree") %></b>
        <br>
          <b><%=request.getParameter("stepthreeFour") %></b>
        <br>
          <b><%=request.getParameter("stepthreeOther") %></b>
    </p>
    <p>4) did you find the information you were looking for on this site?</p>
    <p><b><%=request.getParameter("stepfour") %>
    <br>
    <b><%=request.getParameter("stepfourOther") %></b>
    </b></p>
    <p>5) Do you plan on using this website in the future?</p>
    <p><b><%=request.getParameter("stepfive") %></b></p>
    <p>6) What is your gender</p>
    <p><b><%=request.getParameter("stepsix") %></b></p>
    <p>7) What is your age group</p>
    <p><b><%=request.getParameter("stepseven") %></b></p>
    8) Would you like to take a moment and tell us how we can improve your experience on xxxxxxxxxx?
    <p><b><%=request.getParameter("stepeightFeedback") %></b></p>

    i was messing around and came up with this. it doesnt remove the null, but if it is null it adds ABC beside it. so i think i might be getting close. i just need to figure out how to replace the null.
    code]
    <b><%=request.getParameter("steptwoFour") %></b>
         <% if (request.getParameter("steptwoFour") == null ) {
         %>
         <% out.print("abc"); %>
         <% }
         %>

Maybe you are looking for

  • Error: Configuration file /model/common/bc4j.xcfg is not found in the classpath???

    Hi Everyone, My Jdev version is 11.1.2.3.0. I have developed one ADF application and was working very fine. But the Jdev got crashed so i re-installed the same version but the application which was running earlier is not working now. I tried by insta

  • RAID 1 Question

    I recently set up my system in a RAID 1 configuration (striping) and have a question: At start up I am able to invoke the NVIDIA RAID utility. My array has a "N/A" in the bootable column. Never the less, I am able to boot the system. From what I have

  • J2SE Adapter Engine

    Hello Everyone, I've got a little problem. I must cover the requirement that a file adapter exactly runs each night at 2 a.m. But the "polling mechanism" only allows to say that the adapter runs each 24 hours. Any suggestions how to solve this proble

  • 40 minutes into listening, itunes deletes my current podcast with no way to recover it.

    3 times now I've been listening to a free podcast I am subscribed to and roughly 3/4 of the way through the podcast it just disappears.  The sound abruptly stops and the current podcast I'm listening to is gone.  Deleted.  No idea how or why.  This i

  • Deliver through projects

    Dear All Our client is in project system. we are doing partial delivery of the material from project throgh T-code CNS0. as a SD module I have to enter price, taxes & excise duties for that material manually in VL02N. when I am doing billing for that