Creating a function and passing query value

I have what I thought was a pretty easy to resolve situation:
I want to concatenate two query fields, if the 2nd one isn't empty.
I created a function:
<cfargument name="q1" value='#query.q1#' />
<cfargument name="q1a" value='#query.q1a#' />
<CFSET variables.myPunct = ": ">
<cfset variables.ResultVar="">
<cfif Trim(arguments.q1) NEQ "">
<cfset variables.ResultVar='#arguments.q1#'>
</cfif>
<cfif Trim(arguments.q1a) NEQ "">
<cfif variables.ResultVar NEQ "">
<cfset variables.ResultVar='#variables.ResultVar &
variables.myPunct#'>
</cfif>
<cfset variables.ResultVar='#variables.ResultVar &
arguments.q1a#'>
</cfif>
<cfreturn variables.ResultVar>
This is basically just the example they provide in the online
instruction, with the names changed.
In the detail band of my report, I have an expression builder
field containing: report.mytestfunction()
When I run this, I get: Element Q1 is undefined in ARGUMENTS.
I've tried this ninety different ways (literally). It seems
very clear to me that the query.q1 (for that matter, any of the
query results) are NOT getting passed to the function. I have tried
making the expression: report.mytestfunction(query.q1). I have
tried creating an input parameter.
The documentation on this is ridiculously limited,
considering that the ability to implement conditional logic depends
entirely on the "function", as far as I can tell. I can in no way
get the function to interface with the query results. If is set
fixed values in the function, as opposed to trying to use the query
variables, it outputs fine.
Any ideas?

That has got to be the only way I DIDN'T try, although I
could swear I tried that, too. Maybe I didn't have the "required"?
I don't know. I know it works now. For the record, FUNCTION:
<cfargument name="q1" required="yes" />
<cfargument name="q1a" required="yes" />
<CFSET variables.myPunct = ": ">
<cfset variables.ResultVar="">
<cfif Trim(arguments.q1) NEQ "">
<cfset variables.ResultVar='#arguments.q1#'>
</cfif>
<cfif Trim(arguments.q1a) NEQ "">
<cfif variables.ResultVar NEQ "">
<cfset variables.ResultVar='#variables.ResultVar &
variables.myPunct#'>
</cfif>
<cfset variables.ResultVar='#variables.ResultVar &
arguments.q1a#'>
</cfif>
<cfreturn variables.ResultVar>
In the "Detail" band, called function:
report.mytestfunction(query.q1, query.q1a)
Thanks for the tip. I'm going to go take a long walk on a
short pier now.
max

