6 Replies Latest reply: Mar 11, 2014 10:04 AM by bsalvador RSS

    Get tabular form item value

    bsalvador

      Hi all,

       

      I´m working with 4.2 apex version. I have a report like a tabular form, where I can enter values:

      Look the sql report:

       

      select code,

             month,

             htmldb_item.text (3,valor,10) value

      from dual

       

      This sql return:

       

      code    month     value

      1       January    500,00

      2       February  100,00

      3       March       50,00

       

      After, I have a button to execute a procedure. So, my question is: how can I pass value to procedure?

       

      I tryed something like:

       

        FOR i IN 1 .. apex_application.g_f03.count LOOP

        procedure_x(apex_application.g_f03(i));

         END LOOP;

       

      But it doesn´t work. apex_application.g_f03.count brings 0 rows when I print the value.

       

      thanks

       

      Bsalvador

        • 1. Re: Get tabular form item value
          AlexAA

          Hi, bsalvador

           

          Please, clear some details:

          • Do you have standart tabular form?
          • Code what you show (select code, monh ....) can't be executed and will not return any data
          • What action executed when you press a button? How you call a procedure?
          • 2. Re: Get tabular form item value
            bsalvador

            Hi AlexAA,


            Sorry, I will explain better.

             

            • I have an Interactive Report, where I modify the query to enter values: htmldb_item.text (3,valor,10) value
            • This query is only an example to see how I modified the column "value". You can ignore "from" clause ok?
            • When I press the button, I execute a Dynamic Action calling an "Execute PL/SQL code".

             

            Thanks in advance!

             

            Bsalvador

            • 3. Re: Get tabular form item value
              Nicolette

              Bsalvador

               

              When I press the button, I execute a Dynamic Action calling an "Execute PL/SQL code".

              This is the problem. Column values don't get submitted when running a Dynamic Action calling an "Execute PL/SQL code".

               

              Turn your pl/sql code into an ondemand process by creating a pl/sql process with the processing point ondemand.

              Then the dynamic action should be a "Execute javascript"

              With code that looks like

               

              var lData ={
              f01 : get_value_array('f01'),
              f02 : get_value_array('f02'),
              f03 : get_value_array('f03')};
              apex.server.process('return_full_name'
              ,lData
              ,{success:function(pData){ alert(pData);},
                dataType:'text'
              }
              );
              

              Where get_value_array is:

              function get_value_array(pColumnName) {
                var l_values =[];
                apex.jQuery('[name="'+pColumnName+'"]').each(
                 function(){
                  var l_value;
                  l_value = apex.item(this.id).getValue();
                  l_values.push(l_value);
                 }
                );
                return l_values
              }
              

              This submits the values of all the 3 columns mentioned.

               

              In this demonstration the above code is just to display an alert with the emails of the persons in the report.

              It also has some more information about apex.server.process

               

              Nicolette

              • 4. Re: Get tabular form item value
                bsalvador

                Hi Nicollete,

                 

                My PL/SQL is something like:

                 

                for i in 1 .. apex_application.g_f01.count loop


                procedure_xx(apex_application.g_f01(i),apex_application.g_f02(i),apex_application.g_f03(i), :P21_XXX);


                end loop;


                You told me I have to put this PL/SQL into an ondemand process..

                Turn your pl/sql code into an ondemand process by creating a pl/sql process with the processing point ondemand.

                How to do it? I have to create a page process PL/SQL?

                I don´t know how to send the information I got with javascript, to my PL/SQL procedure. Could you help me please?

                 

                Thanks

                 

                bsalvador

                • 5. Re: Get tabular form item value
                  Nicolette

                  bsalvador

                   

                  Yes an ondemand process is a page process that has the special processing point On Demand - Run this process when requested by AJAX'.

                  In the page tree view you find the process under AJAX callbacks. Changing the processing point of your existing process would do it.

                   

                  I don´t know how to send the information I got with javascript, to my PL/SQL procedure. Could you help me please?

                  Can you follow what the javascript code that I have provided in the previous post is doing? Because that code does exactly that.

                   

                  The function get_value_array adds all the values of the column to an array.

                  That array is then added to the l_data object. And the l_data object holds all the data that will be submitted.

                  The options(third) parameter of apex.server.process tells that the information that is returned is of type text. And if the ajax code is done successfully to display the returned data in an alert.

                  The first parameter is the name of your pl/sql process that needs to run.

                   

                  Nicolette

                  • 6. Re: Get tabular form item value
                    bsalvador

                    Hi Nicolette, I still trying to insert the value of my report into database, and I find something strange.

                     

                    When I inspect html, it returns something like:

                     

                    <input type="text" name="f03" size="10" maxlength="2000" value="">

                     

                    where "value" is null. But I put the value into my report column whose based on (select htmldb_item.text (3,valor,10) value from xxx).

                     

                    If somebody could help me, there is an example here:

                     

                    http://apex.oracle.com/pls/apex/f?p=4550:1:0:::::

                     

                    workspace: COSTS

                    username: GUEST

                    password: 123456

                    Run Page 4 - Apex Process

                     

                    When run page 4, put a value into January and February and click on "Insert".

                    It would insert cod and value into process_test table.

                     

                    Thanks.

                     

                    Bsalvador