Search This Blog

Thursday, May 23, 2019

Error Message In Oracle Apex

Red Error :

<h7 style="color:#de0a0a;">#SQLERRM_TEXT#</h7>

Error Message Like Raise_application_error.

apex_error.add_error(
p_message=> 'Error Message!!!' ,
p_display_location=> apex_error.c_inline_in_notification   
) ;

Wednesday, May 22, 2019

Get Details Report by Clicking or Check on Interactive Grid Master Report

1. First create a interactive report on a table. Like select STD_ID, STD_NAME, ROLL_NO , CLASS_NAME from STUDENT_REG WHERE SECTION = :P57_SECTION AND UPPER(SCHOOL) = UPPER(:P0_SCHOOL_NAME) 2. Create a text field item like “P57_VAR” 3. Create a Dynamic Action on Event “Select Change Interactive Grid” and select respective selection type and region name. 4. Action > Execute JavaScript > var i, selectedIds=":" , model = this.data.model; for ( i = 0; i < this.data.selectedRecords.length; i++ ) { if (i>=0) { selectedIds += model.getValue( this.data.selectedRecords[i], "STD_ID") + ":"; } // ”STD_ID” is the unique key of the report else { selectedIds += model.getValue( this.data.selectedRecords[i], "STD_ID"); } } $s("P57_VAR", selectedIds); // "P57_VAR" is a item to preserve unique key to get another report data. apex.region("report").refresh(); // “report” is second report STATIC ID 5. Create report on same table with same condition. like select APEX_ITEM.display_and_save (03,STD_ID) STD_ID , STD_NAME, ROLL_NO , CLASS_NAME, --APEX_ITEM.CHECKBOX(02,'CHECKED','N') ATT_FLAG, APEX_ITEM.CHECKBOX(01,'#ROWNUM#','CHECKED') "Check" from STUDENT_REG where instr(:P57_VAR, ':' ||STD_ID|| ':' ) > 0 Now it may work… Maybe I can’t express the full cycle so try to understand your-self. Thank You.

1. First create a interactive report on a table. Like
select
    STD_ID,
    STD_NAME,
                ROLL_NO             ,
    CLASS_NAME
    from
    STUDENT_REG
WHERE    SECTION = :P57_SECTION
AND UPPER(SCHOOL) = UPPER(:P0_SCHOOL_NAME)

2. Create a text field item  like “P57_VAR”

3. Create a Dynamic Action on Event “Select Change Interactive Grid” and select respective selection type and region name.

4.  Action > Execute JavaScript >

var i, selectedIds=":" ,
    model = this.data.model;

for ( i = 0; i < this.data.selectedRecords.length; i++ ) {
    if (i>=0) {
    selectedIds += model.getValue( this.data.selectedRecords[i], "STD_ID") + ":"; } 

 // ”STD_ID” is the unique key of the report
    else
        {
    selectedIds += model.getValue( this.data.selectedRecords[i], "STD_ID");  
       }
}
$s("P57_VAR", selectedIds);

// "P57_VAR" is a item to preserve unique key to get another report data.

apex.region("report").refresh();

// “report” is second report STATIC ID

5. Create report on same table with same condition. like
select
    APEX_ITEM.display_and_save (03,STD_ID) STD_ID ,
    STD_NAME,
                ROLL_NO             ,
    CLASS_NAME,
    --APEX_ITEM.CHECKBOX(02,'CHECKED','N') ATT_FLAG,
    APEX_ITEM.CHECKBOX(01,'#ROWNUM#','CHECKED') "Check" 
  from
    STUDENT_REG
  where instr(:P57_VAR, ':' ||STD_ID|| ':' ) > 0

Now it may work…

Maybe I can’t express the full cycle so try to understand your-self.
Thank You.


Tuesday, May 21, 2019

Button in Report Manually in Oracle Apex

SELECT ID, NAME, '<input style="background-color: #85bbe7; color: black; font-weight: bold;" type="button" value="Upload">'Attachment, SCHOOL FROM TEST_TABLE; SELECT ID,
       NAME,
       '<input style="background-color: #85bbe7; color: black; font-weight: bold;" type="button" value="Upload">'Attachment,
       SCHOOL
FROM
TEST_TABLE;

Run Time Validation Or Validation From Dynamic Action By JavaScript in Oracle Apex

Run Time Validation Or Validation From Dynamic Action By JavaScript in Oracle Apex STEP-1: CREATE JS FUNCTION ON PAGE LEVEL JUST PASTE THE BELOW CODE function myerror(){ var myval = apex.item('P6_ERR').getValue();//document.getElementById('P6_ERR').value; apex.message.clearErrors(); apex.message.showErrors( [ { "type": "error", "location": "page", "message": myval }] ); } STEP-2: CALL THE FUNCTION ON ONCHANGE EVENT ON YOUR SPECIFIC ITEM ON CUSTOM ATTRIBUTE onchange="myerror();" STEP-3: CREATE A DYNAMIC ACTION ON CLICK OR AS YOU WISH PASTHE BELOW SAMPLE CODE EVENT: CLICK ACTION: EXECUTE PL/SQL CODE BEGIN IF LENGTH(:P6_NEW)>=10 THEN :P6_ERR :='Length must not exceed 10 digit....'; --RAISE_APPLICATION_ERROR(-20001,'Length must not exceed 4 digit....'); elsif LENGTH(:P6_NEW)>=5 THEN :P6_ERR :='Length must not exceed 4 digit....'; end if; exception when others then :P6_ERR :=SQLERRM; --RAISE_APPLICATION_ERROR(-20001,'Length must not exceed 4 digit'); END; STEP-1: CREATE JS FUNCTION ON PAGE LEVEL JUST PASTE THE BELOW CODE

function myerror(){
    var myval = apex.item('P6_ERR').getValue();//document.getElementById('P6_ERR').value;
    apex.message.clearErrors();
    apex.message.showErrors(
[
 {
  "type":     "error",
  "location": "page",
  "message": myval
}]
);
}

STEP-2: CALL THE FUNCTION ON ONCHANGE EVENT ON YOUR SPECIFIC ITEM ON CUSTOM ATTRIBUTE

onchange="myerror();"

STEP-3: CREATE A DYNAMIC ACTION ON CLICK OR AS YOU WISH PASTHE BELOW SAMPLE CODE
EVENT: CLICK
ACTION: EXECUTE PL/SQL CODE

BEGIN
IF LENGTH(:P6_NEW)>=10 THEN
:P6_ERR :='Length must not exceed 10 digit....';
--RAISE_APPLICATION_ERROR(-20001,'Length must not exceed 4 digit....');
elsif LENGTH(:P6_NEW)>=5 THEN
:P6_ERR :='Length must not exceed 4 digit....';
end if;
exception 
when others then
:P6_ERR :=SQLERRM;
--RAISE_APPLICATION_ERROR(-20001,'Length must not exceed 4 digit');
END;

Thursday, May 16, 2019

Work With apex_collection in Oracle Apex


Work With apex_collection in Oracle Apex 1. Create apex_collection : apex_collection.create_collection('NAME'); 2. Existence Check: apex_collection.collection_exists ('NAME'); 3. Add Member: apex_collection.add_member (p_collection_name => 'NAME', p_c001 => :P2_ITEM1, p_c002 => :P2_ITEM2, p_c003 => :P2_ITEM3); 4. Collection to Database table data transcfer: BEGIN FOR i IN ( SELECT c001 AS a, c002 AS b, c003 AS c FROM apex_collections WHERE collection_name = 'NAME' ORDER BY 1) LOOP INSERT INTO DATABASE_TABLE (COLUMN1, COLUMN2, COLUMN3) VALUES (i.a, i.b, i.c); END LOOP; COMMIT; END; 5. Truncate Collection: apex_collection.truncate_collection(p_collection_name => 'NAME'); 6. Delete Collection Member : apex_collection.delete_member( p_collection_name => collection name, p_seq => member sequence number); 7. Delete All Collecion Members: apex_collection.delete_members( p_collection_name => collection name, p_attr_number => number of attribute used to match for the specified attribute value for deletion, p_attr_value => attribute value of the member attribute used to match for deletion); 8. Delete Collection : apex_collection.delete_collection ( p_collection_name =>'NAME'); 1. Create apex_collection :
(Collection Name Must be in Capital letter)
apex_collection.create_collection('NAME');

2. Existence Check:

apex_collection.collection_exists ('NAME');

3. Add Member:

  apex_collection.add_member (p_collection_name   => 'NAME',
                                  p_c001              => :P2_ITEM1,
                                  p_c002              => :P2_ITEM2,
                                  p_c003              => :P2_ITEM3);
                               
4. Collection to Database table data transcfer:

BEGIN
   FOR i IN (  SELECT c001 AS a, c002 AS b, c003 AS c
                 FROM apex_collections
                WHERE collection_name = 'NAME'
             ORDER BY 1)
   LOOP
      INSERT INTO DATABASE_TABLE (COLUMN1, COLUMN2, COLUMN3)
           VALUES (i.a, i.b, i.c);
   END LOOP;

   COMMIT;
END; 

5. Truncate Collection:

apex_collection.truncate_collection(p_collection_name => 'NAME');   

6. Delete Collection Member :

apex_collection.delete_member(
    p_collection_name => collection name,
    p_seq             => member sequence number);    
 
7. Delete All Collecion Members:

apex_collection.delete_members(
    p_collection_name => collection name,
    p_attr_number     => number of attribute used to match for the                           specified
                         attribute value for deletion, 
    p_attr_value      => attribute value of the member attribute                             used to match for deletion); 
8. Delete Collection :

apex_collection.delete_collection (
    p_collection_name =>'NAME');                                           

Friday, May 10, 2019

Re Assign Oracle Table Column Without Delete Data From Table Using (Rebuild form TOAD)

Re Assign Oracle Table Column Without Delete Data From Table Using (Rebuild form TOAD) ***Table ->altermode->Rebuild-> Script-> Re Assign Column -> Finally Execute.*** -- ********************************************************************** -- Note: This rebuild script is not meant to be used when a possibility * -- exists that someone might try to access the table while it is * -- being rebuilt! If you need online table rebuilding and you * -- are on Oracle 10g or newer, use the dbms_redfinition wizard * -- under database -> optimize. (Requires DB Admin module) * -- * -- Locks are released when the first DDL, COMMIT or ROLLBACK is * -- performed, so adding a "Lock table" command at the top of this * -- script will not prevent others from accessing the table for * -- the duration of the script. * -- * -- One more important note: * -- This script will cause the catalog in replicated environments * -- to become out of sync. * -- ********************************************************************** -- Table Rebuild script generated by Toad -- -- Original table: TEST1 -- Backup of table: TEST1_X -- Date: 11/05/2019 12:48:57 ***Table ->altermode->Rebuild-> Script-> Re Assign Column -> Finally  Execute.***

--  **********************************************************************
--  Note: This rebuild script is not meant to be used when a possibility *
--        exists that someone might try to access the table while it is  *
--        being rebuilt!  If you need online table rebuilding and you    *
--        are on Oracle 10g or newer, use the dbms_redfinition wizard    *
--        under database -> optimize. (Requires DB Admin module)         *
--                                                                       *
--        Locks are released when the first DDL, COMMIT or ROLLBACK is   *
--        performed, so adding a "Lock table" command at the top of this *
--        script will not prevent others from accessing the table for    *
--        the duration of the script.                                    *
--                                                                       *
--   One more important note:                                            *
--        This script will cause the catalog in replicated environments  *
--        to become out of sync.                                         *
--  **********************************************************************

--  Table Rebuild script generated by Toad
--
--  Original table: TEST1
--  Backup of table: TEST1_X
--  Date: 11/05/2019 12:48:57

Saturday, May 4, 2019

String Moving

Region Type Static Content

String Moving

<font style="font-size: 20px;" color=#009688><marquee> Moving String tag !!! :)</marquee></font>
<title>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPt8gG2nt9X3ciohb-CVI7lguVfUNIgfjTJKFbsRFNjlGHezxjpRn71k3dhb2dNuHgYJWB7_89NPqxD2Zi39L5IeMRGY8VQqg96uhEx98bV8nlAshq0Ks_SMjlUKwuwxE3bhc6vvvL-QU/s1600/movingtag.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="244" data-original-width="1340" height="115" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPt8gG2nt9X3ciohb-CVI7lguVfUNIgfjTJKFbsRFNjlGHezxjpRn71k3dhb2dNuHgYJWB7_89NPqxD2Zi39L5IeMRGY8VQqg96uhEx98bV8nlAshq0Ks_SMjlUKwuwxE3bhc6vvvL-QU/s640/movingtag.gif" width="640" /></a></div>
<br />
<u>Region Type Static Content </u><br />
<br />
<font style="font-size: 20px;" color=#009688><marquee> Moving String tag !!! :)</marquee></font>
Region Type Static Content String Moving <font style="font-size: 20px;" color=#009688><marquee> Moving String tag !!! :)</marquee></font> <title> <div class="separator" style="clear: both; text-align: center;"> <a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPt8gG2nt9X3ciohb-CVI7lguVfUNIgfjTJKFbsRFNjlGHezxjpRn71k3dhb2dNuHgYJWB7_89NPqxD2Zi39L5IeMRGY8VQqg96uhEx98bV8nlAshq0Ks_SMjlUKwuwxE3bhc6vvvL-QU/s1600/movingtag.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="244" data-original-width="1340" height="115" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPt8gG2nt9X3ciohb-CVI7lguVfUNIgfjTJKFbsRFNjlGHezxjpRn71k3dhb2dNuHgYJWB7_89NPqxD2Zi39L5IeMRGY8VQqg96uhEx98bV8nlAshq0Ks_SMjlUKwuwxE3bhc6vvvL-QU/s640/movingtag.gif" width="640" /></a></div> <br /> <u>Region Type Static Content </u><br /> <br /> <font style="font-size: 20px;" color=#009688><marquee> Moving String tag !!! :)</marquee></font>

How to open region as modal and pass a value from report or item.

1. Create report and take a column as link.
2. Create another region for modal and put a static ld like ‘m’
3. Then Link -> Target -> URL type and wright the code like this one.

Here  P1_ID is the item where you want to assign the value and #ID# is report value.
And  ‘m’ is the static id of modal region and this region template should be Inline Dialog .
javascript:$s('P1_ID','#ID#','#ID#'); javascript:openModal('m');

Monday, April 22, 2019

Report Button CSS

1. class="t-Button t-Button--hot"

2. class="add t-Button t-Button--warning t-Button--simple t-Button--stretch"

3. class="t-Button--small t-Button--simple t-Button--hot t-Button--stretch"

4. class="t-Button t-Button--hot t-Button--stretch"



class="t-Button t-Button--hot"

Sunday, April 21, 2019

Apex Report Header Image Size (CSS)

Apex Report Header Image Size (CSS) Catch Apex Report by Header Here imgid is static id of apex header. td[headers="imgid"] img{ width: 50px; height: 50px; } Catch Apex Report by Header

Here imgid is static id of apex header.

td[headers="imgid"] img{
    width: 50px;
    height: 50px;
}

Create a Form Using Python for Save Data into Excel like a Database

#Download Pyhton from here https://www.python.org/downloads/  #Download Python: #Click the “Download Python 3.x.x” button (the latest versio...