Browsing "Older Posts"

APEX-AT-WORK no image

Remove delete icon in SkillBuilders Super LOV

Von Tobias Arnhold → 3.25.2011
Do you like the Super LOV as much as I do? It is just a great plug-in.

Some customers didn't like the delete button to erase the selected value. I could not find any setting to disable this icon.

Workaround:
Add a dynamic action "after page load" which executes some javascript with this little piece of code:
$('.superlov-modal-delete').remove();

That's it.

Customize Interactive report header graphic

Von Tobias Arnhold → 3.22.2011
Create a new image called report_bg_red.gif:

Add this inside your page header to exchange the IRR default image:

.apexir_WORKSHEET_DATA th {
background: url("/i/my_images/ir_styles/report_bg_red.gif") repeat-x scroll 0 0 #AAAAAA;
}

Change "/i/my_images/" with your image directory.

If you want to customize even more CSS watch this blog post of Shakeeb Rahman: http://apex.shak.us/post/1145946801/fully-control-your-interactive-reports-toolbar
APEX-AT-WORK no image

SQL: Count character in column or string

Von Tobias Arnhold → 3.21.2011
Use this sql select to count a special character inside a column or string:

Column selection:

select col, length(col)-length(replace(col,',',''))
from
(select 'col1,col2,col3,col4' as col from dual);

COL LENGTH(COL)-LENGTH(REPLACE(COL,',',''))
------------------- ---------------------------------------
col1,col2,col3,col4 3

String selection

BEGIN
:P1_STRING := 'col1,col2,col3,col4';

select length(:P1_STRING)-length(replace(:P1_STRING,',','')) into :P1_CHAR_CNT from dual;
END;


Watch this thread on Ask Tom: http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:55423584511523
APEX-AT-WORK no image

APEX bug with APEX_ITEM and POPUPKEY_FROM_LOV

Von Tobias Arnhold → 3.17.2011
Try to set two POPUPKEY_FROM_LOVs beside each other with the column ids: 2,3

select
APEX_ITEM.CHECKBOX (1,ac.ac_id) as ac_id,
APEX_ITEM.POPUPKEY_FROM_LOV(2,ac.application_key,'lov_apps',50) as application,
APEX_ITEM.POPUPKEY_FROM_LOV(3,ac.system_key,'lov_systems',50) as system
from app_conf ac;

When you run the page then APEX automatically creates a hidden field for the return value of the "popup lov".

The output looks like that:
column "application": Return column id = 2, Display column id = 3
column "system": Return column id = 3, Display column id = 4

If you set a value for column "system" it saves the "return value" in the "display value"-field of column "application".

Workaround: Use at least two numbers in between to avoid this behavior:

select
APEX_ITEM.CHECKBOX (1,ac.ac_id) as ac_id,
APEX_ITEM.POPUPKEY_FROM_LOV(2,ac.application_key,'lov_apps',50) as application,
APEX_ITEM.POPUPKEY_FROM_LOV(4,ac.system_key,'lov_systems',50) as system
from app_conf ac;

New plug-in "Add favorite"

Von Tobias Arnhold → 3.16.2011
Have you ever looked for a solution to create an "add favorite"-button which let the user bookmark your website. You probably found out that each browser uses an own solution for it. I put it all into a nice little dynamic action plug-in. It supports to load only the "add favorite"-function, bookmark the current APEX page, bookmark any other page you define through the plug-in.

Supported browsers: MS Internet Explorer, Firefox, Opera

Demo: http://apex.oracle.com/pls/otn/f?p=65560:ADD_FAVORITE



I'm still working on the demo and will release all new plug-ins in the next couple of weeks. For all who want those plug-ins before the release then refer to this post: How can we help Japan?

Tobias
APEX-AT-WORK no image

How can we help Japan?

Von Tobias Arnhold → 3.12.2011
To help the suffering people of Japan my applications from now on "cost" a donation (no matter how small or big) via any aid organisation of Your own choice. All You APEX users who are interested in my plug-in example application just have to send me an e-mail (tobias-arnhold@hotmail.de) including a confirmation of Your donation and You are able to get the export of the application "for free". I hope You have understanding and will do this small effort. I am very greatful for Your cooperation.

Plug-in example application: http://apex.oracle.com/pls/otn/f?p=65560:DONATE_TO_JAPAN

The example application also includes the new "Icon Loader" Plug-in

The plug-in will soon be released.

Info: The application can not be downloaded anymore from my workspace on apex.oracle.com

If you want to then feel free to follow my example and either develope your own "donation for application" -site or you can get access to my workspace "APEX_PLUGINS" and integrate your plug-ins there. I will buy it ;O)
APEX-AT-WORK no image

Range Slider Plug-in for APEX?

Von Tobias Arnhold → 3.08.2011
I'm a bit surprised that there is no range slider plug-in for APEX yet. At least I couldn't find one.

There are a couple of nice examples out there in the wild. I'm curios if somebody of you uses such a plug-in in APEX or is developing a plug-in right now?

