Quantcast
Channel: APEX-AT-WORK by Tobias Arnhold
Viewing all 177 articles
Browse latest View live

Working with multiple browser tabs

$
0
0
When I develop APEX applications I use several browser tabs to navigate between the executed application and the application builder. There is one side affect which drives me crazy sometimes.

TAB 1: Executed application
TAB 2: Application Builder

How do I work?
I edit an item inside the application builder (for example the LOV select statement) and click on save. I immediately change the TAB and press F5 to update the application.

What drives me crazy?
If I have made a mistake in the select statement of my LOV I just get a error message inside the browser page. But I changed the TAB faster then the result appeared and I didn't recognize it.

It would be great if the TAB title would have changed too. So that I could see that an error occurred.








Disable input elements in tabular form

$
0
0
There is a quite often requirement to disable a tabular form column based on the row information.

I got a customer request with the following requirement:
A select list column of a tabular form should be disabled (row based) when the value of another column is like SYSDATE.

There are 3 options to follow:
1. Create a manual tabular form and disable the column with a case statement inside the select
2. Deactivate the column with some jQuery code
3. Wait for APEX 5. I think there is some development ongoing about this problem.

Some thoughts about solution 2

I assume that the SYSDATE is: 12.12.2013
Our result should look like this:


How to achieve this?
First I need to extend the report with one extra column plus some column customization
Second is some jQuery code in form of two dynamic actions.

The SELECT statement:
SELECT -- Original columns:
ANIMAL_OWNER_ID, ANIMAL_OWNER_NAME, ANIMAL_ID, to_char(LAST_DATE,'dd.mm.yyyy') as LAST_DATE,
-- New column:
to_char(SYSDATE,'dd.mm.yyyy') as CURRENT_DATE
FROM CUST_TABLE
Now I change the report attributes of column: LAST_DATE
Column Formatting >> HTML Expression:
<span class="tbl_date">#LAST_DATE#</span><span class="tbl_cur_date" style="display:none;">#CURRENT_DATE#</span>

Now I need to add two dynamic actions to change the appearance of our column: ANIMAL_ID
1. Deactivate the affected rows
Event: Page Load
Action: Execute JavaScript Code
$('.tbl_date').each(function( index ) {
if ( $(this).html() == $(this).parent().find('.tbl_cur_date').html() )
{
$( this ).parent().parent().find('select[name="f01"]').prop('disabled', 'disabled');
}
});
What am I doing here?
I search for all elements with the CSS class "tbl_date"
Now I compare the HTML value with the value of the class "tbl_cur_date".
If the result is TRUE then the select list will be disabled.
To find the select list I search for the name "f01". Actually because I only have one select element I  could use this code snippet as well: find('select')

2. Activate the affected rows before page submit. Otherwise I would get an tabular form error.
Event: Before Page Submit
Action: Execute JavaScript Code
$('.tbl_date').each(function( index ) {
if ( $(this).html() == $(this).parent().find('.tbl_cur_date').html() )
{
$( this ).parent().parent().find('select[name="f01"]').prop('disabled', '');
}
});
Now I have a huge security hole in my application. To close this one I need a tabular form validation. The validation must check for changed select elements. Of course only those which should not be able to change.
You can follow this blog post which is providing a hint how to achieve it: http://www.apex-at-work.com/2012/06/tabular-form-validation-issue.html

SQL Developer 4 is out

Suchen von Informationen innerhalb der APEX-Entwicklungsumgebung

$
0
0
Seit Version 4 von APEX ist es möglich, nach bestimmten Begriffen innerhalb der APEX Applikation zu suchen.
Beispielsweise: Wo verwende ich überall die Tabelle TBL_APEX_AT_WORK


Neben dieser Funktionalität kommt es auch häufig vor, dass man innerhalb des eigenen Oracle Schemas nach der selben Information suchen möchte.
Gute Beispiele dafür sind Views und Packages:

-- Auswerten von Packages, Funktionen, Prozeduren und Triggern
select name, text
from user_source
where upper(text) like '%TBL_APEX_AT_WORK%'
order by line;

