Forum Stats

  • 3,752,514 Users
  • 2,250,513 Discussions
  • 7,867,862 Comments

Discussions

Validation in deleting records from classic report

Mencis Joe
Mencis Joe Member Posts: 164
edited Apr 19, 2016 4:25AM in APEX Discussions

I have a Classic Report Region with 6 Columns and the first column is the check Box and I have a Delete button in that Region. What I want to do is,

case 1: If no data available in the classic report and I click on Delete button, I should get 'no data available to delete' warning.

case 2: If data is available in the report and no check box is selected, when clicked on Delete button I should get 'Please select at least one record to delete'.

case 3: If data is available and the rows to be deleted are checked, when clicked on Delete button, the checked records should get deleted.
What is the best way to achieve this?

Tagged:
ReemaPuriMahmoud_Rabie

Best Answer

  • ReemaPuri
    ReemaPuri Member Posts: 1,358 Gold Badge
    edited Apr 6, 2016 9:13AM Accepted Answer
    Mencis Joe wrote:
    
    I have a Classic Report Region with 6 Columns and the first column is the check Box and I have a Delete button in that Region. What I want to do is, 
    case 1: If no data available in the classic report and I click on Delete button, I should get 'no data available to delete' warning. 
    case 2: If data is available in the report and no check box is selected, when clicked on Delete button I should get 'Please select at least one record to delete'.
    case 3: If data is available and the rows to be deleted are checked, when clicked on Delete button, the checked records should get deleted.
    What is the best way to achieve this?

    check this out it will solve your problem(Submit button is just to add entries in table nothing else)

    WORKSPACE:REEMATEST

    user: test

    password :-test

    application 57481

    page 17

    https://apex.oracle.com/pls/apex/f?p=57481:17:115968205680774::NO:::

    1) for your first query  when no data is found there will be no cross icon

    2) you can directly click on cross and delete

    3) no need for this validation

    Check : application process,application item and javascript under javascript section

    function f_delete(ID)

    {

    var ajaxRequest = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=DELETE_NAME',0);

      ajaxRequest.add('NAME_ID',ID);

      var ajaxResult = ajaxRequest.get();

      ajaxRequest = null;

    f_refresh();

    }

    Note :- for apex 5.0  i have used

    <script type="text/javascript">

    function f_refresh() {

    apex.event.trigger( "#STATIC_ID", "apexrefresh")

    }

    </script>

    Referred:

    Manually Refreshing Oracle Application Express Components

    But if you are on apex 4 version you can use below function refresh classical  report

    <script type="text/javascript">

    function f_refresh() {

      pId = '#REGION_ID#';   // report region id

      $a_report(pId.substring(1),'1','15');  // APEX built-in

    }

    </script>

Answers

  • ReemaPuri
    ReemaPuri Member Posts: 1,358 Gold Badge
    edited Apr 6, 2016 9:13AM Accepted Answer
    Mencis Joe wrote:
    
    I have a Classic Report Region with 6 Columns and the first column is the check Box and I have a Delete button in that Region. What I want to do is, 
    case 1: If no data available in the classic report and I click on Delete button, I should get 'no data available to delete' warning. 
    case 2: If data is available in the report and no check box is selected, when clicked on Delete button I should get 'Please select at least one record to delete'.
    case 3: If data is available and the rows to be deleted are checked, when clicked on Delete button, the checked records should get deleted.
    What is the best way to achieve this?

    check this out it will solve your problem(Submit button is just to add entries in table nothing else)

    WORKSPACE:REEMATEST

    user: test

    password :-test

    application 57481

    page 17

    https://apex.oracle.com/pls/apex/f?p=57481:17:115968205680774::NO:::

    1) for your first query  when no data is found there will be no cross icon

    2) you can directly click on cross and delete

    3) no need for this validation

    Check : application process,application item and javascript under javascript section

    function f_delete(ID)

    {

    var ajaxRequest = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=DELETE_NAME',0);

      ajaxRequest.add('NAME_ID',ID);

      var ajaxResult = ajaxRequest.get();

      ajaxRequest = null;

    f_refresh();

    }

    Note :- for apex 5.0  i have used

    <script type="text/javascript">

    function f_refresh() {

    apex.event.trigger( "#STATIC_ID", "apexrefresh")

    }

    </script>

    Referred:

    Manually Refreshing Oracle Application Express Components

    But if you are on apex 4 version you can use below function refresh classical  report

    <script type="text/javascript">

    function f_refresh() {

      pId = '#REGION_ID#';   // report region id

      $a_report(pId.substring(1),'1','15');  // APEX built-in

    }

    </script>

  • Mencis Joe
    Mencis Joe Member Posts: 164
    edited Apr 15, 2016 6:42AM

    Thanks you. Works perfect :-)

    ReemaPuri
  • ReemaPuri
    ReemaPuri Member Posts: 1,358 Gold Badge
    edited Apr 15, 2016 7:55AM
  • Mahmoud_Rabie
    Mahmoud_Rabie Cloud Solution Architect, Member Posts: 3,216 Bronze Crown
    edited Apr 15, 2016 11:12AM

    Hi Mencis

    You would find the other helpful solutions here

    Alert for Deleting Rows

    Regards

    Mahmoud

    Mencis Joe
  • Mencis Joe
    Mencis Joe Member Posts: 164
    edited Apr 19, 2016 4:25AM
This discussion has been closed.