Browsing "Older Posts"

Reset Interactive Report (IR)

Von Tobias Arnhold → 6.30.2016
Resetting an Interactive Report (IR) can be done in 4 different ways.
User Reset, URL Link, Page Process, Dynamic Action

First of all
It is always a good start to set up a specific static report id.


1.  User Reset
Not much to say.


1. URL Link

f?p=&APP_ID.:1:&APP_SESSION.:::RIR,CIR:

Cache definition:
- RIR: reset IR to primary report
- CIR: reset IR to primary report but with custom columns
- RP: reset IR pagination.

More details about the difference of RIR and CIR can be found here:
Apex Interactive Report: The difference between CIR and RIR

Basically all you need to know about the URL options in an IR can be found in the documentation:
Application Express Application Builder User's Guide


Also be aware that you can use several IR since APEX 5 on one page. Filters must now be applied in a specific syntax:
IR[region static ID]_

2. Page Process (Before Header)
DECLARE
  v_region_id APEX_APPLICATION_PAGE_REGIONS.REGION_ID%TYPE;
BEGIN

  SELECT region_id INTO v_region_id
  FROM APEX_APPLICATION_PAGE_REGIONS
  WHERE application_id = :APP_ID
  AND page_id = 1
  AND static_id = 'IR_RO_REPORT_ID'; -- Static ID of your IR

  APEX_IR.RESET_REPORT(
   P_page_id => 1,
   P_region_id => v_region_id,
   P_report_id => NULL
  );

END;

3. Dynamic Action
Create a new Dynamic Action.
Add a TRUE action of type "Execute PL/SQL code"  and use the same code as above.
And finally add another TRUE action to refresh the IR.

If you still need more information then take a look here:
Reset an Interactive Report (IR)

Oracle Spatial (Teil 4) - Unterschiedliche Koordinaten Punkte zu einer Linie zusammenführen

Von Tobias Arnhold → 6.21.2016
Vor kurzem musste ich Daten aus einer Excel-Liste in das SDO_GEOMETRY Format bringen. Leider hatte die Excelliste einen Haken.

Die Anforderungen:
- Es musste eine Linie (Typ 2002) im GK3 Format (31467) aus VON und NACH Punkten generiert werden.
- Die Excel-Liste hatte die Punkte entweder als GK3 oder als WGS84 Format hinterlegt.

Nach Import der Daten sah meine Quelltabelle dann so aus:


Und hier das Select zur richtigen Transformation der Geo-Daten ins SDO_GEOMETRY Format:
SELECT 
     SDOP.ID,
     SDOP.VON_NAME,
     SDOP.NACH_NAME,

     /* Linie generieren */
     MDSYS.SDO_GEOMETRY(
        2002, /* Linie */
        31467, /* GK3 */
        NULL,
        MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),
        MDSYS.SDO_ORDINATE_ARRAY(
            SDOP.VON_GEO_GK3.SDO_POINT.X,
            SDOP.VON_GEO_GK3.SDO_POINT.Y,
            SDOP.NACH_GEO_GK3.SDO_POINT.X,
            SDOP.NACH_GEO_GK3.SDO_POINT.Y
        )
     ) AS GEO_GK3,

     /* Entfernung berechnen */
     ROUND(SDO_GEOM.SDO_DISTANCE(
           GEOM1 => SDOP.VON_GEO_GK3,
           GEOM2 => SDOP.NACH_GEO_GK3,
           TOL => 5,
           UNIT => 'unit=KM'
     ),3) ENTFERNUNG
