Auto Sequence/ Serial Number Assign to Column in IG - Oracle Apex

Auto (Sequence) Serial Number Assign to Column in IG - Oracle Apex

1) Function and Global Variable Declaration

function UpdateSrno()
{
apex.region("GRVDTLID").widget().interactiveGrid("getActions").set("edit", true);
apex.region("GRVDTLID").widget().interactiveGrid("getViews", "grid").view$.grid("selectAll");
var widget = apex.region("GRVDTLID").widget();
var grid = widget.interactiveGrid("getCurrentView");
var model = grid.model;
var selectedRecords = grid.getSelectedRecords();
var i =1;
if ( grid.supports.edit )
{   
   model.forEach(function(record, index, id) 
    {
   
     meta = model.getRecordMetadata(id);
         if (!meta.deleted)
             {
        sr  = model.getValue(record,"SRNO");
          model.setValue(record,"SRNO", (i).toString()); 
          i++;
             }
        });  }}
  
2) Call the function on Button or URL  before Save action 

javascript:UpdateSrno();apex.confirm(htmldb_edit_message,'SAVE');

Comments

Popular posts from this blog

Telegram Integration with Oracle

The username or password for the connection pool named |apex||, are invalid, expired, or the account is locked

Enabled SQL Developer Web (SDW) & ORDS Database API ORDS 19.4