Home » Developer & Programmer » Application Express & MOD_PLSQL » Tabular form highlighting all column instead of faulty entry cell
Tabular form highlighting all column instead of faulty entry cell [message #564474] Fri, 24 August 2012 03:53 Go to next message
taepodong1101
Messages: 1
Registered: August 2012
Junior Member
Using Apex 4.1.1


I have this validation for my tabular form which works fine except if I have one bad entry it highlights all the entire column instead of picking on the faulty one. Normal validations (not null, is numeric) always highlights the faulty rows.

What do I have to do to make it highlight only the faulty entries? Here is my validation code.


Associated Column: PRODUCT_ID
Execution Scope: All submitted Rows (tried changing this to created and modified with no luck)


DECLARE
	is_init NUMBER := 1;
BEGIN
 
	
	FOR i in 1..apex_application.g_f03.count LOOP
		IF IS_INITIALISED_2(:P18_SITE_ID, apex_application.g_f03(i)) = 0 THEN
			is_init := 0;
		END IF;
	END LOOP;
	
	
	IF is_init = 1 THEN
		return true;
	else
		return false;
	end if;
END;


Cheers for looking at it.
Re: Tabular form highlighting all column instead of faulty entry cell [message #564984 is a reply to message #564474] Wed, 29 August 2012 15:48 Go to previous message
Littlefoot
Messages: 19697
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Apex did what you told it to. For every record in a tabular form, it loops through all records, sets a variable if ANY tabular form record's item satisfies the condition and returns true (or false). In other words:
- you are on record #1
- loop through all records
- if any item satisfies the condition ("IF IS_INITIALISED_2 ..."), set IS_INIT to 0
- return FALSE for record #1 if IS_INIT = 0

- move on to record #2
- loop through all records again
- if any item satisfies the condition, set IS_INIT to 0
- return FALSE for record #2 if IS_INIT = 0

- move on to record #3
- loop through all records
... (you know how it goes now)

I created a tabular form based on Scott's DEPT table and a validation that is supposed to "fail" if department name (DNAME is apex_application.g_f02) begins with an "A" (runs when the SUBMIT button is pressed, for all new & updated records).

Validation code:
begin
  for i in 1 .. apex_application.g_f02.count loop
    return not (substr(apex_application.g_f02(i), 1, 1) = 'A');
  end loop;
end;


The result:

./fa/10393/0/

Try to follow my example (no additional variables!) and see what happens. It might look like this:
FOR i in 1..apex_application.g_f03.count LOOP
  return not (IS_INITIALISED_2(:P18_SITE_ID, apex_application.g_f03(i)) = 0);
END LOOP;
Previous Topic: Adding description on lookup table (3 Merged)
Next Topic: Update statement not working with Row selector
Goto Forum:
  


Current Time: Sat Oct 25 02:08:56 CDT 2014

Total time taken to generate the page: 0.12133 seconds