-- Auswerten von Views
select * from user_views
where dbms_xmlgen.getxml('select text from user_views where view_name =
''' || view_name || '''') like '%TBL_APEX_AT_WORK%'

Mit diesen simplen Tricks gelangen Sie sehr schnell an die relevante Information.

Scroll to the top of your page/report

$
0
0
In case you use partial page refresh inside your reports you may have encountered an issue that you always stay on the bottom of the page even after the refresh of the report.  One of my customer marked this as a bug and meant that after the refresh the display position should be at the beginning of the report.

Seems complicated but worked out to be really easy:
Add a dynamic action: After refresh of your report execute this javascript statement

/* Scroll to Top */
$("html, body").animate({ scrollTop: 0 }, 0);

or in case you have the exact position of your report:
/* Scroll to the beginning of the report, starts at 221 */
$("html, body").animate({ scrollTop: 221 }, 0);

I found the solution in this post:
http://stackoverflow.com/questions/1144805/how-do-i-scroll-to-the-top-of-the-page-with-jquery

APEX Vortrag und APEX Stammtisch

$
0
0
Am 05.02.2014 (Rhein-Main, Neu-Isenburg) halte ich einen APEX Vortrag zum Thema Pivotreports.
Details findet Ihr hier: http://www.doag.org/termine/termine.php?tid=473736

Außerdem plant die Community nun schon seit einiger Zeit an einem APEX Stammtisch in Frankfurt.
Wer Interesse hat kann sich hier anmelden: http://doodle.com/b9uqef2338itkgkv
Mit etwas Glück könnte der Termin im Anschluss des DOAG Treffens stattfinden. :D

Schon etwas weiter in der Zukunft (Mai 2014) liegt der nächste Best Practices Kurs von Denes Kubicek und Dietmar Aust. Details findet Ihr hier: http://deneskubicek.blogspot.de/2014/01/apex-training-2014-best-practices.html

Wir sehen uns.


APEX Validation: Check overlapping time periods

$
0
0
There is a easy way to check if a row with overlapping time periods exists inside your table.

We assume that our table is called T_MACHINE with the columns m_id (PK), valid_from and valid_until 

All you need to do is to create the following APEX validation:
Validation type: NOT Exist

SQL:
select 1 from T_MACHINE
WHERE (:P6_ID IS NOT NULL AND M_ID != :P6_ID OR :P6_ID IS NULL)
AND (VALID_FROM <= TO_DATE(:P6_UNTIL,'DD.MM.YYYY')) and (TO_DATE(:P6_FROM,'DD.MM.YYYY') <= VALID_UNTIL)

First time I needed this solution it took me half a day for development and testing.
This time same problem but the solution was not available anymore.

What to do? I asked the WWW! Yes, first shot was a goal:
http://stackoverflow.com/questions/325933/determine-whether-two-date-ranges-overlap

Solution was ready in less then 30 minutes.

Getting access to your Flash Anygantt via Javascript

$
0
0
In case you want to edit or react on actions inside your gantt during the runtime of your application. That's the way how to do it.

Get access to the gantt element with this Javascript command:
AnyGantt._charts.chart__0
A description about the possible activities can be found here:
http://www.anychart.com/products/anygantt/docs/users-guide/index.html?JavaScriptIntegration.html

Here is an example how to get the current startDate of the clicked period:
flash = AnyGantt._charts.chart__0;
flash.addEventListener('periodSelect',function(e){
document.getElementById("P1_CUR_START_DATE").value = flash.getSelectedPeriodInfo().startDate;
});
Thanks to my colleague Richard in finding out how to do this.

DOAG Development - 4 Juni 2014

$
0
0
Nachdem ich die APEX World Konferenz verpasst habe, ist es nun an der Zeit endlich wieder aktiv zu werden.

Unter dem Deckmantel DOAG Development gibt es an einem Tag APEX pur zu genießen. Es gibt so viele APEX Vorträge das diese gleichzeitig in mehreren Räumen präsentiert werden.  Heißt, wer mich nicht hören will, hat genug Alternativen zur Auswahl. :)

Jeder der aktuell APEX einsetzt sollte dies als positive Pflichtveranstaltung mitnehmen und genießen.

Details zur Veranstaltung
Wann:
04.06.2014

Ort:
Hotel Van der Valk Düsseldorf
Am Hülserhof 57
40472 Düsseldorf

Kosten:
Für DOAG Mitglieder  250 €
Für NICHT Mitglieder: 333 €
Imho: Für Oracle Verhältnisse ist das günstig.

Weiterführende Infos und das Vortragsprogramm findet Ihr unter:
http://development.doag.org/

Ps.: Am Abend davor gibt es ebenfalls eine sehr nette APEX Veranstaltung
http://www.doag.org/termine/termine.php?tid=473794

Eine Info die mich dazu über Twitter erreicht hat:

