Creating a function and passing the value of the query

I have what I thought, it was a pretty easy to resolve the situation: I want to concatenate two fields of the query, if the 2nd is not empty.

I created a function:

< name cfargument = "q1" value = "#query.q1 #" / > "
< name cfargument = "q1a' value =' #query.q1a #" / > "

< CFSET variables.myPunct = ":" > "
< cfset variables. ResultVar = "" >

< cfif QNE Trim (arguments.q1) "" > "".
< cfset variables. ResultVar =' #arguments.q1 # ">"
< / cfif >

< cfif QNE Trim (arguments.q1a) "" > "".
< cfif variable. ResultVar NEQ "" > "".
< cfset variables. ResultVar ='#variables. ResultVar & variables.myPunct # ">"
< / cfif >
< cfset variables. ResultVar ='#variables. ResultVar & arguments.q1a # ">"
< / cfif >
< variable cfreturn. ResultVar >

It's basically just the example they provide in online education, with the names have been changed.

In the strip of the details of my report, I have an expression builder containing field: report.mytestfunction)

When I run the present, I get: Q1 element is not defined in the ARGUMENTS.

I tried this ninety different ways (literally). It seems very clear to me that the query.q1 (Incidentally, none of the results of the query) are NOT passed to the function. I tried to make the expression: report.mytestfunction (query.q1). I tried to create an input parameter.

The documentation on this is ridiculously limited, given that the ability to implement conditional logic is entirely dependent on the 'function', I can say. I can in no way to get the function of interface with the query results. If the value fixed values in the service, rather than trying to use query variables, it shows very well.

Any ideas?

Have you tried to remove the attribute "value" of your cfargument tag? The way I see it, you should have:


... rest of function...

And then you have to call it with: report.mytestfunction (query.q1, query.q1a)

Tags: ColdFusion

