Container Over Loaded!!
Step 1 :
Go to page --> Function and Global Variable Declaration
function overLoad(){
let capacityCbm = $('#P312_CAPACITY_CBM').val();
let totalAdded = $('#P312_TOTAL_ADDED').val();
let capacityCbmParse = parseFloat(capacityCbm) ;
let totalAddedParse = parseFloat(totalAdded) ;
console.log(capacityCbmParse, totalAddedParse)
if (capacityCbmParse != null && totalAddedParse > 0){
if (totalAddedParse >= capacityCbmParse){
alert('Container Over Loaded');
document.getElementById("myBtn").disabled = true;
}
else{
document.getElementById("myBtn").disabled = false;
}
}
else{
null
}
}
Step 2 :
Select P312_CAPACITY_CBM & P312_TOTAL_ADDED
Custom Attributes: onchange="overLoad();"
Step 3 :
Select Create Button and Static ID: myBtn
=======================================
2nd Option:
=======================================
Validation
=======
IF :P318_CAPACITY_CBM <= :P318_TOTAL_ADDED
THEN return false;
else return true;
end if ;
Error Message : Container Over Loaded!!
=======================================
3rd Option:
=======================================
Step 1:
=====
Create a Dynamic Action on P16015_BATCH_ID item.
Action Name: CREATE Button Disable
=====
Create a Dynamic Action on P16015_BATCH_ID item.
Action Name: CREATE Button Disable
True Action: Execute Server-side Code
PL/SQL Code:
DECLARE
l_count NUMBER;
BEGIN
IF :P16015_BATCH_ID IS NOT NULL THEN
SELECT COUNT(*)
INTO l_count
FROM INV_TXN_REQUEST_HEADERS A,
INV_TXN_REQUEST_LINES B
WHERE A.REQUEST_ID = B.REQUEST_ID
AND A.BATCH_ID = :P16015_BATCH_ID;
ELSE
l_count := NULL;
END IF;
:P16015_BATCH_VERIFY := l_count;
END;
=== OR ===
True Action: Set value
SQL Code:
SELECT COUNT(*)
FROM INV_TXN_REQUEST_HEADERS A,
INV_TXN_REQUEST_LINES B
WHERE A.REQUEST_ID = B.REQUEST_ID
AND A.BATCH_ID = :P16015_BATCH_ID;
Items to Submit: P16015_BATCH_ID
Items to Return: P16015_BATCH_VERIFY
Step 2:
=====
=====
Again, True Action: Execute JavaScript Code
Code:
var cnt = $v("P16015_BATCH_VERIFY");
// When P16015_BATCH_VERIFY is NULL, then don't show error
if (cnt === "" || cnt === null) {
return;
}
// Convert to number
cnt = Number(cnt);
// COUNT = 0 then show error + button disable
if (cnt === 0) {
apex.message.clearErrors();
apex.message.showErrors([
{
type: "error",
location: "page",
message: "⚠️ No transaction data found for this Batch ID!",
unsafe: false
}
]);
$("#CREATE").prop("disabled", true);
return;
}
// COUNT > 0 then Button Enable + Error Clear
apex.message.clearErrors();
$("#CREATE").prop("disabled", false);
Button Static ID: CREATE
====================================
4rd Option:
====================================
When Value change Then run time shows an error Message.
At first, select the Line level/Details Amount column.
Select Item: P12834_LINE_TOTAL_AMOUNT -- Hidden item (Store Invoice Amount)
Create Dynamic Action.
Action Name: Validation Button Disable
Event: Change
Selection Type: Item(s)
Item(s): P12834_LINE_TOTAL_AMOUNT
True Action:
Execute JavaScript Code:
Code:
var lineamt = $v("P12834_LINE_TOTAL_AMOUNT");
var invamt = $v("P12834_INVOICE_AMOUNT");
// If count is NULL → skip
if (!lineamt) {
return;
}
// Convert to number
lineamt = Number(lineamt);
invamt = Number(invamt);
// If entered amount > invoice amount → show error + disable button
if (lineamt > invamt) {
apex.message.clearErrors();
apex.message.showErrors([
{
type: "error",
location: "page",
message: `⚠️ You cannot enter more than the Invoice Amount (${invamt}).`,
unsafe: false
}
]);
$("#saveBtn").prop("disabled", true); // button Static ID
return;
}
// Otherwise clear error + enable button
apex.message.clearErrors();
$("#saveBtn").prop("disabled", false); // button Static ID
Tags:
Oracle Apex (ix)