http://development.doag.org . Am Vorabend kann ein jeder seine Anwendung in 10 Min. vorstellen. Als Belohnung zahlen wir das Bier :)

 Wir sehen uns...

APEX Security Tipps

$
0
0
Im aktuellen APEX Community Tipp, geht es um das Thema Sicherheit in APEX Anwendungen.

https://apex.oracle.com/pls/apex/GERMAN_COMMUNITIES.SHOW_TIPP?P_ID=2901

Imho:
Ein MUSS für jeden Entwickler!

APEX Datei Download - Sicher und Einfach

Format Lower/Upper with SQL Developer

$
0
0
There is a simple trick to format your SQL code in LOWER,UPPER,INITCAP with SQL Developer.

Select the code you want to format and click the "Aa"-button or "Strg + Quote".

Default:


Target:



It is so simple but I never came on the idea to check this button.

Calculate minutes between two dates

$
0
0
Simple question but always a pain in the ass in finding the right solution:

select 
round(
(to_date('12.08.2014 12:30','dd.mm.yyyy hh24:mi')
-to_date('12.08.2014 11:30','dd.mm.yyyy hh24:mi')
) * 24 * 60
,0) as result_in_minutes
from dual;

DOAG 2014 - Vortrag zum Thema: Dynamisches Arbeiten mit Grafiken in APEX

$
0
0
Mein diesjähriger DOAG Vortrag ist am letzten Konferenz-Tag  
20.11.2014 um 9:00 (Raum Istanbul)

Link:  
http://www.doag.org/konferenz/vortrag_details.php?locS=0&kid=459293&tag=3&id=484637

Auf was könnt Ihr euch freuen?
Ich zeige einen Lösungsansatz mit dem man Grafiken dynamisch nutzen kann, ohne viel Programmieraufwand zu investieren.

Beispiel:
Hafen mit dynamisch erstellten Booten und erweiterten Informationen.
In der Präsentation, die wieder eine APEX Anwendung sein wird, werde ich auf unterschiedlichste Beispiele eingehen und den Code im Detail erläutern.

Also sehen uns auf der DOAG!


 


Veranstaltungs-News

$
0
0
Am 26. September ist das erste APEX Meetup Treffen in Frankfurt:
http://www.meetup.com/orclapex-fra/events/207768912/

Am 05. November halte ich einen Vortrag zum Thema Plugins und Reporting in Bonn:
http://www.orbit.de/unternehmen/service/veranstaltungen/#c1398
Weitere Vorträge werden von Denes Kubicek& Frank Weyher gehalten.

DOAG 2014 im November:
http://www.doag.org/events/konferenzen/doag-2014.html
http://www.apex-at-work.com/2014/09/doag-2014-vortrag-zum-thema-dynamisches.html
 
-------------------------------------------------------------------------------------------------------------

Ich sah gerade noch einen Blogpost zum Thema "Warum ist APEX so GEIL!?".
Ok der Titel war etwas besser formuliert :)
http://www.explorer-development.uk.com/7-things-about-apex-your-boss-needs-to-know/

SQL Developer Neue Version & Hidden Features

$
0
0

APEX 5.0 verschiebt sich

APEX, HTML und Jahresausklang...

$
0
0
Die letzten Wochen waren verdammt arbeitsintensiv und es wird bis Weihnachten nicht viel besser werden. Meetings, Telko's, PL/SQL, SQL, APEX alles verpackt in unterschiedlichsten Projekten.

Umso mehr waren die 3 Tage #DOAG2014 eine gute Erholungspause und eine Quelle für neue Motivation und Ideen.

Mein eigener Vortrag zum Thema "Dynamisches Arbeiten mit Grafiken in APEX" kam sehr gut an und zeigt einmal mehr das APEX Enthusiasten auch am letzten Tag 09:00 Uhr bereit sind sich weiterzuentwickeln. ;)

Für Alle die es verpasst haben oder gar nicht auf der DOAG waren. Habe ich eine Version der Anwendung auf apex.oracle.com hochgeladen: https://apex.oracle.com/pls/apex/f?p=78451

Wenn jemand noch Interesse haben sollte, kann er sich gern bei mir melden.

Auf der kommenden #APEXConnect werde ich ebenfalls wieder über Plugins berichten und werde meinen Fokus auf neue WEB-Techniken setzen.

Eine Technik wurde im letzten APEX Community Tipp bereits näher beschrieben: D3js" in APEX-Anwendungen integrieren

Selbst wenn Sie kein Interesse an der gezeigten Technik haben, so ist die beschriebene APEX Integration allemal sehr informativ und lehrreich.

