What 'execution scope' do you have set for the validation?
The way you've done it, if the execution scope is 'all submitted rows' it'll repeat the looping for every row. I'd have done it one of the following ways:
1) If you want to loop through the rows in PL/SQL I'd do it as a process rather than validation. That way it'll only execute once.
2) Alternatively, to do it as a validation I wouldn't loop I would just set execution scope 'all submitted rows' and just add to a new page item called XX then check the total with a process.
So you would have:
i) Process to set a page_item (called XX) to zero.
ii) A validation for all submitted rows to do the totalling.
iii) A process to check the total and give an error if needed.
There might be a better way to do it but both methods I've given will work.
what about this code its the same error
DECLARE l_error VARCHAR2 (4000); XX number:=0; BEGIN FOR i IN 1 .. apex_application.g_f33.COUNT LOOP -- if apex_application.g_f41 is not null then XX:= XX +NVL(apex_application.g_f34 (i),0); -- end if; END LOOP; IF XX <> :P442_PAY_VAL AND XX <> 0 THEN l_error := l_error || '</br>' || 'The total credit value must equal ' || :P442_PAY_VAL; END IF; RETURN LTRIM (l_error, '</br>'); END;
Is the validation message not showing at all.
Or is the validation message showing as notification at the top of the page. But not a in the column and row where the error occurred.
If it is the second then that is because you are working with a manual tabular form.
When working with a manual tabular form apex doesn't have a connection between the column and the g_fXX array. And as such is not able to place the error message at the correct column.