Browsing "Older Posts"

Automatic linebreak if word breaks out of table element

Von Tobias Arnhold → 3.11.2010
I found a great source how to prevent word break outs in <th> and <td> elements:
Peter Bromberg's: FIREFOX / IE Word-Wrap, Word-Break, TABLES FIX
How does the break out looks like:


CSS code to prevent this issue:
.prevent_breakout
{
width: 250px;
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
}

With javascript it could look like this:
<script type="text/javascript">
 function set_lb(v_val, v_max_width){
  var v_browser=navigator.appName; 
  // ...
  if (v_browser=="Microsoft Internet Explorer")  
  {
    $x(v_val).style.width = v_max_width; // set width
    $x(v_val).style.wordWrap   = 'break-word';  // Internet Explorer 5.5+
  }else
  {
    $x(v_val).style.width = v_max_width; // set width
    $x(v_val).style.whiteSpace = 'pre-wrap'; // css-3
    $x(v_val).style.whiteSpace = '-pre-wrap';  // Opera 4-6
    $x(v_val).style.whiteSpace = '-o-pre-wrap';  // Opera 7
    $x(v_val).style.wordWrap   = 'break-word';  // Internet Explorer 5.5+
    $x(v_val).style.whiteSpace = '-moz-pre-wrap'; // Mozilla, since 1999
  }
</script>

Thanks Peter for this great hint!

Update 07.05.2010
Report Attributes > Column Attributes > Column Formatting > CSS Style:
overflow:hidden;float:left;width:250px;word-wrap:break-word;white-space:pre-wrap;display:block;
APEX-AT-WORK no image

Weird IE behaviour with JS function String.charAt(Index)

Von Tobias Arnhold → 3.10.2010
I had a real pain with the MS Internet Explorer and the javascript function String.charAt(Index)

I wanted to update a string and checked each value. IE was able to give just an empty value back. But it was not checkable!

if ((v_browser=="Microsoft Internet Explorer")&& (v_string.charAt(x)=='')&& (y+1==x) && (v_string.charAt(x+1)=='<'||v_string.charAt(x+2)=='<'))

Even the length was 1 and not 0!
Finally I tried this function String.charCodeAt(Index) with an alert box and voilà two values where prompted: 13 and 10

13 and 10 wait... LINEBREAK!

HELL why does it do such things...

Now I could check it!

if ((v_browser=="Microsoft Internet Explorer")&&(v_check_unicode=='13'||v_check_unicode=='10'||v_check_unicode=='NaN'))

My script works and I feel released.
Now I have to watch the end of Real against Lyon.. :D

Column header groups in APEX report

Von Tobias Arnhold →
Did you ever want a report header grouped like this:


Just add some html code into your report template > column headings > Before Column Heading:


Important to know:
- Changes like this have effect on every report you use with that report template
- Make a copy of your existing report template and use the new one instead

In my example I used 8 columns and three of them should have a group column above it. Use colspan="3" to stripe it over 3 columns.

Here the generated HTML code:


For APEX Interactive Reports watch there:
Dimitri Gielis: Group Headings in an Interactive Report (APEX)
And there:
Martin Giffy D'Souza: Column Groups in APEX Interactive Reports
APEX-AT-WORK no image

AJAX based select list in APEX - Part 2

Von Tobias Arnhold → 3.01.2010
I couple of days ago I wrote about a way using AJAX based select lists in APEX.
After some hints from Peter Raganitsch I tried the ApexLib Framework but I run into some issues with ExtJS.
Error message:
vFieldValue is undefined
populateLovField(Object { name="pFieldId"}, Object { name="pLovEntry"})ApexLib_Full.js
populateDependingLovs(Object { name="pFieldId"})ApexLib_Full.js
(?)()ApexLib_Full.js
(?)(Object { name="pEvent"})ApexLib_Full.js
vAjaxRequest.add(pLovEntry.oUsedFi...ace(/\:/g, String.fromCharCode(1)));

Error part where somehow an ExtJS function got called:

vAjaxRequest.add(pLovEntry.oUsedFieldList[ii], vFieldValue.replace(/\:/g, String.fromCharCode(1)));

I found another solution from Carl Backstrom: Ajax Selects
I modified his script a bit and used it in my environment.

Using the ApexLib would have been much easier luckily I just had a really small application.

Good for us that APEX 4.0 will solve these problems by a new standard feature:
Oracle APEX 4.0: Cascading LOVs/Select Lists

AaW - DBMON First pictures / Erste Bilder

Von Tobias Arnhold → 2.22.2010
The following post is targeted towards a German audience, thus it is in German:

Anfang Februar habe ich über eine Oracle DB Monitoring Anwendung für die deutsche APEX Community berichtet: Whats about the German APEX users?
Endlich habe ich es geschafft ein paar Screenshots zu erstellen. Die Anwendung basiert auf APEX und ExtJS und sammelt derzeit folgende Informationen:
- Tablespace Auslastung
- CPU Auslastung
- Buffer Hitratio Auslastung
- Session Zähler
- PGA Auslastung
- Init.ora Paramter
- Aktueller DB Status

Daten werden durch den DBMS_SCHEDULER über ein PL/SQL Package zu spezifizierten Zeiten gesammelt und können dadurch rückwirkend ausgewertet werden.
Gerade für Oracle XE Umgebungen kann dieses kleine Tool von nutzen sein.

Derzeit suche ich noch Beta-Tester, um für Ende März eine erste Testversion auf Herz und Nieren zu überprüfen. Wenn Interesse besteht, schickt einfach eine Email an: Tobias Arnhold (tobias-arnhold@hotmail.de)

Hier die ersten Screenshots:



APEX-AT-WORK no image

Set item value with AJAX

Von Tobias Arnhold → 2.17.2010
Update an APEX item dynamically with AJAX:

// 1. Item: HTML Form Element Attributes:
onChange="javascript:fnc_setValue('P1_VALUE')";

// 2. Page: HTML Header
<script language="JavaScript1.1" type="text/javascript">
function fnc_setValue(v_item)
{
var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=v_dummy',0);
get.add(v_item,html_GetElement(v_item).value)
gReturn = get.get();
html_GetElement(v_item).value = v_item;
get = null;
}
</script>

Denes described it more detailed (plus example) in his blog:
Setting Item Session State using Ajax

Have you seen the advanced freeze panes example like you can use in Oracle Forms?
Freeze Panes in an APEX Report: Now with columns

Updated script 22.02.2010:

// 1. Item: HTML Form Element Attributes:
onChange="javascript:fnc_setValue('P1_VALUE')";

// 2. Page: HTML Header
<script type="text/javascript">
function fnc_setValue(v_item)
{ // Works with select lists, radio buttons, ...
var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=v_dummy',0);
get.add(v_item,$v(v_item))
// For Display as Text items add:
// html_GetElement('v_item').innerHTML = $v(v_item);
gReturn = get.get();
get = null;
}
</script>
APEX-AT-WORK no image

Making a connection from Oracle XE to MySQL with ODBC

Von Tobias Arnhold → 2.15.2010
After searching the Web I found a nice description from James Koopmann: Making a Connection from Oracle to SQL Server

Then I found a Metalink note: WIN NT - Generic Connectivity using ODBC [ID 114820.1]

What software do you need? MySQL ODBC driver

Now follow these steps:
1. Add a new file:
<ORACLE HOME>\hs\admin\initMYSQL_DB.ora
# This is a sample agent init file that contains the HS parameters that are
# needed for an ODBC Agent.

#
# HS init parameters
#
HS_FDS_CONNECT_INFO = MYSQL_DB
HS_FDS_TRACE_LEVEL = OFF

#
# Environment variables required for the non-Oracle system
#
#set =


2. Update your Listener.ora (In my case I use the existing one):
...
(SID_DESC=
(SID_NAME=MYSQL_DB)
(ORACLE_HOME=F:\oracle\app\oracle\product\10.2.0\server)
(PROGRAM=hsodbc)
)
...

3. Update your TNSNAMES.ora and restart your Listener:
...
MYSQL_DB =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.1)(PORT=1521))
(CONNECT_DATA=(SID=MYSQL_DB))
(HS=OK)
)
...

4. Create database link inside your database:
create database link MYSQL_DB
connect to "test_db" identified by "test_db"
using 'MYSQL_DB';

5. SQL> select * from test_table@MYSQL_DB;

Issues I know about: Invalid identifier problem