Similar Messages

  • How do you create a user defined functions  UDF and passing a value like a ID to GEt a Value.

    How do you create a user defined functions UDF and passing a
    value like a ID to GEt a Value.
    using a query.
    are there example.
    Thanks

    tons of examples at cflib.org - good place to start, even
    though many
    udfs there are a bit outdated in their code...
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com

  • Creating remote objects and passing the retrieved data to modules

    I found at this Adobe tutorial a nice "RemoteService" class that  creates a RemoteObject and contains the functions for handling the  result and fault events. If I wanted to use this approach, how could I  pass the data from the result handler to interfaces that modules from  the main application could use?
    I could put the RemoteService/RemoteObject in the modules, but (in my  opinion- and I could be wrong) the best design seems to be using the  remote calls in the main app and passing the data along to the modules.
    Ultimately, I would like to know what the "best practices" are for creating remote objects and passing the retrieved data to modules
    Thanks!

    public void mouseClicked(MouseEvent e) {
      X x = new X(e.getX(), e.getY());
    }I don't see the difficulty.

  • How to retrieve the procedure value and pass the value to a form field

    How to retrieve the procedure value and pass the value to a form field?

    Set property for the field and the value is the actual procedure/function.
    Cheers

  • How to create business functions and expose as webservice?

    Hi...
      How to use Java to create business functions and expose that as a webservice.

    Hi Leela,
    Can you please post the answer to the question posed?
    We are also looking for a similar implementation in our integration and would really appreciate any help.
    Regards

  • Plot function and read curser values(int​erpolate) programmat​ically

    I would like to obtain a plot of the following function and then obtain values of "I" by specifying values of V..i would like the program to spot the value of I when V value is obtained without manually pointing out the curser. I hope someone can help.thank you
    Attachments:
    eq.JPG ‏10 KB

    duplicate post, continue here

  • How to create snapshot portlet and snapshot query using server API

    How to create snapshot portlet and snapshot query using server API
    Regards
    Dheeraj

    Hi Sebastian,
    I have used the query and it is working fine. but, How could i include the headers of the query also in to the Excel Sheet.
    RehaanKhan. M
    see the method discussed here
    http://sqlblogcasts.com/blogs/madhivanan/archive/2008/10/10/export-to-excel-with-column-names.aspx
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Creating a filter and Sending default value to it using designer on SAP BW

    Hi All,
    Data Source: SAP BW
    BI Layer: BO 3.1
    Here goes my question:
    We have a cube which contains HR related data. I want to query data in such a way that it gets me data for the current month and year. The time dimension contains a hierarchy called Calendar Year/Month which has values u201CFEB 2009u201D, u201CMAR 2009u201D and so on. I want to create a WebI Report which should take Current month as MAR (since current month is March) and Current Year as 2009 and pass u201CMAR 2009u201D to the query without useru2019s intervention so basically itu2019s a default value. Similarly, when the month and year changes, this value should reflect the new values (i.e. APR 2009 when April 2009 arrives).The final outcome should be a dashboard displaying information using WebI Report.
    Kindly guide me step by step if there is a possible way to achieve it on SAP BW (OLAP datasource) using BO Universe designer/WebI and by using MDX wherever necessary.
    Otherwise, is there a possibility of creating Filter in Universe which takes something like Month(Current Date) and Year(Current Date), append them and pass it as a parameter to BW cube;  If yes, how?
    Kindly guide

    Couple of things, first you need to make sure you assign navigation for the buttons, which is why the remote control on the DVD Player did not work, yet you can mouse over in the computer [Assign Navigation|http://dvdstepbystep.com/buttons07.php] and [a thread|http://discussions.apple.com/thread.jspa?messageID=9134310&#9134310]
    As to overlays, buttons will not appear (the highlights) until the loop point of the menu, but if ellements are in the background (video) then they will appear. If you do not want those items (in the background) to appear to the loop point you need to fade it in or otherwise do whatever effect you want in the background video. [Motion Example|http://dvdstepbystep.com/motion.php]

  • Multiple selection list and passing that value to oracle reports

    Hi
    I need to create a multiple selection list and then based on use selection, I need to pass that value to oracle reports. Can any one help with steps on how I can do this. Thanks

    Hi
    Concatenate the multiple values into a string separated by comma and then pass that string to report as a parameter.
    In report query, you have to use the lexical parameter using ' & '
    regards
    SD

  • Creating a function and return something from an XML file

    Hi!
    I'm working with timeline actionscript. I want to create a function that loads my xmlfile and returns an xmlobject with the file's content.
    This is what I got so far:
    my_btn.addEventListener(MouseEvent.CLICK, getXML("myxml.xml")); //1067: Implicit coercion of a value of type void to an unrelated type Function.
    function getXML(fn:String):void{
         var infoLoader:URLLoader = new URLLoader();
         infoLoader.addEventListener(Event.COMPLETE, xmlLoaded);
         infoLoader.load(new URLRequest(fn));
         var myXML:XML = xmlLoaded(); //1136: Incorrect number of arguments.  Expected 1.
         trace(myXML);
    function xmlLoaded(e:Event):XML{
         return e.target.data;
         //trace(e.target.data);
    Can anyone take a look and perhaps point me in the right direction?
    Thanks

    I have never used a listcomponent, so I can only help with the steps before filling it with data.
    I think you should at start of your application load the XML with filenames and just after it's completed, e.g. in Event.COMPLETE handler, load all other XMLs looping through filenamesXML, like this
    var filenamesXML:XML;
    var XMLsToLoad:uint = 0;
    function filenamesXMLLoaded(e:Event):void
         filenamesXML = XML(e.target.data);
         XMLsToLoad =  filenamesXML.filenames.children().length();
         for (var i:uint =1; i < filenamesXML.filenames.children().length(); i++)
                  getXML( filenamesXML.filenames.children()[i] ); // the function from my previous post, don't forget to implement it
    //modify the minor xml load handler from the previous post
    function xmlLoaded(e:Event):void
         var loadedXML:XML = XML(e.target.data);   
         xmlArray.push(loadedXML);
         XMLsToLoad--;
    //assign the one click handler to all buttons, a loop here would be quite handy
    function clickHandler(e:MouseEvent):void
         if (XMLsToLoad == 0) //check if all xmls have been completely loaded
              switch (e.target.name) // swith by clicked button's instance name
                   case "button_1":
                        // here you have to implement supplying listcomponent with data, I think a loop again will be a good idea
                        break;
                   case "button_2":
                        // ibid.
                        break;
    Regards,
    gc

  • Need help parsing a long and passing the value.

    I'm doing Cattle Drve 4b on javaranch.com (http://www.javaranch.com/say.jsp) and I need a bit of help.
    I want to pass the reference of my num value to several small methods to work out the value printed. Here's the original code I did from 4a:
    public class Say{
    public static void main(String[]args){
    int num = Integer.parseInt(args[0]);  // parse argument from command line
    String array[] ={"Zero", "One", "Two", "Three", "four", "five", "six","seven","eight",
               "nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen",
               "seventeen","eighteen","nineteen","twenty","thirty","fourty","fifty",
               "sixty","seventy","eighty","ninety"};     //initialize the array
    //start check for value
    if(num<21)
    System.out.println("\n" + array[num]);
                                            //  \n is added before
    else if(num<30)                                   //  each result for a
    System.out.println("\n" + array[20]+ "-" + array[(num-20)]);     //  cleaner output
    else if(num<40)
    System.out.println("\n" + array[21]+ "-" + array[(num-30)]);
    else if(num<50)
    System.out.println("\n" + array[22]+ "-" + array[(num-40)]);
    else if(num<60)
    System.out.println("\n" + array[23]+ "-" + array[(num-50)]);
    else if(num<70)
    System.out.println("\n" + array[24]+ "-" + array[(num-60)]);
    else if(num<80)
    System.out.println("\n" + array[25]+ "-" + array[(num-70)]);
    else if(num<90)
    System.out.println("\n" + array[26]+ "-" + array[(num-80)]);
    else if(num<100)
    System.out.println("\n" + array[27]+ "-" + array[(num-90)]);
    //endFor 4b I need to be able to print out values in the billions, so I was going to create a few methods to keep it clean like so:
    public class billion (long (int num)
    { if( num<9 billion)
         num-= 8 billion
    System.out.print("eight billion ");
    else if(num<8 billion){
    num-= 7 billion
    System.out.print("seven billion ");
    ....etc
    return num;
    public class million...
    public class thousand...
    etc.And the current main section will be moved into a new "tens" class.
    I'm running into two problems though.
    1. How do you parse a long? I know integers are like so:
    int num = Integer.parseInt(args[0]); are longs the same?
    like:
    long num = Long.parseLong(args[0L])if not, how can I do it?
    2. how do I properly pass num to all the methods? I'm going to make num a public int and make the methods public because that seems simplest, but can I pass num to the method and then return the new value of num back to main?
    BTW, I'll be removing the carriage return from the beginning of the "tens" class when all is said and done so the results don't end up printing on multiple lines.
    Thanks in advance everyone.

    The L suffix is used to identify a Long literal.
    The index of the args[] array does not need to be specified as a Long.
    Solong num = Long.parseLong(args[0]);will suffice. You might want to put that in a try/catch block to catch the NumberFormatException that will be thrown if args[0] cannot be parsed to a long value.
    Various ways to update the value of num in the methods of the same class:
    Simplest of all: declare num as an instance variable. The methods simply access and assign its value.
    Other ways:
    -- pass num as a parameter to the method.
    -- return the value of num from the method (provided the method doesn't have to return any other value)
    -- Have a getNum() method return the value of num
    -- Have setNum() method to update the value of num
    db
    What's that line? public class billion (long (int num)edit Typos, typos...
    Also, the set/get approach with public access is the preferred method when used in the methods of another class.
    Don't forget that the other class has to know whose set/get methods to call.
    Message was edited by:
    Darryl.Burke

  • Create sequence, function and view all at once -script or something similar

    Hi I would like to know in what way can I write a script or something like that which would define names for a sequence, function and a view in the beginning (for example TEST_SEQ, TEST_FJ, TEST_VIEW...) and after that create this sequence, function and view with definitions like
    CREATE SEQUENCE  TEST_SEQ
    MINVALUE 1 MAXVALUE 999999999999999999999999999
    INCREMENT BY 1 START WITH 1 NOCACHE  NOORDER  NOCYCLE;
    create or replace FUNCTION TEST_FJ RETURN NUMBER AS
    tmp number;
    BEGIN
    select TEST_SEQ.NEXTVAL  into tmp from dual
    RETURN tmp;
    END TEST_FJ;
    and so on...
    In the end I would also like to grant some rights on these objects I just created:
    grant select on TEST_SEQ to public;
    grant execute on TEST_FJ to public;
    So my question is how to package all these things together so I can execute them from a single file in SQL Developer, and if i need to change the names of these tables I want do it in one place in the beginning of this script (or something like a script, I'm not sure what)...
    Thanks in advance!

    hi,
    hope help you...
    this is my basic generic solution...
    create or replace procedure createSequence( psequenceName in varchar2 ) is
    begin
    execute immediate 'create sequence ' || psequenceName ;
    execute immediate 'grant select on ' || psequenceName || ' to public ';
    end ;
    create or replace function getNextVal( psequenceName in varchar2 ) return number is
    queryText varchar2(100) := 'select <sequence_name>.nextval into :next_value from DUAL' ;
    next_value number ;
    begin
    queryText := replace(queryText,'<sequence_name>',psequenceName);
    execute immediate queryText into next_value ;
    return( next_value ) ;
    end ;
    Edited by: edogt on Nov 27, 2008 5:33 AM
    Edited by: edogt on Nov 27, 2008 5:35 AM
    Edited by: edogt on Nov 27, 2008 5:35 AM

  • How to call PL/SQL function and pass parameter to ODI variable?

    Can I call PL/SQL function and assign a return value to an ODI variable? Also can I assign ODI variable to IN paramter and assign OUT parameter to ODI variable? What ODI doc has that information?
    Thanks

    Hi,
    Refer this http://odiexperts.com/how-to-use-plsql-procedures-and-functions-in-odi
    Thanks,
    Sutirtha

  • Creating New Functions and Risks in RAR 5.3

    All,
    I need to create a set of new functions and risks in RAR 5.3. What is the best way to do this?
    I tried to export existing functions and modify what I thought were the relevant tables. Next I tried to import this into Rule Architect > Utilities > Import Rules. I got the confirmation the import uploaded successfully and a rule generation job started. The job took a while and when it comepleted I looked for the functions and they weren't there. What do you all advise?
    Thanks,
    Grace Rae

    yes Frank is right. if few functions then better do with Rule Architect
    else you must understand interdependency of various table
    did you defined which Business Process thsoe function will belong to.......
    check table
    VIRSA_CC_BUSPRC
    VIRSA_CC_BUSPRCT
    VIRSA_CC_FUNC
    VIRSA_CC_FUNCT
    virsa_cc_func*
    functions and the object they pulled and actions , all these interrelations should be taken care of.....
    better refer to default rule sets send by SAP, that's the way you have to create.....
    regards,
    Surpreet

  • Call External C++ function and pass XML

    Hi,
    I need to call external C++ function from Oracle and pass to it XML file from Oracle table? Can you give short guide how to do it?
    Regards

    Your question sounds like is about using an Oracle database (or other application), and not about C++ programming or the using the C++ compiler. You are more likely to find a helpful answer in an Oracle database (or other application) forum.

Maybe you are looking for

  • No GR/IR items cleared after GR/IR clearing by F.19 and SM35

    Hi experts, After I execute the GR/IR clearing program through F.19 and then post the batch through SM35, I found the GR/IR open items have not been cleared, even though they match the clearing conditions. I test to create a PO, make the invoice rece

  • FDQM issue

    Does anyone know Hyperion FDQM well i have a problem I have installed Hyperion FDQM 9.3.1 sucessfully but during implementation of application i am recieving an error when am creating a map table " *Permission denied: 'CreateObject' At Line: 51* " my

  • MacBook Air with external monitor and wired network

    Hello, I'm investigating the possibility to buy a MacBook Air 13", but I have a big doubt: most of the time I work in office, with wired LAN and an external DVI monitor. I've seen that I can buy an USB to LAN adapter and a DisplayPort to DVI to conne

  • Offsetting entry and account determination

    Hi friends, The question I'm putting across might sound silly. I have tried a lot to understand these on my own but I still don't feel confident on my own understanding. Hence I'm seeking your help. Can you please explain me the meaning of Offsetting

  • Deep linking not working in Flex 4

    Deep linking is working in Flex 4 (using Flash Builder) when I debug and run the application, but not when I do an export release build. So I tried using the files from the bin-debug directory, and noticed that deep linking only works when the files