This is the script. It saves without errors, but it does not show the message when the criteria is met.
in string IN_OldValue;
in string IN_NewValue;
out boolean OUT_Condition;
local 'PO Number' l_PONo;
local 'Item Number' l_ItemNo;
local Ord l_Ord;
local currency l_Threshold;
local 'Subtotal' l_SubttMIN, l_SubttMAX;
OUT_Condition = false;
set l_Threshold to 500.0;
if isopen(form POP_Receivings_Entry) then
set l_PONo to 'PO Number' of window 'Line_Scroll' of form 'POP_Receivings_Entry';
set l_ItemNo to 'Item Number' of window 'Line_Scroll' of form 'POP_Receivings_Entry';
set l_Ord to 'PO Line Number' of window 'Line_Scroll' of form 'POP_Receivings_Entry';
clear table POP_POLine;
set 'Item Number' of table POP_POLine to l_ItemNo;
set 'PO Number' of table POP_POLine to l_PONo;
set 'Ord' of table POP_POLine to l_Ord;
get table POP_POLine by number 2;
if err() = OKAY then
set l_SubttMIN to 'Subtotal' of table POP_Receipt;
set l_SubttMIN to l_SubttMIN - round((l_SubttMIN+l_Threshold),
DECIMALRIGHT, ROUNDMODE_HALF_UP, 2);
set l_SubttMAX to 'Subtotal' of table POP_Receipt;
set l_SubttMAX to l_SubttMAX + round((l_SubttMAX+l_Threshold),
DECIMALRIGHT, ROUNDMODE_HALF_UP, 2);
if ('Subtotal' of window POP_Receivings_Entry of form POP_Receivings_Entry < l_SubttMIN or
'Subtotal' of window POP_Receivings_Entry of form POP_Receivings_Entry > l_SubttMAX) then
warning "The SUBTOTAL is greater than the threshold defined of 500!";
OUT_Condition = true;
end if;
end if;
end if;