can the dynamic action call function already?

I have a dynamic action that keeps a total on the screen for two columns of numbers.

Now I need to have a total cumulative where X column > column Y. I don't know if I can do that in an expression javascrip t. I had hoped to call a JavaScript function that returns the value... but the function does not return anything right now.


This could be a thing of syntax sillly - I hope so, but before you spend more time looking for in this I but I would like to ask - is it still possible?

Assuming that column1 is apex global table 1(name=f01) and column 2 picture 2 (name = f02).
Name of the item page that show the total operation: P100_TOTAL
Dynamic action
Event: change
Triggered by: jQuery selector
selector: * input [name = f01], input [name = f02] *.
Event type: javascript

var total = 0;
/* Go up untile report table */
var this_table = $(this.triggeringElement).parents('table:first');

/* Loop through each report row */
this_table.find('tr').each( function(){
var colX = ( $(this).find('input[name=f01]').val() == ' ') ? 0 : parseFloat(parent_row.find('input[name=f01]').val() );
var colY =  ( $(this).find('input[name=f02]').val() == ' ') ? 0 : parseFloat(parent_row.find('input[name=f02]').val() );
/* Add colX if its greater than Y */
if ( colX >colY)  {
   total += colX;
  }
}
 /* Assign Page itme with total*/
$s(' P100_TOTAL',total);

Tags: Database

Similar Questions

  • Dynamic action calling JavaScript with parameters

    I have a DA who called some JavaScript to Hide/Show/cancel 2 P110_PARENT_SOLUTION_ID text elements, P110_ANSWER_TEXT be part of radio P110_DIRECTORY_TYPE.

    DA > settings > Code:

    If ($v ("P110_DIRECTORY_TYPE") == 'R') {}

    $("label[for=P110_HEADER_TEXT]").text ("name of the root directory")

    $x_Hide ('P110_PARENT_SOLUTION_ID');

    $x_Value('P110_PARENT_SOLUTION_ID',"");

    $x_Hide ('P110_ANSWER_TEXT');

    } ElseIf ($v ("P110_DIRECTORY_TYPE") == 'E') {}

    $("label[for=P110_HEADER_TEXT]").text ("header text")

    $x_Show ('P110_PARENT_SOLUTION_ID');

    $x_Show ('P110_ANSWER_TEXT');

    } ElseIf ($v ("P110_DIRECTORY_TYPE") ==' no) {}

    $("label[for=P110_HEADER_TEXT]").text ("directory name")

    $x_Show ('P110_PARENT_SOLUTION_ID');

    $x_Hide ('P110_ANSWER_TEXT');

    $x_Value('P110_ANSWER_TEXT',"");

    }

    This works perfectly, however I need to reproduce this code for 2 more areas on the same page. To do this, I created a JavaScript function with 3 parameters and call it in the dynamic action

    Page header > Javascript > function and Global Variable declaration:

    function ProcessDirType

    (I_DirectoryType

    I_ParentSolutionId

    I_AnswerText

    )

    {

    If ($v (I_DirectoryType) == 'R') {}

    $("label[for=P110_HEADER_TEXT]").text ("name of the root directory")

    $x_Hide (I_ParentSolutionId);

    $x_Value(I_ParentSolutionId,"");

    $x_Hide (I_AnswerText);

    } ElseIf ($v (I_DirectoryType) == 'E') {}

    $("label[for=P110_HEADER_TEXT]").text ("header text")

    $x_Show (I_ParentSolutionId);

    $x_Show (I_AnswerText);

    } ElseIf ($v (I_DirectoryType) ==' no) {}

    $("label[for=P110_HEADER_TEXT]").text ("directory name")

    $x_Show (I_ParentSolutionId);

    $x_Hide (I_AnswerText);

    $x_Value(I_AnswerText,"");

    }

    }

    DA > settings > Code:

    ProcessDirType

    ("P110_DIRECTORY_TYPE"

    , "P110_PARENT_SOLUTION_ID".

    , "P110_ANSWER_TEXT".

    );

    Her DA stopped working correctly, I tried to replace the parameters with single quotes but not joy.

    Can someone give me the correct syntax so that I can make my code more generic and call in three different DA?


    Concerning

    ADE

    I didn't think there would be syntax errors, everything looks good from here. Single or double quotes can be used.

    Maybe it's something to do with the way in which the dynamic action is called. Is what event listening? Nothing has been changed in order to manage several regions?

    You can add this sort of thing to your javascript to help determine what is invoked and view the output in the javascript console.

    console.log('I_DirectoryType:'+I_DirectoryType);
    
  • Redirect button AND perform the dynamic action

    Hello

    I use Oracle 11 g and Apex 4.2.2

    It could be a matter of beginners (but that's what I'm ;-)) but I'll ask anyway.

    I created a button and can "redirect to the Page in this application" in the section "Action when the button clicked" or select "defined by the dynamic Action."

    Is there a way to select "Redirect."... "AND run the SQL Code?

    This is exactly the situation that I was considering. You start at the apex (which means don't not offensively or anything like that) and so the concept of session state can still be fresh for you. Telling me where you're just complicates things for yourself.

    Why do you, or makes you think, that you need to run plsql in dynamic action first and then redirect the page?

    Running code plsql already involves tracking session state and would require the value of the required items on the server. Running WHAT PLSQL is on the side server, if a call should be made. Given that you want to redirect afterwards, the call should happen synchronously, IE make the browser wait the result in order to continue to the next step. A redirect will just tell the server to send the new page to you.

    So why would not just use a send page? A page sent will submit all values of item on the server and thus session state. You can use the values of calculation and validation processes and never worry about having properly put it. You can filter out inappropriate process etc. According to the values of query (for example submit) so no problem there. Finally, a branch should redirect you to the target page. Remember, a branch is a part too and is essentially a redirect server-side. Find yourself on your new page without problem really and just send 1 page (send page, get another back essentially).

    That said, I simply don't consider a dynamic action. It is useless to laregely here and creates more problems than is useful to review more.

    What you have now is to redirect the client to another page, but in the process, you have lost everything from the original page. No values are stored in the session to all State: no save manual to submit State or session page. Add the element to the redirect link doesn't work either, as the link is built during rendering and is not dynamic (so no ' regenerated' link when you click it).

    Again, I advise you to:

    -put the button to send the page

    -create a process after you submit and run your plsql code

    -create a branch to a point after the process and set it to redirect to the target page

    or

    -put the button to send the page

    -create a branch set up to redirect to the target page

    -create a process on the target page and run your plsql code (but be aware that it may have to be executed conditionally)

    There are several traps on session state, so when you feel better grasp it. Page submits are not all that bad.

  • The dynamic action of javascript

    Hello

    Good evening.

    I am aware, that we can trigger dynamic actions in multiple ways, based on events of the DOM.

    can someone help me triggering a dynamic javascript action.

    But not based on events.

    Ex: name action dynamic, based on its name or sequence or in any other way.

    There are situations where I have to call dynamic measures to avoid hand-written Ajax calls.

    Thanks in advance

    Hello

    The correct answer to this post:

    Not sure why the following code lines failed to trigger a dynamic action

    $("#P0_SIGNAL").val (123) .changes (); --Also failed
    $("#P0_SIGNAL").trigger ("change");  --Also failed

    This line would trigger a dynamic javascript action.
    Apex. Event.Trigger ($("#P3_TEST_ID"), "change","" ");


    Steps to make it work.


    I need to trigger a dynamic action when a value is set to hidden JavaScript element


    P3_TEST_ID is a hidden item.

    Create a dynamic action to shoot the P3_TEST_ID change event.

    Setting the value of p3_test_id of javascript wouldn't trigger a dynamic action.

    Run the following code to fire the javascript DA

    Apex. Event.Trigger ($("#P3_TEST_ID"), "change","" ");

  • Can a dynamic action of type 'alert' display a value of field without javascript?

    Hello

    can a dynamic action of type 'alert' display a value of field without javascript ( alert ( $x (P '200_OP').value)); ?

    What should I write in the 'text' section to display in the alert, the value of P200_OP for example?

    Gianpaolo cordially

    Hi gianpagi,

    gianpagi wrote:

    I know that with "run JavaScript Code" works. My question is about action as 'alert '.

    Dynamic action "Alert" is expected to this only the string to display in the alert. May not be able to access the current value set in a page element.

    Therefore, "Run the Code JavaScript" only works in this case where your can integrate the current values of the DOM html elements

    If you notice that da 'Alert' request 'Text' and 'Execute JavaScript Code' DA 'Code' request to be executed.

    Kind regards

    Kiran

  • Redirecting to a page after the dynamic action

    I stated a dynamic action of a button (its dynamic action of pl/sql). After its been pressed it fills a line in a table.

    I want to redirect it to another page, once completed the dynamic action. How can I do?

    PL/SQL D.A. have an indicator expected result, make sure that is selected.

    Then, action of true of JavaScript:

    Window.Location.href = ' & APP_ID.: 1: & APP_SESSION. :::'

    or simply add a real action of page submit and manage the re - run by a branch of the page?

  • Navigation of the page with the dynamic action button.

    Hi all

    I use apex 4.2.6 on windows 8.1

    I create a button with the dynamic action.

    When the end user, click on the button, I want to access a page.

    How to do this?

    I created a branch of this button to access the page 10 on SUBMIT AFTER TREATMENT CALCULATION VALIDATION.

    but no navigation happens.

    they code plsql works well that is put into the dynamic action, but the page is not navigate.

    kindly guide me.

    Kind regards.

    Maahjoor wrote:

    I create a button with the dynamic action.

    When the end user, click on the button, I want to access a page.

    How to do this?

    I created a branch of this button to access the page 10 on SUBMIT AFTER TREATMENT CALCULATION VALIDATION.

    but no navigation happens.

    they code plsql works well that is put into the dynamic action, but the page is not navigate.

    If you want to run the PL/SQL code and creates a branch to another page, why do you use a dynamic action? The easiest way to do this is the button send page, the PL/SQL to run as a process after submit (potentially conditional, click on the button) and the page navigation to achieve using a plug (once again, perhaps conditional on the button that is clicked).

  • Confirm the dynamic action does not not as expected in the APEX 4.2.5

    This looks like a bug in APEX 4.2.5.  I have a page with a "Cancel" button that redirects to another page.  There is a dynamic action that fires on the button with a confirmation action and the text ' are you sure?  However, if the user selects OK or cancel in the confirmation dialog box makes no difference - the redirect is always performed.

    I found this question after the migration of a page that worked to 4.1.1-to-4.2.5.00.88 APEX and were also able to replicate on apex.oracle.com here:

    https://Apex.Oracle.com/pls/Apex/f?p=19896:2

    (Press the Cancel button in the top right of the page redirects to page 1, regardless of the user's response to confirm the popup.)

    I don't need someone to suggest the alternative code, I know how to build my own confirmation processing.  I want to just raise this as a bug as possible and see if there is a solution to make the dynamic action works as it should.

    NB I found this in the patch notes for 4.2.5.00.88 on a fix for a similar problem:

    http://www.Oracle.com/technetwork/developer-tools/Apex/application-express/Apex-425-patch-set-notes-2186274.html

    15984978

    Dynamic action front-Submit with a confirmation message does not

    Hi Tony,.

    I think the problem is that the action of the button is defined as 'Redirect page in this Application', but it must always be "defined by the dynamic Action" as soon as you have set dynamic actions 'click' to a button. Normally, which is automatically changed as soon as you create your first dynamic action of a button, and I just confirmed by creating a test button in your application that has been defined as «Redirect...» ». After that I created a dynamic action the action of the button is set to "defined by the dynamic Action.

    Is it possible that you have modified the action of the back button to «Reorient...» » ? The question why «redirect...» "does not work, it's that we cannot guarantee in what order the browser will process click on events defined with onclick in the tag button itself and those events attached as a click event handlers. This is why it is necessary that everything is defined as dynamic actions. Only in this case you will be able to cancel the treatment.

    Concerning

    Patrick

    Member of the APEX development team

    My Blog: http://www.inside-oracle-apex.com

    APEX Plug-Ins: http://apex.oracle.com/plugins

    Twitter: http://www.twitter.com/patrickwolf

    Post edited by: Patrick Wolf

  • Cannot perform the insert/update on the form of tables, due to the dynamic action

    Hi all

    I created a dynamic action that calculates multiple cells in a table.

    This feature works well, when I change the value of the associated cell then the computed value is changed by the dynamic action.

    But I am not able to insert or update the line in a table when the dynamic action is enabled. When I put the condition 'Never', then the line is inserted or updated without any problems.

    All guess where is the problem?

    Apex version: 4.1.1.00.23

    Jiri

    Nina wrote:

    I don't know why the 123,40 value (or other) is set to the next item in line (f09, fsc, etc.)
    >

    What is hidden and generated Apex elements are always included in the last cell (td) of the line. Thus, it has nothing to do with the next item, only the last cell.
    If you see the last cell of the 888 Page you will see probably the same type = "hidden" entries here also.

    Your problem is not related to the HTML fragment to the last cell in the row showing all those extra items, it's somewhere else.

    Oh, here comes the jQuery selector:

    var clickedRow = $(this.triggeringElement).closest('tr');
    
    $(clickedRow).children('td[headers="SAL"]').find("input").val(myCalculatedTotal);
    

    SAL, COMM, w/e. here you will find the TD with headers = "COMM" and all the input fields and the value of all the entries in total calculated. Your selection is not precise enough in this case.
    So, target the specific entry.
    With the code example:

    
    
    
    
    
    
    
    
    

    change the switch on

    $(clickedRow).children('td[headers="SAL"]').find('input[name="f08"]').val(myCalculatedTotal);
    
  • Call the dynamic Action of the link

    Hi guys,.

    I'm sure that there is a super easy way to do it and I'm missing the obvious.

    All I want to do is call a DA for a HTML link, is it possible? Call the function DA like I do with JS?


    Help, please.

    Thank you

    Spam

    Hello

    I do the following to call a DA my link of the report column.

    1. in the link attribute, set the following parameters:

    onclick="return false;" class="my_link_class";
    

    2. in DA, set the 'event' that ' click on ', 'Selection of the Type' "jQuery Selector". "JQuery Selector", enter the name of the class (with the dot) as:

    .my_link_class
    

    You can then define your actions of true/false in the DA.

    Thank you
    Rohit

  • How the dynamic Action to update several items based on a JavaScript Expression producing a table?

    Using APEX 4.2.

    I have the list of selection using a LOV which returns a display value and a value separated by a comma e.g. return 'reserved to items' and "66,88" or "Available items" and "90,23".

    I want that return values for example "66,88" to be assigned to two my form fields.

    I have a dynamic action that fires when the field with the changes of the list/select-LOV. I am using an action of 'Set value' and set 'Expression JavaScript' with the expression itself type value ' $v("P1_MY_SELECT_LIST").split(",") and using Type "Article (s)' selection and listing the two points that I want to set as the items in question (from the description of the JavaScript expression field it appears that a table of the results would be assigned to the changed items , in the order.

    However, the original value of the LOV return value is passed to the first of the elements concerned (complete with the comma if the original return value was of the form '10')

    If I add more REAL action of the JavaScript "alert (" HELLO "+ $v ("P1_MY_SELECT_LIST") .split (", ") [0] +" WORLD "+ $v("P1_MY_SELECT_LIST").split (", ") [1]" ") I * see two expected values.»

    Any ideas what I could do wrong?

    The action 'Set value' affects the value specified to all affected elements: a value to one or more items. To set a different value at different points, you need several actions "Set value", or simply use javascript to do it in one.

    Even if you use a javascript expression that corresponds to a table, the table is just being converted to a string again. It creates a mapping of some sort. That is why for example with '10', she also translated as such. Actually you set this value to these two elements: ' 10, ".split(",").toString () (implicit in the chain of course).

    The code makes it very obvious that it doesn't handle values, as described in the help of the element. Aid is not correct or is the implementation simply not here yet?

    Just look at the javascript for dynamic actions, images/libraries/apex/dynamic_actions.js, service da.setValue directory file:

        function _setValue( pValue ) {
            lAffectedElements$.each( function( i ) {
                // Set all affected elements to the value passed
                $s( this, pValue, null, lSuppressChangeEvent );
            });
            /* Resume execution of actions here and pass false to the callback, to indicate no
            error has occurred. */
            da.resume( lResumeCallback, false );
        }
    

    And when you use a javascript expression:

        } else if ( lSetType === "JAVASCRIPT_EXPRESSION" ) {
            _setValue( lJavaScriptExpression.call( this ));
    

    It's pretty simple. (and this is checked on apex 5. It's the same on 4.2)

  • Can the 'scan to email' function work with Windows Vista?

    I would like to install the 'scan to email' function with my HP Pavilion dv4 laptop using Windows Vista.  Can it be done?  If so, how do I configure it?  Thank you.  Judy

    Thanks for your reply.  It turns out that I needed to download the Officejet 6500 Wireless on my PC software to operate.  I couldn't use the software that was already loaded laptop from my husband, who works in Windows 7.  If I had the software on my desktop computer, your instructions likely would have worked.  I appreciated you taking the time to answer.

    Judy

  • With the help of JavaScript condition in the dynamic action of JQuery selector

    Hi guys,.

    I have a Setup master detail on a page.

    The detail section, I have a tabular presentation.  One of the fields is a selection list.  The first record in the select contains the value * not * that has a value of primary key for the 1.  I have a distinct region with a simple text field where the user can insert a value into the table if the value does not exist.

    I want than the region of text element to only appear if the value * not listed * is selected.

    I managed to make it work when the value is selected with the help of dynamic action with a bit of JQuery and JavaScript by setting the ID on the selection list to 'create' and have the following in JavaScript $(this.triggeringElement) .val ()! = 1 in the JavaScript for dynamic action condition shows it or hides the region of 'create' and that works well.

    However, if the secondary table is empty before the detail records were created (nothing selected in triggering jQuery Selector) the region of create is displayed when I don't want it.

    I guess I need some sort of NVL in JavaScript condition?

    I use APEX v4.2.

    Any advice would be appreciated.

    Chris

    Cashy wrote:

    I have a Setup master detail on a page.

    The detail section, I have a tabular presentation.  One of the fields is a selection list.  The first record in the select contains the value * not * that has a value of primary key for the 1.  I have a distinct region with a simple text field where the user can insert a value into the table if the value does not exist.

    I want than the region of text element to only appear if the value * not listed * is selected.

    I managed to make it work when the value is selected with the help of dynamic action with a bit of JQuery and JavaScript by setting the ID on the selection list to 'create' and have the following in JavaScript $(this.triggeringElement) .val ()! = 1 in the JavaScript for dynamic action condition shows it or hides the region of 'create' and that works well.

    However, if the secondary table is empty before the detail records were created (nothing selected in triggering jQuery Selector) the region of create is displayed when I don't want it.

    I guess I need some sort of NVL in JavaScript condition?

    I use APEX v4.2.

    Simple solution is to hide the region containing the element of text by default, using the style = "" view: no ' in the property of the attributes of the area in the region. " It will be always hidden when the page initially, but its visibility will be controlled by the DA subsequently.

  • Validation against the dynamic Action

    Hi all

    I have a Submit button which is dynamic in Action, when we click on this button, that pl/sql code is executed.

    Also, I wrote a validation on text box saying that it can not be null. But when I press Submit button dynamic action only to run but not Validation.

    Here is the page, it includes two regions, first region button does not have a dynamic Action, so it is prompting validation error, where, as the second region button is not. Help, please

    https://Apex.Oracle.com/pls/Apex/f?p=9055:2:3349793619276:

    Workspace: KUMAR82

    User: Kumar62

    Pass: Kumar #1

    Thank you

    Kumar.

    Hi Kumar62,

    Kumar62 wrote:

    I have a Submit button which is dynamic in Action, when we click on this button, that pl/sql code is executed.

    Also, I wrote a validation on text box saying that it can not be null. But when I press Submit button dynamic action only to run but not Validation.

    Here is the page, it includes two regions, first region button does not have a dynamic Action, so it is prompting validation error, where, as the second region button is not. Help, please

    Check your 9055 Application-> Page 2. Your problem is solved for the button 'submit for approval '.

    Here are the changes made on page 2:

    • Added real action in your dynamic action to send the page with the query 'SUBMIT' with the following settings:

    Action: Send the Page

    Application/button name: SUBMIT

    See the process facility: No.

    Note: Postings are only performed after the page. The release of DA button was running just your logic, but in order to process the postings you submit page.

    • Changed condition for validations:

    Condition of removed the "when Button Pressed" and game

    Condition type: request = Expression 1

    Expression 1: SUBMIT

    Kind regards

    Kiran

  • A collapsible region with the dynamic Action of the collapse

    Hi all

    in my Apex 5.0 - application, I have a button that shows a masked area when you press. I wish also that the current developed a collapsible area collapse when this button is pressed. Since collapse a collapsible region is not native as a dynamic action I must find a custom way (JavaScript) to do. Anyone know the best way to do this?

    Kind regards

    Arjan

    Hi Sunil,

    Thanks for your reply. I already found a solution, just a JavaScript code very simple:

    document.getElementById("div1").classList.remove("is-expanded");

    document.getElementById("div1").classList.add("is-collapsed");

    Thanks anyway!

    Best regards, Arjan

Maybe you are looking for