CFCs setting variables

I am getting a bit confused with cfcs using cfreturn and
cfinvoke please be patient!
1.Setting variables in cfc
In this example cfc I make a query. The cfreturn tag does
<cfreturn expression /> as I understand it. I don´t
understand how you define the expression - can you return
arguments, any column I like in variables? How do I do that?
<cfcomponent><cffunction><cfargument
name="user">
<cfquery name="checkuser">
select col1, col2, col3, col4, col5, col6
from user
where .....=....
</cfquery>
<cfreturn checkuser.col1>
2. Calling cfc:
In cfinvoke you call a variable using returnvariable="". Is
it true that the variable doesn´t have to have the same name
as in the method that the cfinvoke tag is calling? What does return
variable call? How do I define what it calls?

In any cffunction, inside or outside a cfc, if you are going
to return a value, you use the cfreturn tag. You can return
constants like true, 1, "Dan is so smart", or variables. What you
return has to be consistent with the returntype attribute of your
cffunction tag.
When you invoke a variable, you can use any name you want as
the return variable. In theory, you don't even know any variable
names inside the function. The return variable does not call
anything. It accepts what the function returns.
It is the cfinvoke tag that calls something. You control what
it calls with it's attributes.
Further details are in the cfml reference manual.

Similar Messages

  • Application.cfc site variables

    I switched over to using application.cfc not too long ago. One thing I have struggled with is how to set variables that I use on individual pages of my site like I used to do in application.cfm. I have some passowrds for sftp services etc that I used to set in application.cfm. I have not been able to figure out how to make them work with application.cfc so I can call them where I need to.
    I have tried setting them in onrequeststart, onapplicationstart etc. but nothing seems to work. The variables are never defined.
    Does anyone have a working example of how to set variables that can be used on your site globally?
    Is there a better way to store account passwords and variables like that that I am missing?

    For security reasons, I would try to avoid embedding the password anywhere in your ColdFusion code.  You might put it in a "config" file outside of the webroot, then use ColdFusion to read it into an appropriately scoped variable.  Assuming you don't <cfdump> or WriteDump() your variable scopes anywhere in your production code, and that you don't have "Enable Request Debugging Output" enabled on your production server, you could store the password in either the Application scope or a local page's variables scope.  If there is only one page that will do FTP communication, then loading the password into a variable on that page would be fine.  If you modularize the FTP stuff so it can be reused elsewhere in your application, then put the password in a variable in the application scope.
    Since you'll need to pass an the password to the FTP connection, you can't hash it for added security, which is the best way to handle passwords.  But you can encrypt/de-encrypt it using various functions within ColdFusion.  I'd consider at least storing it in an encrypted form in the "config" file.  While being no where near perfect security, it is better than storing the password in plain text in a file.
    -Carl V.

  • Using Spry Data Set Variable in Recordset

    I have a page that contains a spry data set and a recordset. The recordset uses one of the variables from the spry data set to filter its results. how do I apply the spry data set variable to the recordset?

    I believe passing this the variable through the URL requires you to update the page, right?
    Yes
    Is there anyway to grab the spry data set variable direct and apply it to your recordset filter?
    The SpryDataSet variable can only be used on the clientside (JavaScript) so you will have to get your recordset using JS.
    A page refresh can be set in motion if you add {useCache: false, loadInterval: 500} to your dataset to then set an observer to your dataset to invoke the page refreash function.
    Gramps

  • OBIEE 10g - Can I use logical SQL to set variable?

    I am trying to set value of a session variable in the Advanced tab Prefix box of a request.
    Assigment of absolute value like this is working good:
    SET VARIABLE MYVAR=1;
    Can I set the variable using logical SQL? Something like:
    SET VARIABLE MYVAR = (SELECT table1.col1 from catname where table1.col2=1)
    Thanks in advance.

    Hi,
    You can create a session variable or dynamic variable in the RPD and try using it in here at the Advanced Tab prefix.
    But still check yourself if you need multiple values returning in the SQL statement.
    Hope this is helpful/ useful.
    Regards
    MuRam

  • Need help with Different approaches to setting variables in a Flash movie in Adobe Flash CS3 Professional Version

    Hi,
    I'm using Adobe Flash CS3 Professional version of Flash
    software,
    I need help and guidance on
    Different approaches to setting variables in a Flash movie,
    what I should do in the fla file, and in the html file.
    Thanks, Gil

    Hi petro_jemes,
    Just a little claritification, you need to add the value to the variable "[string]$ou", and also change the language in the variable "$emailbody" in the function "Get-ADUserPasswordExpirationDate".
    I hope this helps.

  • ODI-SET VARIABLE IN PACKAGE

    HI.
    I am using odi11g.
    i set variable "STARTTIME" To sysdate .
    And "END_DATE" to a default value-- '20-JUNE-1981'.
    Now in package i dropped the variable "end_date",and put the TYPE to "SET VARIABLE" and the value as below:
    #VARIABLES_STARTTIME.[ The projects name is VARIABLES]
    But the value of "end-date" isnt getting reset to STARTTIME.
    should there be a different syntax.

    HI,
    Refresing the variable is working thanks.BUT i was trying to use the variable in a loop.
    Where when the package is run fo rthe 1'st time the variable 'LAST_UPDATE' value should be '20-JUNE-1981' and then it should get set to the value present in 'STARTTIME" for the next time the package is run.
    So, in this case, i need to set the value of the variable in the package itself.
    #VARIABLES.STARTTIME isnt getting set.
    i tried the package as per the below link:[ i use odi1g though]
    http://blogs.oracle.com/dataintegration/entry/using_variables_in_odi_the_tim

  • How to set variables values via VBA.

    Anybody please help.
    How to set variables values via VBA in workbook. SAP Netweaver 2004s.

    Pass variable values with VBA and BI 7.0 funtions to Query
    At first a remark u2013 Iu2019ve read a lot of threads saying that passing values to a query can be done by using VBA code only. Iu2019ve tested it but Iu2019m not sufficient with the new BEX 7.0 API and therefore I use a mixture of BEX 7.0 funtionality and VBA. I create a BEX 7.0 design item button passing the values to a query u2013 I hide this button somewhere on the sheet or on a hidden sheet and I then raise the event to click the button from VBA code. Works fine and the maintenance is easier if something changes in the API in the future again.
    How to start:
    Switch to design mode in BEX Analyzer:
    Implement a BEX 7.0 design item u201Cbuttonu201D
    Click on the button to implement the properties
    Make the input for the commands
    data_provider = dataprovider_1
    cmd = process_variables
    subcmd = var_submit
    No comes the part with the variables u2013 Letu2019s assume a query has 4 variables but you only want to change 1 with the button u2013 an organizational unit for instance.
    Make a range somewhere in the excel with the following structure:
    Name    Index   Value
    VAR_NAME_1      1       Variablename
    VAR_VALUE_EXT_1 1       variablevalue
    Value should contain the name of your variable of course and u201Cvalueu201D the value of your variable
    Set a name for this range with EXCEL functionality but without the header:
    Back to the properties of the button: Insert the name of the range with the variables in the field Command Range:
    If you have more variables to process you can of course enhance your Filterrange!
    In the left upper Corner you have a name for your button:
    Now you can raise the button-click in vba like this:
    Application.Run "'" & ThisWorkbook.Name & "'!Sheet2.BUTTON_35_Click"
    regards, Lars

  • Calling functions / setting variables in loaded SWF

    You know how you can create a Movieclip object, add a
    function or variable to it, then call that function or change that
    variable from within the SWF that includes it? I wanna be able to
    do that, only with SWFs that are loaded at run time.
    My "main" SWF is simply a menu-type thing. The user clicks a
    button in my MAIN.SWF, and the MAIN.SWF then loads the SWF that's
    associated with that button, using the AS 3.0 prescribed
    Loader()-URLRequest()-addChild() method that everyone always asks
    about.
    This works great. But now I've got some custom objects and
    such (ie., not just strings) within my MAIN.SWF that I'd like to be
    able to share with the loaded SWFs. Preferably, I'd like to use an
    accessor-type function (ie.,
    LoadedSWF.GiveMeTheCoolObject(MyCoolObject);), though at this point
    I'm willing to hack into the object itself (ie.,
    LoadedSWF.CoolObject.CoolField = MyCoolObject.CoolField;) if that's
    what it takes.
    I've tried just calling the functions and setting the fields,
    but the AS 3.0 compiler doesn't care for that sort of nonsense on
    it's generically-defined objects. Notice also that, at run time, a
    call to LoadedSWF.hasOwnObject("GiveMeTheCoolObject") returns true.
    So my big-brained colleagues, what's the magic?
    In advance, thanks for the help!
    Scott

    Kglad,
    quote:
    Originally posted by:
    kglad
    from that error message it appears your function is expecting
    a member of the MyCoolObject class, correct?
    and MyCoolObject is not an instance of that class. so, you
    need to fix that. ie, create a member of that class and use that
    class member as the function parameter.
    Heh, that's what the error message says all right. But the
    object actually IS a MyCoolObject class object. I stared at this
    thing for hours, and MyCoolObject IS an instance of that class. I
    tried various casting combinations (including casting it to an
    Object and passing that) but had no luck whatsoever.
    So I googled this particular runtime error message ("Error
    #1034: Type Coercion failed: cannot convert ") and found a ton of
    links to other people having a similar issue. Typically, the
    problem was just as you said, someone passing a button as a string,
    that kinda thing. But one guy had a problem with an object he
    derived from the Event class. After hours spent trying to get it to
    work, he tried overriding the base class' clone() method and got it
    to work:
    http://www.asserttrue.com/articles/2006/10/14/custom-events-in-actionscript-3-0
    As for my project, I took a long hard look at the overall
    architecture of my project and decided that it was best if all the
    "real work" took place in the MAIN.SWF file. This approach would
    solve a couple of other problems, and it just makes sense in a
    "separate the display from the data" mentality.
    So (and this is the interesting part) I changed the API for
    the LOADED.SWF to accept String pairs (ie.,
    LoadedSWF.AddToDisplay(Name:String, Data:String) ) instead of
    accepting MyCoolObj. Ran it, and Viola, now we're working without
    any run time exceptions. After that glorious moment, I created a
    couple of other APIs that just accepted base classes (one an int
    type, the other a function type) and was happily on my way.
    From this, I gather that passing non-base class (ie, derived
    class) objects to loaded MovieClips via custom function APIs is...
    maybe not as straightforward as we'd expect. In the grand scheme of
    things though, not a big deal: As far as I'm concerned AS3 rocks.
    Again Kglad, thanks for all the help: Your input on how to do
    this was the big push that I needed to get over the last technical
    hurdle of this project.
    To those who are reading this topic for the "how do I call
    functions and/or set variables in a loaded SWF?"
    The short answer is to cast the loaded SWF's content object
    as a MovieClip and then call the function or alter the variable:
    //Load the SWF (you've seen this code a million times)
    var LoadedSWFObj:Loader = new Loader();
    var MyURL:URLRequest = new URLRequest("LoadThisSWF.SWF");
    LoadedSWFObj.load(MyURL);
    //This is within your Event.COMPLETE handler:
    //Cast it as a MovieClip object and work with that.
    var LoadedSWF:MovieClip = LoadedSWFObj.content as MovieClip;
    // or another way to cast it is:
    var LoadedSWF:MovieClip = MovieClip(LoadedSWFObj.content);
    //Call yer function:
    LoadedSWF.CallMe();

  • Set Variable column in the Column page?

    Hi,
    I try to do this exercise but I facing some understanding problem, please guide me.
    This is BIEE example to do Oracle BI publisher and Dashboard.
    1. Create a dashboard prompt for the region and state to filter the BI publisher report results on the dashboard.
    a. In Answers, open Region and State Prompt.
    b. In the Set Variable column, select None from the drop-down list
    c. Save the prompt in the My Sales folder as Region and state Prompt – No Variable.
    My question from step a and b, I did not see any “Region and State Prompt” in Answers. Then clik Subject Areas – SupplierSales, then assign Region, and State. Then I try to make Set Variable column None. But I did not see where is Set Variable column in the Column page. May be I am doing wrong.
    Please guide me to complete this.
    Thanks,
    Jo.

    BindingContext bindingctx = BindingContext.getCurrent();
    BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
    DCBindingContainer bindingsImpl = (DCBindingContainer)bindings;
    DCIteratorBinding dciter = bindingsImpl.findIteratorBinding("prv_supvo1Iterator");
    ViewObject vo = dciter.getViewObject();
    vo.setNamedWhereClauseParam("BDIVN", divn);
    vo.executeQuery();
    where BDIVN is our bind variable.

  • Saving SET VARIABLE LOGLEVEL=2,DISABLE_CACHE_HIT=1; in a report

    Hi Experts,
    The scenario is:
    When I open a report and set the prefix to 'SET VARIABLE LOGLEVEL=2,DISABLE_CACHE_HIT=1;' then I save it. Then I close that specific report then open that report again. The 'SET VARIABLE LOGLEVEL=2,DISABLE_CACHE_HIT=1;' is not saved in the report in the prefix section in Advanced tab.
    Is there a way to save the SET VARIABLE LOGLEVEL=2,DISABLE_CACHE_HIT=1; in a report to get the Query log?
    Thanks,

    OBIEE/BIP Forumer wrote:
    Hi A.Y,
    Thanks for your answer, but I the Variable I set in the Prefix section is not saved even if I saved the report with the Variable.
    Below is the steps I do:
    1. I open Report XYZ
    2. Click to Advanced tab then I enter 'SET VARIABLE LOGLEVEL=2,DISABLE_CACHE_HIT=1;' or ' SET VARIABLE DISABLE_CACHE_HIT=1, LOGLEVEL=2;' in the prefix section
    3. I saved the report
    4. Open Report ABC then
    5. I re-open again Report XYZ hoping that my prefix variable is saved
    6. I go to the ADvancec tab for Report XYZ, but I didnt see the variable I just saved
    Thanks,That is strange. Can you try adding the code to the XML instead of adding it to the prefix section and click on SET XML and save the report?
    I have highlighted the line of code in bold.
    <saw:report xmlns:saw="com.siebel.analytics.web/report/v1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlVersion="200705140" cacheControl="bypassCache">
    <saw:criteria subjectArea="&quot;Financials - GL Budget and Expenses&quot;">
    <saw:columns>
    <saw:column formula="Ledger.&quot;Ledger Name&quot;" columnID="c0"/></saw:columns>
    <saw:columnOrder/>
    *<saw:prefix>SET VARIABLE DISABLE_CACHE_HIT=1, LOGLEVEL=2; </saw:prefix>*
         </saw:criteria>
    <saw:views xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" currentView="0">
    <saw:view xsi:type="saw:compoundView" name="compoundView!1" rptViewVers="200510010">
    <saw:cvTable>
    <saw:cvRow>
    <saw:cvCell viewName="titleView!1">
    <saw:displayFormat/></saw:cvCell></saw:cvRow>
    <saw:cvRow>
    <saw:cvCell viewName="tableView!1">
    <saw:displayFormat/></saw:cvCell></saw:cvRow></saw:cvTable></saw:view>
    <saw:view xsi:type="saw:titleView" name="titleView!1" rptViewVers="200510010"/>
    <saw:view xsi:type="saw:tableView" name="tableView!1" rptViewVers="200510010"/></saw:views></saw:report>

  • How to call a set variable?

    Greetings,
    I am creating an apple script that runs a netstat command to grab an IP address. This works.
    The "Set Value of Variable" (called XX) shows the IP address that netstat runs.
    The next apple script activates "Terminal" just fine.
    Within Terminal, I want to tell it to "telnet" to the IP address from the Set Variable and this is where I am stuck. How do I tell it what "XX" is?
    Thanks,

    If it is the only input item in the input (previous actions can contribute to the input), your statement would be something like:
    set DG to item 1 of the input
    If you are only using the variable in your second AppleScript action, you can also just combine them:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #FFEE80;
    overflow: auto;"
    title="this text can be pasted into an Automator 'Run AppleScript' action">
    on run {input, parameters}
    set DG to (do shell script "netstat -nr | grep -w 'default' | awk '{print $2}'")
    tell application "Terminal"
    activate
    do script "telnet " & DG
    end tell
    return input -- pass on the input
    end run
    </pre>

  • Performance of set variable command in WAD

    Hi all
        The set variable command in WAD is performing really badly. Can somebody please help me to identify how to decrease the response time.
    thanks in advance

    Hi Vikram,
    your link to SAP Help is wrong. It refers to BW 3.5 (NW04), but your URL looks like BW 7.0 (NBW04s). So you need another SAP Help link. Try this one:
    <a href="http://help.sap.com/saphelp_nw70/helpdata/en/43/ef05462480025ae10000000a1553f7/frameset.htm">http://help.sap.com/saphelp_nw70/helpdata/en/43/ef05462480025ae10000000a1553f7/frameset.htm</a>
    Regarding to example 3 your link should look like this:
    <a href="http://sthbmdm8dv.client.com.50000http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fcom.sap.pct!2fplatform_add_ons!2fcom.sap.ip.bi!2fiViews!2fcom.sap.ip.bi.bex?TEMPLATE=ZPlan_W00500&BI_COMMAND_1-BI_COMMAND_TYPE=SET_VARIABLES_STATE&BI_COMMAND_1-VARIABLE_VALUES-VARIABLE_VALUE_1-VARIABLE=zplan_appid&BI_COMMAND_1-VARIABLE_VALUES-VARIABLE_VALUE_1-VARIABLE_TYPE=VARIABLE_INPUT_STRING&BI_COMMAND_1-VARIABLE_VALUES-VARIABLE_VALUE_1-VARIABLE_TYPE-VARIABLE_INPUT_STRING=10002002">http://sthbmdm8dv.client.com.50000http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fcom.sap.pct!2fplatform_add_ons!2fcom.sap.ip.bi!2fiViews!2fcom.sap.ip.bi.bex?TEMPLATE=ZPlan_W00500&BI_COMMAND_1-BI_COMMAND_TYPE=SET_VARIABLES_STATE&BI_COMMAND_1-VARIABLE_VALUES-VARIABLE_VALUE_1-VARIABLE=zplan_appid&BI_COMMAND_1-VARIABLE_VALUES-VARIABLE_VALUE_1-VARIABLE_TYPE=VARIABLE_INPUT_STRING&BI_COMMAND_1-VARIABLE_VALUES-VARIABLE_VALUE_1-VARIABLE_TYPE-VARIABLE_INPUT_STRING=10002002</a>
    If the variable screen starts up, you should suppress it in template properties.
    best regards
    ARNE
    Edited by: Arne Witte on Jan 18, 2010 6:40 PM

  • Set variables leads to dump error in SEM 4.0

    Hi,
    I am on SEM 4.0 system.In BPS, i am not able to use set variables feature.whenever i hit this button the system does the process for couple of minutes and finally gives a dump error.
    I applied this note 806362.No success.
    Any one to my rescue?

    ravi,
    the variable is of type user-defined values and input allowed by user.
    "If the replacment type is user speficic values, then you can go to BPS0 - area - variable and set the values here also".- How i would do it here? Inorder to set the variable with a value i will choose SET VARIABLES option.
    Whenever i choose this the system creates a dump.
    Message was edited by:
            ragav

  • Problem with restricted key-figure using off-set variable

    Hello Gurus,
    I have created a query in Bex Query Designer with a key figure restricted. This key figure shows me the 0amount value for the last month. When I select 003.2009, the key figure brings the 002.2009 values. I used an off-set variable to do this
    It works!
    But when I show this key-figure in Webi, no value shows up on the table.
    Any suggestions?
    tks
    Edited by: Allisson Valverde on Jul 23, 2010 12:12 AM

    Which variable are you using in BEx and in WEBI to restrict the month/year?

  • "Set variable value" topic

    Hi evry!
    My vi sends some value of "cluster" type to RT-machine's vi by means of "Set variable (variant).vi", wich, in turn, answers with Error #2: Memory is Full!
    How can be that?
    Thanx in adv, guys!
    P.S.: All versions are 8.2.1.

    Hi Sharonoff,
    Thanks for contacting National Instruments.  I have been looking into your question a little more and I have some helpful links for you that I think will help you out.  This error is pretty self-explanatory in the fact that the system you are running the VI on is running out of memory.  The links attached below should give you some good guidelines on what to do with managing large data sets trying to avoid this error.  I would particularly pay attention to the article entitled "Managing Large Data Sets in LabVIEW."  However, you want to try and limit the size of the data in the cluster that you are sending to the RT-machine as it may not have a large amount of virtual memory that it can use to handle your data.  Please look over some of these documents and try out some of their methods.  If you have any more questions, reply back and we can go from there.  Thanks!
    http://zone.ni.com/devzone/cda/tut/p/id/3625
    http://digital.ni.com/public.nsf/allkb/CBEBDC18465​5FC8C8625724A00050854?OpenDocument
    http://digital.ni.com/public.nsf/websearch/C3C516C​11184AF3F862571B5006B46E1?OpenDocument
    http://digital.ni.com/public.nsf/websearch/BC911F0​893A4627586256BB10076E90C?OpenDocument
    http://zone.ni.com/devzone/cda/tut/p/id/3561
    Regards
    Noah R
    Applications Engineering
    National Instruments

Maybe you are looking for

  • BAPI FOR CREATION OF MATERIAL VARIANT IN SAP

    Dear All, Can anoy one please provide me name of BAPI to create material variant.This is required when we create material variant for a configurable material, characteristics values are added in MRP 3 View  .

  • External Monitor not showing.

    Good Day All, I seem to be having problems with setting up my external monitor... I have a JVC tape deck, I forgot the model, and a SONY TV(forgot the model). What I did was I used a firewire plugged it to the back of my g5 then onto my tape deck. Fr

  • Can't configure EPM modules after ODI 11.1.1.6 install

    So recently ran the EPM 11.1.2.1 install on my windows server r2 x86. I have configured foundation. Then i proceeded to install ODI 11.1.1.6. ODI installed successfully and runs. Although now I can't configure essbase with shared services. Anyone kno

  • Trashed Mail by mistake

    My Cousin's iMac somehow had multiple Mail icons of on her desktop. After I removed all the icons, I went back to the Mail icon on the dock and tried to relaunch Mail. Clicking on the Mail icon in the dock produced a question Mark. I went back to the

  • Really? No educational upgrade from CS5.5 to CS6 without paying full price?

    We bought the CS5.5 educational copy for our daughter in college.  Now she needs CS6.  Called about an upgrade and was told there isn't one, that we need to buy a whole new version or use cloud with a monthly fee.  Basically our CS5.5 is useless now!