Außerdem habe ich auf Twitter noch einer sehr interessanten Link zu den besten Javascript Erweiterungen in 2014 gefunden (Dank an ).

Das zeigt einmal mehr was heutzutage alles möglich ist und verleiht einem das Gefühl wieder rumspielen zu wollen, wie damals unter APEX 3 mit AJAX.

Ps: Denkt dran Morgen ist Nikolaus https://apex.oracle.com/pls/apex/f?p=25787

APEX Hinter dem eisernen Vorhang... ;)

Oracle CONNECT BY Anzeige der maximalen Verkettung

$
0
0
Der Umgang mit CONNECT BY ist für mich immer wieder ein Highlight. Ob Positiv oder Negativ lasse ich mal außen vor. :)
Unbeachtet meiner Meinung ist es die sinnvollste Lösung um Baum-Verkettungen zu generieren.

Eine Anforderung die ich zuletzt gleich zweimal lösen musste war die Darstellung der finalen Ketten.

Beispiel Quell-Daten:
1:
1:2
1:2:3
1:2:4
1:6
1:6:1

Beispiel Ziel-Daten:
1:2:3
1:2:4
1:6:1

Das Ganze war recht einfach mit Hilfe einer analytischen Funktion zu lösen:
-- Tabele Definition
CREATE TABLE "T_ROUTE_EXAMPLE"
(
"ID" NUMBER,
"P_ID" NUMBER,
"NAME" VARCHAR2(50),
"TYPE" VARCHAR2(20),
PRIMARY KEY ("ID")
) ;

-- Data
REM INSERTING into T_ROUTE_EXAMPLE
SET DEFINE OFF;
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('1',null,'Haus S','BUILDING');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('3','1','Switch_S_1','SWITCH');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('4','3','1/3','PORT');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('5','3','2/3','PORT');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('6','3','3/3','PORT');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('7','1','Switch_S_2','SWITCH');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('8','7','1/2','PORT');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('9','7','2/2','PORT');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('10','4','DHCP Server','SERVER');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('11','5','orclapex DB Server','SERVER');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('12','6','ORDS Server','SERVER');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('13','8','WEB Server','SERVER');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('14','9','AD Server','SERVER');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('15',null,'Haus G','BUILDING');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('16','15','Switch_G_1','SWITCH');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('17','16','1/3','PORT');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('18','16','2/3','PORT');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('19','16','3/3','PORT');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('20','17','Win Client 1','CLIENT');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('21','18','Win Client 2','CLIENT');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('22','19','Mac Client 1','CLIENT');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('23',null,'Haus D','BUILDING');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('24','23','Switch_D_1','SWITCH');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('25','24','1/2','PORT');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('26','24','2/2','PORT');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('27','23','Switch_D_2','SWITCH');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('28','27','1/2','PORT');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('29','27','2/2','PORT');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('30','23','Switch_D_3','SWITCH');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('31','30','1/2','PORT');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('32','30','2/2','PORT');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('33','28','Mac Client 2','CLIENT');
Insert into T_ROUTE_EXAMPLE (ID,P_ID,NAME,TYPE) values ('34','29','Mac Client 3','CLIENT');
Hier das Select um das entsprechende Ergebnis zu generieren:
SELECT         
PATH_LENGTH,
ID,
P_ID,
NAME,
TYPE,
ID_LIST,
NAME_LIST,
TYPE_LIST
FROM
(
SELECT
case
when instr(':'||LEAD(ID_LIST) OVER (ORDER BY ID_LIST)||':',':'||ID_LIST||':') > 0
then null
else 'OK'
end as FINAL_PATH,

PATH_LENGTH,
ID,
P_ID,
NAME,
TYPE,
ID_LIST,
NAME_LIST,
TYPE_LIST
FROM
(
SELECT
LEVEL as PATH_LENGTH,
ID,
P_ID,
NAME,
TYPE,
SUBSTR(SYS_CONNECT_BY_PATH(ID, ':'),2) as ID_LIST,
SUBSTR(SYS_CONNECT_BY_PATH(NAME, ':'),2) as NAME_LIST,
SUBSTR(SYS_CONNECT_BY_PATH(TYPE, ':'),2) as TYPE_LIST
FROM T_ROUTE_EXAMPLE M1
start with M1.P_ID is null
CONNECT BY prior M1.ID = M1.P_ID
)
)
WHERE FINAL_PATH = 'OK'
Viewing all 177 articles
Browse latest View live