As you can read from my other posts I got the tabular validatation up and running now it works great...there are only one issue.
In my tabluar form I always show an extra 4 empty rows using an union-all-sql-statement. If I only fill 1 row
and hit submit the validation fires for the 3 empty rows. Is there any way to handle that?
I would like to check if my row is completly empty, then don't validate. The problem is I don't know where to start.
Can you point me in any direction where I can put this if-statement?
To clarify, this is the functionality I want:
When the user pushes the submit-button only validate the rows where thera are values, if a row is completly empty, do not validate it. Is this possible?
normally it should just validate rows where data is included. Maybe it has something to do with your UNION which isn't considered as "empty". Can you put a testcase on apex.oracle.com of your page so that I can have a look?
Thank you for your reply, Patrick.
I have just requested a workspace on apex.oracle.com and I will create a testcase there ASAP. Will get back
when it's done.
Hm, I did some thinking during the weekend and tested some stuff now on the morning and you are correct, it's the union that causes the error.
where month = :P50_HEADER_MONTH
CONNECT BY LEVEL <= 4
The problem is caused by to_number(sys_context('APEX_TIMEREP','internal_user_id')) and to_number(:P50_HEADER_MONTH). If I put null there instead and fill out the values in the tabular form it works as expected.
My problem is now how to populate the values when I save a new row. I can populate the internal_user_id by a trigger but not the month though it's dependent of the value on the screen. I would like to do a process that sets this value before it's sent to the database and saves. Do you know if that is possible?
I know it's completly non relevant to the Apexlib but if you have any thoughts it will be appreciated...thanks.
I'm going with this solution, hopefully it will work:
- Page Process
- On Submit - Before Computations and validations
FOR i IN 1..HTMLDB_APPLICATION.G_F02.COUNT LOOP
-- G_F05 = region, G_F06 = project , G_F08 = time
IF HTMLDB_APPLICATION.G_F05(i) IS NOT NULL AND HTMLDB_APPLICATION.G_F06(i) IS NOT NULL AND HTMLDB_APPLICATION.G_F08(i) IS NOT NULL THEN
IF HTMLDB_APPLICATION.G_F03(i) IS NULL THEN
HTMLDB_APPLICATION.G_F03(i) := to_number(sys_context('APEX_TIMEREP','internal_user_id'));
IF HTMLDB_APPLICATION.G_F04(i) IS NULL THEN
HTMLDB_APPLICATION.G_F04(i) := to_number(:P50_HEADER_MONTH);
you can use the APIs of ApexLib here too. It will make the code more readable.
FOR ii IN 1 .. ApexLib_TabForm.getRowCount
IF ApexLib_TabForm.NV('INTERNAL_USER_ID') IS NULL
( pColumnName => 'INTERNAL_USER_ID'
, pRow => ii
, pValue => TO_NUMBER(SYS_CONTEXT('APEX_TIMEREP','internal_user_id'));
IF ApexLib_TabForm.NV('MONTH') IS NULL
( pColumnName => 'MONTH'
, pRow => ii
, pValue => TO_NUMBER(:P50_HEADER_MONTH);
The advantage is that the code is still understandable in a month. You can use the column names instead the non-saying g_fxx arrays.
Grrr. Lost all the formating :-(
Thank you for your reply. I will continue to work with Apexlib!
Log in to post a comment.