Oracle APEX 4.0: How to create a Plug-in

As promised on Saturday, I had a look at my existing plug-in tutorials, reworked them a little bit and have uploaded them so that you can try them out. There are in total five different tutorials for the different available plug-in types supported by Oracle Application Express 4.0. I ordered them based on there complexity. I would suggest that you process them in that order.

Update 24-Mar-2010
Note: The code for the How To’s is not up-to-date. For EA2 we had to make some interface changes. Please see the field level help or my plug-in sample application for the changed interface definition.

Plugin-HowTos.zip contains all the necessary files to get you started. If you want to have a look at more plug-ins or just want to try them out, get my Plug-in Sample Application and install it into your APEX 4.0 Early Adopter Workspace. The plug-ins can be found in Shared Components – Plug-ins.

Have fun playing with plug-ins and I’m looking forward to your feedback and enhancement requests ;-)

36 thoughts on “Oracle APEX 4.0: How to create a Plug-in

  1. Pingback: Creating plugin item types using Apex 4.0

  2. tried the highlight plug-in; was able to create the plug-in, but when i tried to upload the highlight.js file i got:

    ORA-01407: cannot update (“APEX_040000″.”WWV_FLOW_PLUGIN_FILES”.”MIME_TYPE”) to NULL

    Unable to process row of table WWV_FLOW_PLUGIN_FILES.

    any ideas?

  3. Dumb question: Does your Plug-in Sample application use all of the plug-in types in the How-To? I’m not sure I know where to look for them when I run it. I mean, I see the Plug-ins menu tab and the two maps are cool, but what about the other plug-in types?

    Thanks,

    Stew

  4. Oops, found my answer with just a little looking through the application (Shared Components->Plug-ins) where I can see exactly where you use the plug-ins you wrote the How-tos for!

    Sorry for the dumb (lazy?) question!

    Some very cool stuff happening here! I especially like the Get-Data plug-in! It’s a whole lot easier to write the query for that than to write all the Javascript it usually requires!

  5. Pingback: Apex 4.0 Early Adopter – first shot « My favorite software tools

  6. Hi Patrick,

    I get the folowing error mes when installing your demo app:

    ORA-20001: GET_BLOCK Error. ORA-20001: Execution of the statement was unsuccessful.
    ORA-20001: Error creating branch id="860762340250241075"
    ORA-30036: unable to extend segment by 8 in undo tablespace ‘UNDOTBS1′ <pre>begin wwv_flow_api.create_page_branch( p_id=&gt;793704207557714686 + wwv_flow_api.g_id_offset, p_flow_id=&gt; wwv_flow.g_flow_id, p_flow_step_id=&gt; 7, p_branch_action=&gt; ‘P7_BRANCH’, p_branch_point=&gt; ‘AFTER_PROCESSING’, p_branc

    Kind regards

    Johannes

  7. Hi Patrick,

    Exploring APEX4.0 has been exciting. Thanks for the good work done in APEX development team.

    I want to highlight a text field based on the color chosen from select list item. I created a select list P1_COLOR with Green, Red, Yellow and text item P1_TEXT. In dynamic action on P1_COLOR, how do I specific value of P1_COLOR for the Color attribute?

    Thanks
    Kishore

  8. I tried to create your highlight plugin and use in the sample application but it failed. I believe APEX 4.0 changed after you created it. It did not match step 32 forward. So when I tested it, I got an error. Also step 16 and 20 assigning List values differs too.

  9. Hi Robert,

    yes some of the names in the How To do not match with the actual UI. That has already been fixed and I will republish the How To when we refresh our EA instance.

    BTW, you can use my plug-in sample application to get a working copy of the Highlight plug-in.

    Regards
    Patrick

  10. Hi Kishore,

    using the current value from the browser is a little bit more difficult, because the existing dynamic actions use static values of values from the browser. You have two options:
    1) Create 3 dynamic actions on P1_COLOR where you have a condition for each color and use that color as fixed value in your dynamic action to set the color.
    2) Create just one dynamic action and use the Javascript action with the following code:
    apex.jQuery.apex(‘#P1_TEXT’).attr(‘color’, $v(‘P1_COLOR’));

    Regards
    Patrick

  11. Hello Patrick, i tried to import your plugin_sample_app.sql file into the early adopter release of apex 4.0.
    In the workspace of tryapexnow there comes the error
    “File is not a valid Application Express plug-in export file.”
    I used different charsets to import the file but the error message above always comes at the point when i try to install it.

    Thx so far for your tips.

  12. Patrick,

    Do you know where I can find the Oracle documentation on how to create plugins? Don’t get me wrong, your tutorial application is great and your documentation really helps. I’d just like to see some of the Oracle documentation to see what’s possible with these things. I looked at the Apex help on EA3 and nothing there about creating plugins. Thanks for the great work!

    Earl

  13. Patrick,

    Anything you can offer on my question from May 15th? Thank you.

    Earl

  14. Hello,

    I’m developping an application where I use the GANTT CHART on Apex 4.0.0.0.46
    The issue is : The Gantt chart display only 15 tasks not more…
    I tried to look on the chart gantt parameters but the query is limited to read only 15 records…
    Why this limitation?
    How to solve this limitation?

    best regards

    M. Foggiato

  15. Hi Patrick,

    I have a question concerning apex region plugins.
    I want to be able to create a region plugin to control the subregions linked to a region based on this region plugin.

    What I want – as a proof of concept – is to render a div-tag, followed by the code of the sub regions and then finally i want to close my div tag.
    If I can do this then I can do anything I want.
    Though, I can render only html code before the subregions, not after.
    I know I can use a template and write header and footer html in there but I rather would not do that because one can easily change templates in the builder.

    So (how) can I create a region plugin that just renders a div tag before the subregions and a closing div tag after the subregions?

    Thanks a lot!!

  16. After downloadig the file jquery.maskedinput-1.2.2.min, i tried to install it in my apex 4 and the message was:
    “File is not a valid Application Express plug-in export file.”
    Can you help me to solve the problem?
    APEX is in pt-br and UTF-32
    Thank you

  17. Hi Mike,

    if I view the chart series for a gantt chart, I’m able to modify the attribute “Maximum Rows” to a different value. Are we talking about the same attribute?

    Regards
    Patrick
    PS: It’s better to ask these kind of questions on the OTN APEX Forum.

  18. Hi Dante,

    what do you want to do? Develop a plug-in or just install one? If you want to install a finished plug-in go to http://apex.oracle.com/plugins. The jquery.maskedinput-1.2.2.min.js file is not an APEX plug-in file, it’s just a JavaScript library.

    Regards
    Patrick

  19. Hi, Patrick
    Thank you for returning!
    I want just to install a plugin to implement masked fields with placeholders. Maybe i am making the wrong thing! I will try the other form you suggested.
    thank you, best regards. I am a fan of your website
    Dante

  20. Hi Patrick,

    Do you have a solution for my question posted on November 9th, 2010 at 23:38? (create a region plugin to control the subregions linked it).

    Thanks!

  21. Seems like in apex 4.0, Oracle changed the APIs of apex_plugin
    (apex_plugin.debug_dynamic_action has been changed to apex_plugin_util.debug_dynamic_action, but no idea about REGISTER_DYNAMIC_ACTION)

    I got following error when trying to create plugin source by highlight_plugin.sql
    And I checked the doc from Oracle, there is no such function any more…
    Anybody get ideas?

    1 error has occurred
    ORA-06550: line 38, column 22: PLS-00302: component ‘REGISTER_DYNAMIC_ACTION’ must be declared ORA-06550: line 38, column 5: PL/SQL: Statement ignored

    Thanks,
    Victor

  22. Hi Patrick,

    Thank you so much for such quick respond.
    Actually I’m learning the way that you demonstrated in how-tos to build my own ones.
    I’m currently dealing with apex_item.select_list_from_query. I has been trying to make it work with dynamic action – refresh, but after a lot of research, seems like the answers link me to ajax callback and then I found this page. :)
    My code is as following. I created dynamic action on change of ‘ATTR_1′ to refresh ‘ATTR_2′, but it didn’t work.
    ————-plsql region—————
    htp.p(apex_item.text(p_idx => 1
    ,p_item_id => ‘ATTR_1′));
    htp.p(apex_item.select_list_from_query(p_idx => 1
    ,p_item_id => ‘ATTR_2′
    ,p_query => ‘select to_char(sysdate,”mmddyyyy hh24:mi:ss”) as value , 1 as id from dual’));
    —————————————-
    I am also digging out some code like following, but have no idea how to use it yet. Seems like it’s part of plugin creation.
    apex_javascript.add_onload_code(p_code => ‘apex.widget.selectList(‘ ||
    ‘”#ATTR_2′ || ‘”,’ || ‘{‘ ||
    apex_javascript.add_attribute(‘ajaxIdentifier’
    ,apex_plugin.get_ajax_identifier) ||'”nullValue”:””});’);

    I also noticed that you mentioned some related topic in
    http://forums.oracle.com/forums/thread.jspa?threadID=1101985&tstart=1
    ,but I still didn’t get clue about my issue…

    Many Thank,
    Victor

  23. BTW,I’m using jquery selector in dynamic action and tried other action type like set value and hidden etc., they all work fine.

    If I just create select list via the builder, it works fine. In source code following code got generated.
    ————————-
    apex.jQuery(document).ready(function(){
    (function(){apex.widget.selectList(“#P1_XLIST”,{“ajaxIdentifier”:”4EA9F6B4CAC842F4356C68B74402C56E682B6E2A061C6EB768417C9C685749CB”,”nullValue”:””});})();
    ————————-

    And I can use following code to generate identical code for ‘ATTR_2′ as well, but it didn’t work.
    ———code in plsql—————-
    apex_javascript.add_onload_code(p_code => ‘apex.widget.selectList(’ ||
    ‘”#ATTR_2′ || ‘”,’ || ‘{’ ||
    apex_javascript.add_attribute(’ajaxIdentifier’
    ,apex_plugin.get_ajax_identifier) ||’”nullValue”:””});’);
    ———–generated code in html————–
    (function(){apex.widget.selectList(“#ATTR_2″,{“ajaxIdentifier”:”4EA9F6B4CAC842F4356C68B74402C56E682B6E2A061C6EB768417C9C685749CB”,”nullValue”:””});})();

  24. Hi Patrick ,

    I m very new to the concept of plugins and i m trying to learn from the examples pdfs given by u ..

    But in the creation of the item plugin , i m getting this error , though i did it exactly same.

    can u please ! help me out .

    ORA-06550: line 26, column 21: PLS-00302: component ‘DEBUG_PAGE_ITEM’ must be declared ORA-06550: line 26, column 9: PL/SQL: Statement ignored ORA-06550: line 109, column 21: PLS-00302: component ‘DEBUG_PAGE_ITEM’ must be declared ORA-06550: line 109, column 9: PL/SQL: Statement ignored

  25. ORA-06550: line 160, column 46: PLS-00222: no function with name ‘RENDER_MASK’ exists in this scope ORA-06550: line 160, column 1: PL/SQL: Statement ignored
    Error Error in PLSQL code raised during plug-in processing.
    OK

    Hi Patrick,

    I again faced the problem when i tried to comment the DEBUG_PAGE_ITEM process ,as this was specified for debugging purpose .

    I cud create the Plugin , when i created a item of this plugin type and executed the page , i got the above error.

    Regards,
    Nandini Thakur.

  26. when i commented the DEBUG_PAGE_ITEM part and executed it.

    The Plugin got created without any error .

    But when i created the Item of this type , it threw me error as follow :-

    ORA-06550: line 160, column 46: PLS-00222: no function with name ‘RENDER_MASK’ exists in this scope ORA-06550: line 160, column 1: PL/SQL: Statement ignored
    Error Error in PLSQL code raised during plug-in processing.
    OK

Comments are closed.