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

Tags: Database

Similar Questions

  • call another proc and passing the values in the exception block

    Hello
    I'm trying to call the procedure another passing values in the exception block... but I couldn't m figure out how would the values in the exception block
    create or replace procedure test_proc 
    is 
       cursor test_cur is 
         select update_dt from test_tbl;   
         
         test_rec test_cur%rowtype;
    
        begin
            for test_rec in test_cur
            loop
                begin 
                    insert into test_tbl values (test_rec.update_dt);
                    commit;
                    exception 
                       when others then
                         rollback;
                    --      test_proc2(update_dt)       --     want to call another procedure and want to pass that update_dt here ; this process will insert the update_dt into the message table    
                       commit; 
                     
            end loop;  
            
        end;
         
     
    
    My question is how do i pass value(update_dt) into the exception block or do i need to create any varaible ?? any idea 
    Thank you very much!!

    BTW, you can still use SQL % BULK_EXCEPTIONS even if you don't use EXCEPTION to LOG. You just can't use ORA-24381, since it will not be raised. Using SO many OTHER instead. And of course, there will be only one element in SQL % BULK_EXCEPTIONS:

    SQL> CREATE TABLE emp_temp AS SELECT * FROM emp;
    
    Table created.
    
    SQL> DECLARE
      2     TYPE empno_tab IS TABLE OF emp.empno%TYPE;
      3     emp_sr empno_tab;
      4     errors NUMBER;
      5     dml_errors EXCEPTION;
      6     PRAGMA EXCEPTION_INIT(dml_errors, -24381);
      7  BEGIN
      8     SELECT empno BULK COLLECT INTO emp_sr FROM emp_temp;
      9       FORALL i IN emp_sr.FIRST..emp_sr.LAST --SAVE EXCEPTIONS
     10         UPDATE emp_temp SET job = job || '_SR'
     11            WHERE emp_sr(i) = emp_temp.empno;
     12  EXCEPTION
     13    WHEN OTHERS THEN -- Now we figure out what failed and why.
     14     errors := SQL%BULK_EXCEPTIONS.COUNT;
     15     DBMS_OUTPUT.PUT_LINE('Number of statements that failed: ' || errors);
     16     FOR i IN 1..errors LOOP
     17        DBMS_OUTPUT.PUT_LINE('Error #' || i || ' occurred during '||
     18           'iteration #' || SQL%BULK_EXCEPTIONS(i).ERROR_INDEX);
     19            DBMS_OUTPUT.PUT_LINE('Error message is ' ||
     20            SQLERRM(-SQL%BULK_EXCEPTIONS(i).ERROR_CODE));
     21     END LOOP;
     22  END;
     23  /
    Number of statements that failed: 1
    Error #1 occurred during iteration #2
    Error message is ORA-12899: value too large for column "SCOTT"."EMP_TEMP"."JOB"
    (actual: 11, maximum: 9)
    
    PL/SQL procedure successfully completed.
    
    SQL> DROP TABLE emp_temp;
    
    Table dropped.
    
    SQL> 
    

    SY.

  • 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)

  • How to call another page and pass the page parameter to another page?

    Hi friends,

    I've finished a page based on the payment date, he turns the payroll, summarized in the table region. Now, I have to address in detail (submit) button, when click on the details button I want to open the new page, this page based on a few VO. This vo I spend 2 parameters, we're Person_id, and the second is pay date until we are on the front page.
    How to achieve this where I can write code, I am new to the OPS. could you please explain in detail and process?
    Thank you and best regards.
    Jocelyne.

    RAMU

    The value of your hashmap returns null. Let intrepret your code below

    String newValue = params.get("pid").toString();
                               null.toString(); will always throw null pointer exception
    

    Robichaud, I suggest you to always put some SOPS for debugging purposes. It is useful to locate the problem.

    Kind regards
    GYAN

  • [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

  • open and pass the value to the page 2 page 1 by region button

    Nice day

    I created 2 pages. I created a text element named p_employeeid on page 1 and a region with action button button redirecting to page 2. When I click on the button I can open page 2 but I can't filter records that only deals with p_employeeid. my source for the 2 page is select * from test_tbl where employeeid =: p_employeeid.

    Help would be really appreciated. Thank you.

    LUN

    example: apex.oracle.com

    workspace: nav
    username: Lun
    password: abc123

    example of application

    Page 1 = page 15
    page 2 = page 21

    on page 15, enter the value and click OK.

  • Submit the page and pass the value in both

    Hi all

    I have a tabular presentation on the EMP table. The SQL property of the form is:

    SELECT empno, ename, sal
    WCP
    WHERE deptno =: P0_DEPTNO

    On the form, I have three buttons labeled as dept10, dept20 and dept30. I want to achieve the following when I press a button:

    1. send the page.
    2. value of: P0_DEPTNO is set according to the key pressed.

    I am able to perform only one of the above, at the same time. How can I achieve both at the same time.

    I use Oracle 10 g with Apex 4.0.

    Thank you
    Zahid

    In fact, it would be cleaner to create a single post submit PL/SQL process as follows:

    BEGIN
    :P0_DEPTNO := CASE :REQUEST
        WHEN 'dept10' THEN value_for_dept10 button
        WHEN 'dept20' THEN value_for_dept20 button
        WHEN 'dept30' THEN value_for_dept30 button
        END CASE;
    END;
    

    Or if you want the name of the button to P0_DEPTNO, then just

    :P0_DEPTNO  :=  :REQUEST;
    
  • Pass the value to the process of request through javascript

    Hey everybody,

    I am currently struggling with the call to an application process and passing a value to it through javascript. Ideally, my javascript is triggered by a dynamic action, which itself is triggered when a user changes the value of a selection list. Below is the javascript code that is relevant:

    for (k=0; k<active_array.length; k++){
          var request = new htmldb_Get(null, &APP_ID., 'APPLICATION_PROCESS=CAL_COLORS', 0);
          request.add('x01', check_array[j]);
           var ajaxResult = ajax.get();
           alert(ajaxResult);
          active_array[k].parentNode.style.backgroundColor=document.getElementById('P14_TEST_COLOR').value;}
    

    And she calls the application process is also shown below:

    declare
    v_color varchar2(20);
    begin
    select color into v_color from cal_colors where other_user = apex_application.g_x01 and user_id = :USER_ID;
    :P14_TEST_COLOR := v_color
    end;
    

    The issue seems to be that online 03 my JavaScript, especially since my array element is not spent properly in my process. In an attempt to debug this, I added the alert message, however, instead of any relevant information, the alert shows just the HTML page! I'm at a loss as to what I'm doing wrong here, so if anyone has any input, I would very much appreciate it.

    Basically, you need to rewrite in the http buffer, using htp.p:

    DECLARE
      v_color VARCHAR2(20);
    BEGIN
      SELECT color
        INTO v_color
        FROM cal_colors
       WHERE other_user = apex_application.g_x01
         AND user_id = :USER_ID;
    
      htp.p(v_color);
    EXCEPTION WHEN no_data_found THEN
      htp.p('white');
    END;
    

    You could potentially make it much more efficient also. At the present time you loop on what is probably an array of elements, so from a tabular form probably. Rather than call an ajax for each line, you can group together them and make a call.

    Example:

    JS, you can use this to create an array with values to be placed on the server:

    var lArray = [];
    $("input[name=f03]").each(function(){
    lArray.push($(this).val());
    });
    

    And you can use the apex.server.process api to call a process on demand:

    apex.server.process("MYPROCESS", {f01: lArray}, {success: function(pData){console.log(pData);}})
    

    As you can see, the table with the values is put in the table in the f01. You must use the option of success well since it will be asynchronous (htmldb_Get.get is a synchronous call).

    With respect to the CLASS code:

    DECLARE
      l_return VARCHAR2(4000);
    BEGIN
      FOR i IN 1..apex_application.g_f01.count
      LOOP
        l_return := l_return || '"VALUE' || i || '",';
      END LOOP;
    
      l_return := RTRIM(l_return, ',');
      IF l_return IS NOT NULL THEN
        l_return := '[' || l_return || ']';
      END IF;
    
      htp.p(l_return);
    END;
    

    It will loop through the items in the table-f01 and build a new JSON notation and write it back to the http buffer so it returns to the client. It will look like this:

    ["VALUE1", "VALUE2", "VALUE3", "VALUE4", "VALUE5", "VALUE6", "VALUE7", "VALUE8", "VALUE9", "VALUE10"]
    

    I say this because when users use your application, you do not want such a quantity of calls. A single call by treatment action would save a lot of resources. You may have to loop twice on your items to apply your backgroundcolor, but I don't voluntarily not too mention jQuery since you is perhaps not familiar with it and get scared by him.

  • How to pass the value of the item Application Javascript function.

    Hello

    I have the JavaScript in the properties attribute of the HTML Form element

    I'm on page 1 and passing the value of the item page P1_DEPT_NO. It is perferctly working very well and I am able to get the exact value of the element on the page
    onchange="javascript:function1($x('P1_DEPT_NO').value);"
    I'm on page 1 and passing the value G_DEPT_NO of the Application element .
    The problem here is, I don't get the point of Application inside the javascript function value.
    I tried to use alert(); and it gives me the undefined value
    onchange="javascript:function1($x('G_DEPT_NO').value);"
    I just want to know, How to pass the value of the Application in Javascript element.

    Thank you
    Deepak

    Deepak,

    I'm not a Javascript expert, but the suggestin I did was because the javascript is a case-sensitive... language and thats why onChange is not the same thing as onchange.
    Not sure if this is causing the problem.

    Application elements not associated with a page and have therefore no properties user interface.
    So, as mentioned in another post, the rendering would not work for the elements of the application.
    If it is for a single item, used only on this page, you might create a hidden page element and use it fo your goal

    If you want to keep watching objects application and AJAX, this page contains examples of using AJAX to solve problems like the one you mentioned.
    http://www.Oracle.com/technology/OBE/hol08/apexweb20/ajax_otn.htm#T1B

    Thank you
    Rajesh.

  • How to pass the value of the element where to call a procedure

    Hello
    I tried to display an image blob by calling a procedure
    It's working if I hardcode the parameter, for example < img src = "#OWNER # .download_my_file?" P_ID = 1 & p_picture = 1' height = 60 width = 40 line >
    But if I pass the value with values of point page p_id < img src = "#OWNER # .download_my_file?" "p_id =: P_ITEM_ID & p_picture = 1 ' height = 60 width = 40 line >
    the image appears... Is there something wrong with my syntax?

    Thank you

    Vincent

    Try

    Scott

  • Waterfalls by passing the value between QML

    Hi, I have the main.qml with a display list, on, click on any element of the display of the list, I want to pass the value to another QML which is a leaf to change or remove, I followed what is on the tutorial to use the alias property to the second page to set the alias for the fields that I want to access another page and have the main.qml to create the object in the worksheet and assign value and open. Right now, it's say those alias not found. Here is the excerpt code sheet QML import bb.cascades 1.0 sheet {id: content newEventSheet: Page {id: addEventPage... eventNameText.text = ' '; eventTimePicker.value = eventTimePicker.dateFromTime("00:00:00"); newEventSheet.close (); mainObj.addData (eventName, selectedHour, selectedMinute, selectedSecond);}} Container}}} {layout: StackLayout {orientation: LayoutOrientation.TopToBottom} container {container {layout: StackLayout {orientation: LayoutOrientation.LeftToRight} leftPadding: 20.0 topPadding: 50.0 bottomPadding: 50.0 Label {text: preferredWidth 'Event name': 200.0} TextField {property alias txtEventName: eventNameText id: eventNameText hintText: preferredWidth 'Enter event name': 500.0}} container {layout: StackLayout {orientation: LayoutOrientation.LeftToRight} leftPadding: 20.0 Label {text: preferredWidth "Event time": 200.0} DateTimePicker {property alias pickEventTime}}} {{: eventTimePicker id: eventTimePicker mode: DateTimePickerMode.Timer minuteInterval: 1 preferredWidth: 500.0 onValueChanged: {}}} hand QML Container {id: eventListContainer ListView {id: eventList dataModel: eventsModel / / use a ListItemComponent to customize the appearance of the list function itemType view (data, row) {console.log ("Calling itemType:" + row);}}} return "item"; return (indexPath.length == 1? ("head": "item"); } listItemComponents: [ListItemComponent {type: 'the point' StandardListItem {title: "event:"+ ListItemData.EventName; "}}] Description: "time:" + ListItemData.EventHour + ":" + ListItemData.EventMinute + ":" + ListItemData.EventSecond ;}}] "." onTriggered: {console.log ("Calling onTriggered:" + row);} var selectedEvent = dataModel.data (row); var eventDetailPage = eventDetailDefinition.createObject (); eventDetailPage.txtEventName.text = selectedEvent ['EventName']; eventDetailPage.pickEventTime.value = picker.dateFromTime(selectedEvent["EventHour"]+":"+selectedEvent["EventMinute"]+":"+selectedEvent["EventSecond"]); eventDetailPage.open (); }} the device connect by default to the 14:44:50.432 com.example.IntervalTimer1.testDev_ervalTimer1a7a2c2e2.11214974 may 28 9000 REVIEWS asset:///main.qml:122: TypeError: result of expression 'eventDetailPage.txtEventName' [undefined] is not an object. Can someone help me? Thank you

    Have you tried to put the alias property in the root of the sheet in the TextField?

  • How to pass the value of a column to a variable to be used in another analysis

    Hello

    I'm on OBIEE 11.1.1.7.1.

    I have the following problem.

    I have DISCOVERED called analysis. It has just a column with the result. Simple. Assume that the answer is 2500

    I have another scan which has two other columns, namely GOLD and LOANS. I want to calculate the total DISCOVERED + GOLD + READY.

    That's why I need to pass the value of 2500 of the first analysis of the second analysis via a variable.

    I can not add all three of them in the same analysis there are various filters for OVERDRAFT, and the application of these filters on the GOLD and LOANS gives the desired result. I tried to add filters in the column of the overdraft, but that doesn't seem to work.

    Any help will be greatly appreciated.

    I'll give you an example. I hope that you will mark for my time...

    Hope that you will be aware of how to combine a similar request.

    in the first criterion you have

    Goldprice Loanamount year 0

    Second criterion

    Year 0 0 Overdraftamount

    the two maintain the necessary filters.

    Add a column of result (option you can see in the topic area pane) that add all three columns. You can choose the columns. formula will come something like below

    saw_1 + saw_2 + saw_3

    Thank you

    AJ

  • How to pass the value of the run-time file .sh by Oracle procedure

    I have a file test.sh that contain

    #1/bin/bash

    exp test/test@orcl file=/home/oracle/dump/test.dmp log=/home/oracle/dump/test.dmp grants = Y = index constraints Y = Y = (test) owner statistics = none

    Exit 0

    I craete a work called Create_job_proc in this work, I want to pass the value of job_action is the location of the file test.sh to

    /U01/home/Oracle/dump/test.sh and want to spend the test/test@orcl as a variable...

    Please suggest me... how to pass the value of Job_Action which will replace the .sh file content test/test@orcl to the value of the time of execution as scott/tiger@hr

    Thank you much Parth... It works perfectly...

    Thank you all for your help...

  • Pass the value modal page using static URLS

    Hi guys,.

    I have a simple page with three boxes.

    When one of the check boxes is selected, I want to draw a new page which I use as a modal page (SkillBuilders Modal plug to help).  I need to pass a value of a checkbox (P1_WTD_OPT_OUT) in the new modal page.

    I have the following in the static URL

    f? p = & APP_ID.:2: & APP_SESSION.:2:P2_WTD_ID, P2_WTD_OPT_OUT: & P1_WTD_ID, & P1_WTD_OPT_OUT. :

    where I'm moving the value of P2_WTD_OPT_OUT to P1_WTD_OPT_OUT.

    As I don't submit anything when the check box that calls the modal page is checked, how I would pass the value in the modal page?

    At the moment, if P1_WTD_OPT_OUT is enabled or not, P2_WTD_OPT_OUT is always null when modal page.

    I use apex v4.0

    Any help would be great,

    Thank you

    Here is what goes wrong:

    -page is first rendered, P8_WDT_OPT_OUT is NULL

    -the static url for the modal lov is generated. Given that the item is NULL value in the url for the P9_WDT_OPT_OUT point shall be void in this url

    -l' change event fires. The P8_WDT value is stored in session state

    -the modal opens and navigates to the static url

    End result is that the P9 indeed will be null.

    The solution to this is to not not to set the value of the item through the URL, because it will simply not work. But given that the element of P8 is located in session state, you can use the value of it to the default value of the element on P9.

    On page 8, I changed the dynamic action to not set the value of the element in the URL, and on page 9 I changed the default value of the element.

  • ODI 11 g | Passing the value of the variable ODI option procedure

    Hi Experts,

    I need to pass the value of the global variable / project to an option of the procedure and in the application of the procedure to retrieve. Procedure will be implemented in jython.

    How can I pass the value of the variable option procedure ODI & then retrieve it in the jython script?

    Model data source is the flat file based & I want to retrieve the location of the source directory using jython/java (must implement an on file preprocessing step before calling the interface to load). Is there an ODI API to retrieve the location of the source directory?

    Thank you
    Ashish

    The reason OdiGetOption won't work because odigetoption running will search for the name of the variable where like everything using the execution variable will look at the value of the variable.
    In order to manage your situation i belive, we can establish by using the combination of getoption and global variable using the if condition

    You can write code something like that
    If odigetoption == 'dat ':
    ctrlfileExt = #v_CtrlFileExt
    If odigetoption == "txt":
    ctrlfileExt = #v_CtrlFileExtTxt

    This way, when you call the procedure, you can supply the value of the extension and procedure will use the right variable and the value.

    I hope this helps.

Maybe you are looking for

  • Recovery 1105 satellite question-

    Ran the recovery (set of three) and full cd to the Windows XP screen, however, no prompt appears to reinsert the CD n ° 1, which I suppose that contains the OEM operating system and now the laptop starts with the XP logon screen but not further.

  • HP 15 r014tx: réadapta

    I m facing the incomplete restoration after frm recovery disc factory reset. WHT should I do please suggest a method

  • Satellie L40 PSL48E - 14N takes the graphic driver XP instead of Vista driver

    Hi all The BIOS of this PC is supposed to be able to boot from USB. I installed Vista (ugh) on a disc. This disc has been in the PC to do the installation.I then removed the player from the PC equipped with another drive to the PC and installed XP (m

  • IME (Input Method Editor) keeps crashing my applications (in particular, subject to typing Chinese (Taiwan))

    Question:Until recently, the IME (Chinese - Taiwan) worked perfectly for me, but yesterday when I was using it to type Chinese, it crashes my applications when I use it (eg. when I tried to type Chinese in Skype, Skype crashed. In IE, IE crashed, in

  • Recovery of the laptop is not

    I recently had a problem with my HP ENVY 15 TS and use the support chat in the HP Support Assistant, I was advised to do a system restore. This did not succeed, and I am now stuck in a loop! No idea how I get in touch with the agent who dealt with me