Professional Documents
Culture Documents
Ontoor Blogs
Home / Posts / 2 ways to get total sum of Interactive Grid Column Oracle APEX
PLSQL SQL
Most of the time, this question was asked by my friends and colleagues that “How to
Calculate total sum of interactive grid column into page item in oracle APEX” then i got
solution in two ways.
Solution 1.
https://blogs.ontoorsolutions.com/post/2_ways_to_dynamicly_sum_grid_column/ 1/9
9/25/21, 5:15 PM 2 ways to get total sum of Interactive Grid Column Oracle APEX - Ontoor Blogs
1. Need to create an editable interactive grid report using emp table and Page item
Ontoor Blogs
Px_ITEM.
2. Copy and Paste below code in “Function and Global Variable Declaration”.
(function($) {
function update(model) {
total = 0;
meta = model.getRecordMetadata(id);
total += sal;
});
$s("P23_TOTAL", total);
$(function() {
var sid,
model = ui.model;
if ( ui.viewId === "grid" ) {
sid = model.subscribe( {
https://blogs.ontoorsolutions.com/post/2_ways_to_dynamicly_sum_grid_column/ 2/9
9/25/21, 5:15 PM 2 ways to get total sum of Interactive Grid Column Oracle APEX - Ontoor Blogs
update( model );
update( model );
},
progressView: $("#P23_TOTAL")
} );
update( model );
model.fetchAll(function() {});
});
});
})(apex.jQuery);
Solution 2:
1. Now create a dynamic action on the SAL column of IG for change event.
https://blogs.ontoorsolutions.com/post/2_ways_to_dynamicly_sum_grid_column/ 3/9
9/25/21, 5:15 PM 2 ways to get total sum of Interactive Grid Column Oracle APEX - Ontoor Blogs
Ontoor Blogs
2. Create a true action as Set Value. Set the type PL/SQL expression as :SAL and submit
the SAL.
3. Create another true action to execute JavaScript code and add the following code:
col_amt = model.getFieldKey("SAL");
model.forEach(function(igrow) {
if (!isNaN(n_amt)) {
n_totamt += n_amt;
});
apex.item("P23_TOTAL").setValue(n_totamt);
https://blogs.ontoorsolutions.com/post/2_ways_to_dynamicly_sum_grid_column/ 4/9
9/25/21, 5:15 PM 2 ways to get total sum of Interactive Grid Column Oracle APEX - Ontoor Blogs
Ontoor Blogs
Demo
Related Posts
Refresh region of base page when closing modal dialog | Oracle APEX
3 Ways to Unselect Default Checkbox in Interactive Grid Oracle APEX
APEX page types | Universal Theme
Smooth row view Interactive report Oracle APEX
Handle trigger Mutating Error
We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
0 Comments
- powered by
utteranc.es
Write Preview
https://blogs.ontoorsolutions.com/post/2_ways_to_dynamicly_sum_grid_column/ 5/9
9/25/21, 5:15 PM 2 ways to get total sum of Interactive Grid Column Oracle APEX - Ontoor Blogs
Ontoor Blogs
Sign in to comment
Styling with Markdown is supported
Sign in with GitHub
Vikas Pandey
APEX,PLSQL
Ontoor
India
About
Featured Posts
APEX_JSON.WRITE_RAW
First Day of the YEAR : ROUND (DATE)
Download files in APEX
Generate DDL of any object in ORACLE
https://blogs.ontoorsolutions.com/post/2_ways_to_dynamicly_sum_grid_column/ 6/9
9/25/21, 5:15 PM 2 ways to get total sum of Interactive Grid Column Oracle APEX - Ontoor Blogs
Recent Posts
APEX_JSON.WRITE_RAW
First Day of the YEAR : ROUND (DATE)
Download files in APEX
Generate DDL of any object in ORACLE
Upload Multiple Files in Oracle APEX
How to upload multiple files in APEX
ORACLE INVISIBLE Column can be used for column ordering
How to find ORACLE locked Objects?
APEX APIs
Oracle Application Express JavaScript API Reference
Article publishers
Categories
SCRUM 1
APEX Plugins
https://blogs.ontoorsolutions.com/post/2_ways_to_dynamicly_sum_grid_column/ 7/9
9/25/21, 5:15 PM 2 ways to get total sum of Interactive Grid Column Oracle APEX - Ontoor Blogs
APEX Plugins
Short Codes
Tags
https://blogs.ontoorsolutions.com/post/2_ways_to_dynamicly_sum_grid_column/ 8/9
9/25/21, 5:15 PM 2 ways to get total sum of Interactive Grid Column Oracle APEX - Ontoor Blogs
Sticky 1
Copyright © 2021 Ontoor Solutions. All Rights Reserved.
https://blogs.ontoorsolutions.com/post/2_ways_to_dynamicly_sum_grid_column/ 9/9