FROM (
      /* Berechnung der SDO Punkte */
      SELECT
        ID,
        VON_NAME,
        NACH_NAME,

        /* VON: Check ob GK3 oder WGS84 und Vereinheitlichung ins GK3 Format*/
        CASE 
         WHEN VON_GK3_X IS NOT NULL 
         THEN
            MDSYS.SDO_GEOMETRY (
                      2001, -- Zweidimensionaler Punkt
                      31467, -- Typ: GK3
                      SDO_POINT_TYPE(
                          X => VON_GK3_X, 
                          Y => VON_GK3_Y,
                          Z => NULL
                      ), 
                      NULL,
                      NULL
            ) 
          ELSE
            SDO_CS.TRANSFORM( 
              MDSYS.SDO_GEOMETRY (
                2001, -- Zweidimensionaler Punkt
                8307, -- Typ: WGS84
                SDO_POINT_TYPE(
                    X => VON_WGS84_X,  -- Längengrad / Longitude / Ost
                    Y => VON_WGS84_Y,  -- Breitengrad / Latitude / Nord
                    Z => NULL
                ), 
                NULL,
                NULL
              ),
             31467 -- Umwandlung in GK3
             )
        END AS VON_GEO_GK3,

        /* NACH: Check ob GK3 oder WGS84 und Vereinheitlichung ins GK3 Format*/
        CASE 
         WHEN NACH_GK3_X IS NOT NULL 
         THEN
            MDSYS.SDO_GEOMETRY (
                      2001, -- Zweidimensionaler Punkt
                      31467, -- Typ: GK3
                      SDO_POINT_TYPE(
                          X => NACH_GK3_X, 
                          Y => NACH_GK3_Y,
                          Z => NULL
                      ), 
                      NULL,
                      NULL
            ) 
          ELSE
            SDO_CS.TRANSFORM( 
              MDSYS.SDO_GEOMETRY (
                2001, -- Zweidimensionaler Punkt
                8307, -- Typ: WGS84
                SDO_POINT_TYPE(
                    X => NACH_WGS84_X,  -- Längengrad / Longitude / Ost
                    Y => NACH_WGS84_Y,  -- Breitengrad / Latitude / Nord
                    Z => NULL
                ), 
                NULL,
                NULL
              ),
             31467 -- Umwandlung in GK3
             )
        END AS NACH_GEO_GK3

      FROM GEO_MEINE_DATEN
) SDOP
Mit dem Ergebnis:

APEX Master (Interactive Report) - Detail (Modal Dialog) Form: Conditional Column Link

Von Tobias Arnhold → 6.15.2016

Since APEX 5 it is much easier to create master-detail pages with modal dialogs. But there is still no declarative way to create a conditional row based column link.

This blog post will show you a way how to create a conditional row based master - detail page.

1. We need some sample data:
WITH MY_DATA AS
(
select 1 as ID, 'APEX Connect' as name, 1 as CONDITIONAL_COL from DUAL
union all
select 2 as ID, 'KScope' as name, 0 as CONDITIONAL_COL from DUAL
union all
select 3 as ID, 'DOAG' as name, 1 as CONDITIONAL_COL from DUAL
union all
select 4 as ID, 'APEX-FRA Meetup Group' as name, 1 as CONDITIONAL_COL from DUAL
union all
select 5 as ID, 'Oracle World' as name, 0 as CONDITIONAL_COL from DUAL
)
select 
  ID,
  NAME,
  case when nvl(CONDITIONAL_COL,99) = 1 then
    'inline-block'
  else 'none' end as CSS,
  case when nvl(CONDITIONAL_COL,99) = 1 then
    'Visited conference'
  else 'Not visited yet' end as DETAIL_COL
from MY_DATA
As you can see the column CONDITIONAL_COL defines the conditional appearance.
CONDITIONAL_COL = 1 means show a detail button.
CONDITIONAL_COL = 0 means no detail button.

2. Now we can create a APEX master detail page where the "Page Mode" of the detail page is set to:
"Modal Dialog".


The master page gets an Interactive Report with the above select statement.

3. Now we need to configure the column attributes inside the Interactive Report:
Columns ID and NAME with be displayed as of type: "Plain Text".
Column CSS will not be displayed: "Hidden Column"
Column DETAIL_COL will be displayed as of type: "Link"
 - Target: 
   - Page: 2
   - Set Items: P2_ID - #ID#
 - Link Text: <span class="fa fa-search-plus" style="font-size: 160%"></span>
 - Link Attribues: class="a-Button" style="display:#CSS#;"
 We created a custom link for our detail page.


And the functionality to display the detail button conditionally is set by the column "CSS".


The result looks like this:

You can even filter the button by some readable data:


Security issue:
On the detail page you need a validation to check if the user is allowed to edit the data of the transmitted ID. An alternative way is to update the select so that no ID value will be generated if the user has no rights.
Example:
WITH MY_DATA AS
select 
  case when nvl(CONDITIONAL_COL,99) = 1 then
       ID
  else NULL end as ID,
  ID as ID_DISPLAY
  NAME,
  case when nvl(CONDITIONAL_COL,99) = 1 then
    'inline-block'
  else 'none' end as CSS,
  case when nvl(CONDITIONAL_COL,99) = 1 then
    'Visited conference'
  else 'Not visited yet' end as DETAIL_COL
from MY_DATA