Browsing "Older Posts"

APEX-AT-WORK no image

Terrific Oracle forum exemplified by "wi (dd.mm.yyyy-dd.mm.yyyy)"

Von Tobias Arnhold → 2.20.2009
Did you ever had any problems with Oracle based issues like Database, APEX, Forms, SQL and so on? Of course you had.
Normally the Oracle Metalink is the first address for everybody who has a contract with Oracle. But in some cases the Oracle forum help is unbeatable.
What I mean is. Whenever you have a problem with SQL commands or APEX issues the fastest way to find a solution is to ask in the Oracle forums.

I want to bring up a special example I had. I needed some week and date values via a sql command for a month like that:
wi (dd.mm.yyyy-dd.mm.yyyy)
05 (01.02.2009-01.09.2009)
06 (02.02.2009-08.09.2009)
07 (09.02.2009-15.09.2009)
08 (16.02.2009-22.09.2009)
09 (23.02.2009-28.09.2009)

I couldn't fix it myself so I wrote a forum entry:
http://forums.oracle.com/forums/message.jspa?messageID=2842808
I got more then a tip I got a solution for the problem.

A couple of weeks later I just found out that the last week in February was missing. So I wrote a new post which was answered just a couple of hours later.
http://forums.oracle.com/forums/message.jspa?messageID=3279392

I think this type of help is sometimes more valuable then any GOLD support you can get. :D

By the way here is the solution for the problem: ;D

-- select all weeks for a year
select to_char(dt+(7*rn),'WW') ||' ('||
to_char(dt+(decode(rn,0,0,(7*rn)+1-offset))) ||'-'||
case when dt+(7*(rn+1))-offset > last_day(dt) then
last_day(dt) ||')'
else
dt+(7*(rn+1))-offset ||')'
end as show_value,
to_char(dt+(7*rn),'WW') as return_value
from (select to_date(mes||'2009','MMYYYY') as dt, to_number(to_char(to_date(mes||'2009','MMYYYY'),'D')) as offset
from dual, (select to_char(rownum, '00') mes from dual connect by rownum <= 12))
,(select rownum-1 rn from dual connect by rownum <= 6)
where trunc(to_date(dt+(decode(rn,0,0,(7*rn)+1-offset))), 'MM') = dt
order by dt, return_value asc
-- select all week for a month
select to_char(dt+(7*rn),'IW') ||' ('||
to_char(dt+(decode(rn,0,0,(7*rn)+1-offset))) ||'-'||
case when dt+(7*(rn+1))-offset > last_day(dt) then
last_day(dt) ||')'
else
dt+(7*(rn+1))-offset ||')'
end as show_value,
to_char(dt+(7*rn),'IW') as return_value
from (select to_date(02||2009,'MMYYYY') as dt from dual)
,(select to_number(to_char(to_date(02||2009,'MMYYYY'),'D')) as offset from dual)
,(select rownum-1 rn from dual connect by rownum <= 5)
where trunc(to_date(dt+(decode(rn,0,0,(7*rn)+1-offset))), 'MM') = dt
-- the way I use it in APEX
select to_char(dt+(7*rn),'IW') ||' ('||
to_char(dt+(decode(rn,0,0,(7*rn)+1-offset))) ||'-'||
case when dt+(7*(rn+1))-offset > last_day(dt) then
last_day(dt) ||')'
else
dt+(7*(rn+1))-offset ||')'
end as show_value,
to_char(dt+(7*rn),'IW') as return_value
from (select to_date(:P1_MONTH||:P1_YEAR,'MMYYYY') as dt from dual)
,(select to_number(to_char(to_date(:P1_MONTH||:P1_YEAR,'MMYYYY'),'D')) as offset from dual)
,(select rownum-1 rn from dual connect by rownum <= 5)
where trunc(to_date(dt+(decode(rn,0,0,(7*rn)+1-offset))), 'MM') = dt

Special thanks to BluShadow and Miguel Chillitupa!
APEX-AT-WORK no image

Set up column width in an APEX report (for Firefox)

Von Tobias Arnhold → 2.13.2009
Most of you would say: "Why is that so special? Just go to
Report Attributes>Column Attributes>Column Formatting>CSS Style and add for example: width:100px"

Like the help says:
"Use this attribute to apply a style to a column value. For example, setting this attribute to 'color:#FF0000;' will result in the following html being generated:
<span style="color:#FF0000">Sample Data</span>
This will change the text color of the column to red."

You all are right but there is a problem with Firefox which is ignoring this setting.
Why? Take a look here:
http://www.velocityreviews.com/forums/t163666-firefox-ignores-the-style-width-attribute-in-the-span-tag.html

How to fix that now? I use the div tag in my sql statement for the report:

