This discussion is archived
11 Replies Latest reply: Jan 10, 2013 10:36 AM by NewApexCoder RSS

Multi Row Update

NewApexCoder Newbie
Currently Being Moderated
I am trying to mimic the Multi Row Update process to a tabular form while adding a slight twist. Lack in understanding is killing me. There are a couple parts involved.

Scenario:
I have a tabular form. Besides the Add and Delete buttons to the tabular form, I have added a button that is only displayed if a page item (P24) is Null. This button is supposed to insert data into the tabular form/database table, however, on a condition. There is another page item (P1) that determines if the data can be inserted into this table. If P1 is also Null then a dialog box is displayed (warning message) and doesn't allow the insertion of data to continue. It just stops you and keeps you on the current page.

Is this accomplished with a PL/SQL procedute?
Can the Javascript function that controls the dialog box be placed in the PL/SQL?
Does the actual conditional of the insertion of data get stored in the PL/SQL?

Thanks in advance
  • 1. Re: Multi Row Update
    714270 Pro
    Currently Being Moderated
    963510 wrote:
    I am trying to mimic the Multi Row Update process to a tabular form while adding a slight twist. Lack in understanding is killing me. There are a couple parts involved.

    Scenario:
    I have a tabular form. Besides the Add and Delete buttons to the tabular form, I have added a button that is only displayed if a page item (P24) is Null. This button is supposed to insert data into the tabular form/database table, however, on a condition.
    If I understand your scenario correctly, you are having a on-submit pl/sql process to take care of the database insert/update/delete. The process is being triggered from a button, lets say "Submit". The "Submit" button is displayed only if the value of page item P24 is not null. All good till here.

    There is another page item (P1) that determines if the data can be inserted into this table. If P1 is also Null then a dialog box is displayed (warning message) and doesn't allow the insertion of data to continue. It just stops you and keeps you on the current page.
    Why can't you write a simple validation on the page item P1 that displays an error message the time the user hits the "Submit" button and the value of the page item is null?
    The pl/sql process that performs the database operations can be called as "On Submit- After Computations and Validations".
    Is this accomplished with a PL/SQL procedute?
    Yes, as explained above.
    Can the Javascript function that controls the dialog box be placed in the PL/SQL?
    You need to understand the fact that Javascript is executed on the client side - your browser. The pl/sql code runs on the server. Now, you can include javascript code inside your pl/sql code as shown here:
    http://deneskubicek.blogspot.in/2009/05/execute-javascript-throuhg-plsql.html

    But, you need to make sure that the pl/sql code is executed using a "on-load" page (on-load before header) process. This is to make sure that the html generated by htp.p statements are included in the page while it is being rendered. A similar question is discussed in the thread below:
    javascript in pl/sql process block

    Does the actual conditional of the insertion of data get stored in the PL/SQL?
    You can always put a condition on your pl/sql process such that it executes only when the value of page item P1 is not null.
  • 2. Re: Multi Row Update
    NewApexCoder Newbie
    Currently Being Moderated
    Thanks for the feedback. I will implement the suggested changes and let you know how things turn out. Thanks again
  • 3. Re: Multi Row Update
    NewApexCoder Newbie
    Currently Being Moderated
    My only concern/issues is how would the validation be used. P1 is an item derived from a query on a table, and this value can be NULL. So would using a validation still be useful here?
  • 4. Re: Multi Row Update
    714270 Pro
    Currently Being Moderated
    963510 wrote:
    My only concern/issues is how would the validation be used. P1 is an item derived from a query on a table, and this value can be NULL.
    So would using a validation still be useful here?
    The validation would be useful if you wish to throw an error message to the users. Otherwise, you can just condition your pl/sql process (that updates the database) to execute only when the value of the page item P1 is not null.


    Hope it helps.
  • 5. Re: Multi Row Update
    NewApexCoder Newbie
    Currently Being Moderated
    But would the validation still be applicable if the value of P1 is not NULL. I mean, can you put a conditional on a validation??
  • 6. Re: Multi Row Update
    714270 Pro
    Currently Being Moderated
    I believe the purpose of the validation is to throw an error message to the users when the value of P1 is null and they hit the submit button. So, what is the need to condition the validation?
  • 7. Re: Multi Row Update
    NewApexCoder Newbie
    Currently Being Moderated
    I think there is a bit of misunderstand here.

    I have a value, P1, that is passed to a page. This value can be either NULL or NOT NULL. If it happens to be NULL, then upon clicking the button, the error message will arise and the page won't do anything. If it it's NOT NULL, upon clicking the button then the PL/SQL process should run. In this case, would it still be efficient to add a validation to the P1 item?
  • 8. Re: Multi Row Update
    714270 Pro
    Currently Being Moderated
    How do you plan to throw an error message to the users?
  • 9. Re: Multi Row Update
    NewApexCoder Newbie
    Currently Being Moderated
    at first i wanted to create a javascript function; a simple pop up box with a message; leaving them on the same page. But even the actual apex message that could be generated from apex at the top would suffice
  • 10. Re: Multi Row Update
    714270 Pro
    Currently Being Moderated
    Validation should be easy to implement. Regarding javascript, there is some information in my first post. May be, you can look at the option of using dynamic action to throw an alert dialog. But that depends on how/where you compute P1.

    BTW, do not forget to mark appropriate posts as helpful/correct.
  • 11. Re: Multi Row Update
    NewApexCoder Newbie
    Currently Being Moderated
    Oh ok. Thanks for all your help though

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points