Browsing "Older Posts"

APEX-AT-WORK no image

Handling the 32k problem in APEX charts

Von Tobias Arnhold → 4.03.2011
How to handle more then 32k (32768) characters inside your APEX charts: AnyChart gantt with custom xml and more then 32k

Workaround:

- Create your own chart

Info:
- AnyChart documentation: Set XML As String From TextArea

HTML Header:http://www.blogger.com/img/blank.gif

<script src="#APP_IMAGES#anychart_intkit.js" language="javascript"></script>

PL/SQL Region:

/* ... */
htp.p('<textarea cols="65" rows="17" id="rowData" style="display:none;">');

/* Write CLOB through a package function */
P_CLOB := MY_PACKAGE.F_APEX_GANTT_COMPLETE ( P_USER );

dbms_lob.open(P_CLOB, dbms_lob.lob_readonly);

P_LENGTH := dbms_lob.getlength (P_CLOB);

while P_LENGTH > 0 loop

/* Read 32000 characters from CLOB */
dbms_lob.read(P_CLOB, P_CLOB_BUFFER, P_POS, P_SET);

/* Write code in APEX */
htp.prn(P_SET);

/* Increase Counter */
P_POS := P_POS + P_CLOB_BUFFER;
P_LOOP := P_LOOP + 1;

/* Resize CLOB length */
P_LENGTH := P_LENGTH - P_CLOB_BUFFER;

end loop;

dbms_lob.close(P_CLOB);

htp.p('</textarea>');
htp.p('<div id="chartDiv"></div>');

htp.p(
'<script type="text/javascript" language="javascript">' || chr(10) ||
'/* Set default swf path */' || chr(10) ||
'AnyChart.swfFile = ''/i/flashchart/anygantt_4/swf/AnyGantt.swf'';' || chr(10) ||
'/* Create new gantt chart */' || chr(10) ||
'var chart = new AnyChart();' || chr(10) ||
'chart.width="2500";' || chr(10) ||
'chart.height="1400";' || chr(10) ||
'/* Get string data from text area */' || chr(10) ||
'var data = document.getElementById(''rowData'').value.toString();' || chr(10) ||
'/* Set data */' || chr(10) ||
'chart.setData(data);' || chr(10) ||
'/* Write chart to "chart" div */' || chr(10) ||
'chart.write("chartDiv");' || chr(10) ||
'</script>');
/* ... */


I created a region plug-in based on the above code to handle the huge charts! :)
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