Similar Questions

  • Can I create a cursor and set the values by myself

    Can I create a cursor and set the values by myself, and it has not been filled by an SQL?

    Thanks in advance

    Yes, you can.
    Use variables with a default value or nvl (some_parameter, some_variable) in your cursor WHERE predicate.
    They provide an example if it isn't clear, since that's all I can think about reading your post...

  • How to perform a function and return the result in a variable of liaison

    Hello

    I'm trying to calculate the sum of the salaries of all persons with a particular using a function JOB_ID TOTAL_INCOME (v_job_id).

    create or replace function total_income
    + (v_job_id in VARCHAR2) +.
    Number IS BACK
    v_total number (6);

    cursor get_sal is
    Select the pay of employees
    where job_id = v_job_id;
    BEGIN
    v_total: = 0;
    for emp in get_sal
    loop
    v_total: = v_total emp.salary; +.
    end loop;

    dbms_output.put_line (' Total salary ' | v_job_id |' is: ' | v_total);
    Return v_total;
    END;

    Now I woud like to perform this function and assign the value returned in a variable binding test_sal

    test_sal variable number (6)
    SELECT total_income ('AD_VP') in: test_sal FROM DUAL;
    dbms_output.put_line (' Sal Total :'||: test_sal);

    This returns the errors below:

    SELECT total_income ('AD_VP') in: test_sal FROM DUAL
    *+
    Error on line 0
    ORA-01036: illegal variable name/number

    dbms_output.put_line (' Sal Total :'||: test_sal);
    Error on line 3
    ORA-00900: invalid SQL statement

    Could someone help me what could be the problem? Thanks for your time...

    Hi Kiran and welcome to the forum,

    You mix SQL and PL/SQL

    It's the way in which SQL:

    SQL> SELECT total_income('AD_VP') FROM DUAL;
    
    TOTAL_INCOME('AD_VP')
    ---------------------
                      123
    1 row selected.
    

    It comes to PL/SQL in SQL * more

    SQL> variable test_sal number
    SQL> execute :test_sal := total_income('AD_VP')
    PL/SQL procedure successfully completed.
    SQL> exec dbms_output.put_line('Total Sal:'||:test_sal)
    Total Sal:123
    PL/SQL procedure successfully completed
    

    Concerning
    Peter

  • How to create a document and insert the words and/or art on both sides of the page

    How to create a document and insert the words and/or art on both sides of the page

    How to create a document and insert the words and/or art on both sides of the page

    You create a document by using an application of word processor like Microsoft Word or Corel WordPerfect or OpenOffice Writer.  Think of it as a broad a page roll.

    When you print the document, you can print all pages of the document on one sheet of paper (the normal default value), or you can print on both sides of a sheet of paper.

    Some printers are capable of automatic double-sided printing.  With others, you print all the odd pages and then take the stack of paper, turn upside down and put it back into the printer to print all pages.  You need either to read your printer manual, or experiment a bit to determine if you need to re - organize the first last pages before printing the second side.

  • Is anyway to create fifth partition and keep the basic hard disk?

    Hi, my laptop is g7 1207se Pavilion and the and HP has made 4 partitions (C for windows) and the other 3 for system files and recovery, I want to create a new partition for my files (so I can recover my system without losing them) or install other operating systems, but apparently if I want to create fifth partition I have to convert my hard drive in Dynamics by the practice that I won't be able to boot from any partition but the C, which means no recovery and no other operating system.

    Is anyway to create fifth partition and keep the basic hard disk?

    Hello

    See the excellent guide of Daniel_Potyrala on the link in this regard.

    http://h30434.www3.HP.com/T5/other-notebook-PC-questions/how-to-REPARTITION-HDD-of-HP-notebook-with-pre-loaded-Windows-7/TD-p/742019

    Kind regards

    DP - K

  • Hello, I want to make an outline of the text that I created.  I started with a blue background.  Then, I created a text and changed the color of gold.  I then put on an image and used the clipping mask to show the image by the text. Problem

    Hello, I want to make an outline of the text that I created.  I started with a blue background.  Then, I created a text and changed the color of gold.  I then put on an image and used the clipping mask to show the image by the text. Problem is it gets rid of color and shows that the peak through the text.  I wanted a draft of the text with the picture.  Is this possible?

    Thank you

    Peter

    You're welcome, Peter.

  • How can I creat photoshop filters and rendering the form of exe file

    Hello.. How are you all, I hope you fine...

    I want to know if I can creat photoshop filters and rendering the form of exe file...

    and thank you...

    If you really want to create a good filter/plugin and distribute it I can only recommend that you try the SDK Forum.

    Photoshop Plugin and companion App SDK

    Adobe Photoshop SDK | Adobe Developer Connection

  • I need acrobat pro to open a pdf file I created in quark and reduce the size of the file?

    I need acrobat pro to open a pdf file I created in quark and reduce the size of the file?

    It may be preferable to use a downsampling image option in Quark during the pdf creation process.

  • Still awaiting to hear from VMware after taking the training and pass the exam.

    Hello

    I took the training on February 1 (VMware vSphere: install, configure, manage) and passed the VCP - 410 exam on February 8, but have not yet heard of VMware.  :_|

    Is it normal that it takes a long time? I am supposed to receive an e-mail to confirm my VCP status, right?  ?:|

    Thank you.

    The status on the website of Pearson view should say that the review was a 'pass', you won't hear anything from VMware, until you receive your welcome kit VCP in post/mail and your Workstation 7 license by email - you should get those in the next 4-6 weeks... Bravo

    Scott.

    -

  • How to implement enter and execute the query in the ADF

    I'm new to ADF and I'm trying to create a simple data entry in ADF 11 g based on a database table. I'm looking to implement the equivalent of the request function enter and execute the query in Oracle Forms. I tried the default operations that are available with the data controls. But they don't seem to have this feature. Can someone help / tell me how this can be implemented.

    Thank you
    Srini.

    How to add a query Panel? Who has the most benefits that the use of Find.

    More info on af:query

    http://docs.Oracle.com/CD/E28389_01/apirefs.1111/e12419/tagdoc/af_query.html

    Arun-

  • pass the query id in the pop up window

    Hello

    I want to be able to pass the query id in the pop up window but do not know how to do it, would you please help me with this? -Thank you

    the code below (A) works very well with open the pop-up page detail but din't know how there an id in the details of the page.

    <!--A-->

    < script >

    function openWin()

    {

    Window.Open ("detail.cfm,", "_blank", "toolbar = yes, scrollbars = yes, resizable = yes, high = 500, left = 500, width = 400, height = 400");

    }

    < /script >

    < cfset foo = querynew ("id_int, aNo_var, Renew, Cancel') >

    < cfloop query = "getOrderHist" >

    < cfset queryaddrow (foo) >

    < cfset querysetcell (foo, 'id_int', getOrderHist.id_int) >

    < cfset querysetcell (foo, 'aNo_var', getOrderHist.aNo_var) >

    < cfset querysetcell (foo, 'Renew',' < a href = "javascript: void (0);" onclick = "openWin ()" > view < /a > ') >

    < / cfloop >

    <! - B - >

    I try to call the page directly such as below but got an error of "invalid character".

    < cfset foo = querynew ("id_int, aNo_var, Renew, Cancel') >

    < cfloop query = "getOrderHist" >

    < cfset queryaddrow (foo) >

    < cfset querysetcell (foo, 'id_int', getOrderHist.id_int) >

    < cfset querysetcell (foo, 'aNo_var', getOrderHist.aNo_var) >

    < cfset querysetcell (foo, 'Renew',' < a href = "javascript: void (0);" onclick = "window.open("detail.cfm?id=#id#","_blank"); > < /a > to renew '") >

    < / cfloop >

    you have a 'openWin' function, but then you try to add inline JS to do the same thing.  I suppose you're eventually loop over your query "foo" output these links to renew.  In this case, I just want to pass a URL or just the ID into the openWin function.  Much simpler than to try to add dynamic JS in a cell of the query.

    I am a bit confused why you are creating a new query, foo, if you already have the query getOrderHist that seems to have everything you need.

    function openWin (id) {}

    Window.Open ("detail.cfm? id =" + id, "_blank", "toolbar = yes, scrollbars = yes, resizable = yes, high = 500, left = 500, width = 400, height = 400");

    }

    ID: #getOrderHist.id_int #.

    aNo: #getOrderHist.aNo_var #.

    Renew

  • Can we make several Off features in a collection of panels and how the query-off based on the example?

    Mr President.

    Can we make several Off features in a collection of panels and how the query-off based on the example?

    Concerning

    Once again, no jdev version?

    It must be really hard to remember ehich version you are working.

    Would have given a quick glance in the docs

    featuresOff java.util.Set Yes a list separated by spaces of the features by default to disable to the panelCollection. Values supported are

    That is the answer to a message.

    The second answer is that qbe is filtering tables. If you fund the table without filter you have not the qbe.

    Timo

  • How to get the query of the region "PL/SQL function body returns the query string"?

    Hello

    is it possible to get the query string from the region of type "PL/SQL function body returns the query string"?

    I can get the definition of the region as a PL/SQL procedure, but I am interested in the returned query. I tried to write something like

    < pre > v_return_query: = «...» » ;
    : P49_QUERY: = v_return_query;
    Return v_return_query; < / pre >

    to save the return on hidden item P49_QUERY string, but it does not work. I get the error message: ERR-1002 cannot find the item for the "P49_QUERY" element ID in the application '4000 '.

    Kind regards
    Przemek

    If you need to make reference to a page element in the block then you can use this type of control to avoid having to use generic column names:

    if apex_application.get_current_flow_sgid(:APP_ID) = apex_application.get_sgid then-- runtime  :P9_SQL := vSQL;else-- design time  null;end if;
    

    But if all you want to do is capture the SQL debugging you can take all the references element in the block and use the insert statement (in a debug table) as I showed earlier.

    Scott

  • Call AJAX process and pass the value on request

    Hello
    I want to call a process on demand by a button. So I added the following for her javascript code:


    function update_bp1()
    {
    Alert ('hhhhi');
    Alert (document.getElementById('P11_PATIENTID').value);
    var ajaxRequest = new htmldb_Get (null, & APP_ID., 'APPLICATION_PROCESS is update_bp', 0);
    ajaxRequest.add ('patient_id1', document.getElementById('P11_PATIENTID').value);
    ajaxResult = ajaxRequest.get ();
    Alert (ajaxResult);
    }
    < /script >


    The called application process is:

    declare
    number of v_id;
    number of v_visitno;
    v_patientid varchar2 (10);
    BEGIN

    Select max (id), max (VISITNO)
    in v_id, v_visitno
    of TBL_PATIENT
    where PATIENTID =: patient_id1;

    Update TBL_PATIENT
    the SYSTOLIC value = 10,
    DIASTOLIC = 20
    where id = v_id
    and visitno = v_visitno
    and patientid =: patient_id1;

    commit;

    HTP. PRN ('process value'-|: patient_id1);

    end;

    It seems there is error in the ajaxrequest.add clause, as after commenting on the function is executed. Alert print correctly the value P11_PATIENTID.
    The alert of the ajaxresult gives the complete HTML code and the process is not running. How interpreet ajaxresult error.

    Please help me to identify the problem.

    Thank you

    Hello

    I think that it is not relative browser, but Firefox with the module Firebug is just a better tool for web developer.
    It is easier to debug problems you have now.

    Is the point of application patient_id1? You need also to pass the value to the application process?
    If you don't need it another vise, it is better to use variables global apex_application

    Try this
    JavaScript for HTML page header

    
    

    Then, create the new process On demand application named UPDATE_PATIENT. Please note that the name of this process is case sensitive.

    DECLARE
      v_id        NUMBER;
      v_visitno   NUMBER;
      v_patientid VARCHAR2(10);
      v_count     NUMBER;
    BEGIN
      SELECT MAX(id),
        MAX(visitno)
      INTO v_id,
        v_visitno
      FROM tbl_patient
      WHERE patientid = apex_application.g_x01
      ;
      UPDATE tbl_patient
      SET systolic  = 10,
        diastolic   = 20
      WHERE id      = v_id
      AND visitno   = v_visitno
      AND patientid = apex_application.g_x01
      ;
      v_count := SQL%ROWCOUNT;
      COMMIT;
      htp.prn(v_count || ' rows updated');
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
      htp.prn('error: patientid ' || apex_application.g_x01 || ' not exists in tbl_patient');
    WHEN OTHERS THEN
      htp.prn('error: ' || sqlerrm);
    END;
    

    Kind regards
    Jari

  • [ADF, JDev12.1.3] Lined back workflow a lot of values used as a dialog box. How to specify and pass the values to the btf appellant?

    Hallo,

    I've created a workflow bounded (containing JSPX pages) that I use as dialog box.

    There a lot of return values...

    I would like to how to go and read all values ret in the workflow limited appeal because the return value of dialogue seems to not allow a value...

    Thank you

    Federico

    You can try with returnListener, then to returnEvent.getReturnParameters ( https://myfaces.apache.org/trinidad/trinidad-api/apidocs/org/apache/myfaces/trinidad/event/ReturnEvent.html#getReturnParameters%28%29 )

    Dario

Maybe you are looking for

  • Serial number on the web interface

    Is there a place on the web interface to find the serial number? I have more than 50 of the latest devices at remote sites that I have to manage and get an inventory without human intervention on the sites.

  • screen saver does not start

    I set time display to start and has chosen the theme and nothing happens

  • Always start with FAILURE in Windows safe MODE

    Hi guys,. My computer still starts in safe mode. I tried pressing F8 before the logo appears and select START WINDOWS NORMALLY, but he's still in safe MODE. I can not use certain features and can not install updates. Help, please. sgs1973

  • Secure API question

    Hello in my application, I use the API signed... I want to deploy the application on the device... while deploying, I need to sign these APIs... I signed these APIs When I try to start the application on the device, it is said: application startup er

  • Cannot use Family Health Care Manager get error violation of cess to 0x779EE9D7 (tried to read from 0xB67C4C4C), program completed

    Original title: installation and execution of the FHCM I downloaded a trial version of Family Health Care Manager, (FHCM), that I need something to replace MEM Quicken.  When I try to start FHCM I get the error message: "Access violation at 0x779EE9D