SELECT '<b><div style="width: 150px; text-align: left">Employee no.: ' || "EMP"."EMPNO" ||
'</div></b>' as "EMPNO",
'<div style="border: 1px solid rgb(204, 204, 204); padding: 2px; width: 150px; background-color: rgb(225, 225, 225); text-align: center">' ||
"EMP"."ENAME" || '</div>' as "ENAME",
'<div style="border: 1px solid rgb(204, 204, 204); padding: 2px; width: 100px; background-color: rgb(225, 225, 225); text-align: center">' ||
"EMP"."HIREDATE" || '</div>' as "HIREDATE",
'<div style="border: 1px solid rgb(204, 204, 204); padding: 2px; width: 100px; background-color: rgb(225, 225, 225); text-align: center">' ||
"EMP"."SAL" || '</div>' as "SAL",
'<div style="border: 1px solid rgb(204, 204, 204); padding: 2px; width: 100px; background-color: rgb(225, 225, 225); text-align: center">' ||
"EMP"."COMM" || '</div>' as "COMM"
FROM "EMP"
-- </div> - div tag is needed to create the css style attributes
-- "width: 150px;" - for column width
-- "text-align: left" - for text alignment
-- "background-color: rgb(225, 225, 225)" - for column background color
-- "border: 1px solid rgb(204, 204, 204)" - for border color
-- "padding: 2px" - for empty place between text and border


Example application in action: http://apex.oracle.com/pls/otn/f?p=25472:30

Forum entry to it: http://forums.oracle.com/forums/thread.jspa?forumID=137&threadID=854151

Honestly I think there is another way to fix this issue which I don't know yet but I would really appreciate to get to know about it. :D

To all: Enjoy the weekend, have fun and DON'T think about the world economic crisis. :)
APEX-AT-WORK no image

Focus problem with IE6 and APEX_ITEM.SELECT_LIST_FROM_LOV

Von Tobias Arnhold → 2.12.2009
If you are using the SELECT_LIST_FROM_LOV item in your apex reports you may have noticed that you can get some trouble with the Internet Explorer 6.

For example your report includes 100 rows which are all displayed on one page and you must scroll up and down to reach all items. In case you have the focus on one of your select list items and set it from value x to y and immediately after that you want to scroll down. The cursor stays in the item and scrolls inside instead of outside the page.

This behavior just appears with IE6 all newer browser works after a standard behavior. After you selected an item value and you start scrolling, the page scrolls after your mouse movement.

How to fix this issue with IE6? You need to edit your SQL select statement for your report:

-- select statement with IE6 problems
select
b_id as "Book number",
'<b>'||b_name||'</b>' ||
' (' || b_description || ') ' as "Book name"
apex_item.SELECT_LIST_FROM_LOV(
1, -- p_idx
b_category_id, -- p_value
'LOV_BOOK_CATEGORIES', -- p_lov
'', -- p_attributes
'YES', -- p_show_null
'', -- p_null_value
'no book category selected', -- p_null_text
'', -- p_item_id
'' -- p_item_label)
as "Book category"
from books;

-- fixed select statement with attribute for wrong focus behavior
select
b_id as "Book number",
'<b>'||b_name||'</b>' ||
' (' || b_description || ') ' as "Book name"
apex_item.SELECT_LIST_FROM_LOV(
1, -- p_idx
b_category_id, -- p_value
'LOV_BOOK_CATEGORIES', -- p_lov
'onChange="body.focus()"', -- p_attributes
'YES', -- p_show_null
'', -- p_null_value
'no book category selected', -- p_null_text
'', -- p_item_id
'' -- p_item_label)
as "Book category"
from books;

You need to use onChange="body.focus()" in the attribute section.

Of course you can also use this functionality in a normal select list item.
Go Edit Page Item>Element>HTML Form Element Attributes
and add: onChange="body.focus()"
APEX-AT-WORK no image

Administration and development tools I work with

Von Tobias Arnhold → 2.09.2009
Hi all!
I wrote a lot about APEX the last couple of month. Now I want to write about the tools/applications I use to get these apps running and having always the full grip over it.

What main points should an application including to be usable in my eyes?
  • It should work for what I bought it "no more, no less"
  • It should be fast (During start up and use)
  • It should be always accessible better portable (like on an usb stick)
  • It should be intuitive and easy to use
  • It shouldn't cost to much (I mean thousands of €uros) or better be freeware or open source
Database administration tools:
Monitoring
  • LAB128 (Commercial) - One of the jewels: it fits to all main points I wrote before
Log file analysis
  • OraSentry (Charityware) - Small tool which shows you if your alertlog/database is in trouble
SQL and PL/SQL development tools:
  • PL/SQL Developer (Commercial) - In my eyes the best development tool for pl/sql programming
  • TORA (GPL) - This one (a tool with a long history) needs to be named too.
Database modeling tools:
  • DBSchema (Commercial) - A really good mix between price and performance
  • Schemester (Freeware) - I liked this one a lot unfortunately its not longer under development
Data mapping:
  • FlowHeater (Commercial) - A really good data mapping tool for an unbeatable price. It is still under development and unfortunately (until now) only in German available
HTML, CSS and JS development:
  • Notepad++ (GPL) - A must have for fast and easy programming
Website debugging tools:
  • Firefox - Of course a must have for all APEX developers
With these add ons:
  • Colorzilla
  • Firebug
  • Greasemonkey
  • IE Tab
  • Resizeable Textarea
  • Web Developer
Have fun trying them out and maybe some of you know other really good tools. Real jewels for the apex development community.

And of course I just write about them because I like them (and paid for them) and not because they paid for me. :D