Skip to main content

Posts

Showing posts from 2019

Oracle APEX SYS_CONTEXT vs V Function

With APEX Version 5.0, new Application Context APEX$SESSION is introduced. User Name, Session ID and Work-space ID are populated into this context. I often read, using  APEX$SESSION Context is faster (gives better performance) than using V function, however, how fast is it? I have never measured it. It's been on my TODO list for long time and finally here is short test I did to measure the performance using both the approaches. DB Setup: I have created two views in APEX Parsing schema as follows. View demo_sys_context_v uses APEX$SESSION Context to get current APEX user name. CREATE OR REPLACE VIEW demo_sys_context_v  AS     SELECT         object_name     FROM         user_objects     WHERE         object_name = sys_context(             'APEX$SESSION'             ,'APP_USER'     ...

Few tips on Gantt Charts

Oracle APEX offers several beautiful chart types which are based on Oracle JET Data Visualizations. Gantt Chart is one such beautiful and useful chart. However, when I have searched in Google for some help on Gantt Charts, there are not many blogs posts talking about it. So, I thought, I could write one with few basic tips which I have learned this year. I have used Gantt Chart to display employees calendar data and my targeted output was something like below. Pic-1 Looks simple, correct? However, it's little tricky to get there. Multiple Tasks Per Row: When I look at the output, first I thought, I will have to write a query which gives tasks data and employee data with 1 row per task. That is, if there are 10 tasks to be displayed, then there should be 10 rows in SQL query output. But, it's not correct. Instead, I should have 1 row for each task + 1 row for each employee (parent). So I need to write a query which will output data in below format. Pic-2 A...

Read Only Conditions - Always and Never

Do you know any real use case for condition type "Never"? Do you know what is the difference between NOT SELECTING ANY  read only condition and selecting option "Always"? If your answer is "No" to either of these questions, then you may find this blog post useful. Read Only Condition: You can specify read-only condition at Page Level, Region Level or at Item Level. Read Only condition specified at page level applies to entire page. When the condition is met, all the items rendered on the page (including items from global page) will be displayed as read-only. Similarly, Read Only condition specified at region level applies to all items defined under that page. Advantages of using "Read Only" condition: Rendering : APEX automatically takes care how to display items in read only mode and what data to display. For e.g. for LOV based items, APEX will automatically display "Display" value. Security : When Item is read only, users s...

Interactive Grid - Add row from another report using JavaScript

There was a requirement to build a page where users can  search for data in a report and then choose a row to be added to Interactive Grid (IG),  besides regular way of adding rows to IG. There are two approaches (could be more) to achieve this. Old school approach is adding a row to APEX Collections when user chooses a row in report and using same collection in IG query. Other approach could be, doing something with JavaScript (JS) and build solution on top of IG framework using IG JS APIs, without using collections. When we convert this requirement into technical specification, essentially it has two parts. Adding new row to IG via JS Set values for newly added row via JS Luckily, there are JS APIs and functions already available to achieve both the points. Adding new row to IG via JS Adding new empty row via JS is rather straight forward and easy. // "order" is IG region static ID var $widget = apex.region( 'order' ).widget(); var $gr...

Interactive Grid - Bulk Operation on Selected Rows

What's the Problem? Let's say you have an IG on employee table and you want to update selected employees commission based on user's input. Ideally, it should be very simple, where you can write UPDATE statement in page process and select IG region as "Editable Region" under "Execution Options" of the page process. But, when you select rows and submit page, you can see that, this process won't get executed! The reason is  Selection of 'Row Selector' check-boxes is not considered as row-change. Thus selected rows are not submitted to server. So, is there any work around?  Yes! Luckily there are lot of JavaScript (JS) APIs available to work with IG. If you are not already aware, you can refer "APEX IG Cookbook"  or  JavaScript API Reference documentation. If we continue with above Employee IG example, when user selects IG rows, enters "Commission %" and clicks on "Update Commission" button, then we can writ...