I saw one blog entry from Paul Brookes: http://peekbee.blogspot.com/2010/02/range-slider-plugin.html
But the plug-in seems not to be released on: http://www.apex-plugin.com/

List of nice slider solutions:
http://www.paciellogroup.com/blog/misc/samples/aria/slider/doubleslider.html
http://jqueryui.com/demos/slider/#range
http://www.noupe.com/javascript/30-javascriptajax-techniques-for-sliders-scrollers-and-scrollbars.html

I also started a forum entry about it:
http://forums.oracle.com/forums/thread.jspa?threadID=2187679&tstart=0

I will let you know if I here anything about it.
APEX-AT-WORK no image

Es sind die kleinen Dinge, die APEX 4 so viel besser machen

Von Tobias Arnhold → 3.07.2011
Ich habe heute eine Frage im APEX Forum beantwortet. Diese recht trivial klingt, aber in der Konstellation doch recht anspruchsvoll wurde.

Ausgangslage:
Ein Entwickler hat zwei Textfelder: P1_FIELD_A, P1_FIELD_B und beide Felder sind im DATE-Format.
Wenn er das Feld P1_FIELD_A verlässt, dann soll das Feld P1_FIELD_B den Wert von P1_FIELD_A erhalten und diesen Wert automatisch um 1 Jahr erhöhen.

Wie gesagt es klingt recht einfach, sofern Sie PL/SQL verwenden dürfen und APEX 4.0 im Einsatz haben!

Kreieren Sie eine Dynamic Action > "Erweitert" > Event: "Lose Focus" > Item: P1_FIELD_A

TRUE Action: "Set Value" > Set Type: "PL/SQL Expression" >
Code: to_char(add_months(to_date(:P1_FIELD_A,'DD.MM.YYYY'),12),'dd.mm.yyyy')
Page Items to Submit: P1_FIELD_A

Affected Elements: Items > Item: P1_FIELD_B

Mit APEX 3 sah das noch ganz anders aus!
Statt einfach auf eine PL/SQL Funktion zugreifen zu können, musste diese über Javascript als Application Prozess eingebunden werden. Statt 5 Klicks brauchten Sie 20 Zeilen Code der an verschiedenen Stellen lag.
Ich habe die Aufgabe versucht mit Javascript zu lösen. Verdammt unschön und aufwendig so ganz ohne PL/SQL:

Dazu müssen Sie dem Element P1_FIELD_A folgenden Code unter "HTML Form Element Attributes" zuweisen:

onblur="javascript:fnc_field_b(this)"

Und im Page Header folgte dieser JS Code:

<script>
function fnc_field_b(v_field_a){
/* Input: mm/dd/yyyy */
/* Output: dd.mm.yyyy */
/* Documentation: http://www.javascriptkata.com/2007/04/27/mastering-of-the-date-object-in-javascript/ */
/* http://programming.top54u.com/post/Javascript-Convert-String-to-Date.aspx */

/* Create date object */
var myDate = new Date(v_field_a.value);

/* Add 1 year */
myDate.setDate(myDate.getDate() + 365);

/* Create output string DD.MM.YYYY */
/* Day */
var myStr = (myDate.getDate() < 10 ? "0" + myDate.getDate().toString() : myDate.getDate().toString()) + ".";
/* Month */
myStr = myStr + (myDate.getMonth()+1 < 10 ? "0" + (myDate.getMonth()+1).toString() : (myDate.getMonth()+1).toString()) + ".";
/* Year */
myStr = myStr + myDate.getFullYear().toString();

/* Set value */
$s('P1_FIELD_B',myStr);
}

Dabei ist dieser Code noch nicht einmal inhaltlich vollständig. Javascript kann nur das Format mm/dd/yyyy direkt in Date umwandeln.
Ok und diese:
* MM-dd-yyyy
* yyyy/MM/dd
* MM/dd/yyyy
* MMMM dd, yyyy
* MMM dd, yyyy
Unser beliebtes dd.mm.yyyy ist nicht dabei. Also müsste man dieses via ein paar ausgefeilten String-Funktionen noch umwandeln und unter Umständen noch eine Regular Expressions zum Fehlerhandling hinzufügen.
Javascript unterstützt auch nicht die to_char-Funktion. Weshalb ein recht komplexer Script zu umwandeln benötigt wird. Das Gute an JS ist, dass es unzählige Beispiele im Netz gibt.
Weshalb dieser Part recht einfach zu lösen war (http://www.javascriptkata.com/2007/04/27/mastering-of-the-date-object-in-javascript/).

Nur zur Info: Die meisten anderen Web-Entwickler haben kennen keine Dynamic Action Logik bzw. kennen kein PL/SQL.

Das zeigt nur im kleinem Beispiel warum die Entwicklung von APEX Anwendungen so schnell geht.
Ich vergleiche das immer mit Oracle Forms und Oracle Java Alternativen dazu. Wieso tief in den Programmierschichten graben wenn das Leben doch so leicht sein kann. :)

Den Forum Beitrag finden Sie hier: http://forums.oracle.com/forums/thread.jspa?threadID=2186734&tstart=0