Apex, Tabular forms and Nested Tables := Headache
Hi All,
I'm constructing an Apex aplication for Performance Reviewing staff and I have need of nested tables within each line item for ongoing comments during the year, the headings of which are drawn from another table, based on a template for which ones are to be used at any given time.
I'd like to be able to use a tabular form to draw out the history of comments at any given time and modify them however I'm at a complete loss as to how to get this working with a tabular form in Apex. If anyone could point me at some good documentation on the subject or even suggest a better method to get this done I'd be very grateful.
Thanks!
Hi,
Take a look at this article:
http://www.oracle-base.com/articles/misc/ObjectViewsAndNestedTables.php
First, create a view as described on your nested and other table(s), with 'Instead Of' triggers handling the DML. Next create the tabular form based on the view. You'll find many posts in the forum regarding building a tablular form based on a view.
Paul Brookes.
Similar Messages
-
Tabular form on multiple tables
Hi there,
I'm hoping to create a Tabular Form which is based on either a view or a join, whichever is easier.
We have two tables - Division and Targets. Division references Targets on target_id. The tables share a one-to-one relationship. I was originally told to simply merge the 36 fields in Targets to the Division table, however, we're likely going to have other tables (such as Department and Section) which also share a one-to-one relationship with Targets.
Is there a way to accomplish this with the Wizard, and if not, does anyone have any tutorials/advice on how to create PL/SQL to handle this?
Thanks,
AndrewMike
"Just for querying the data and making it appear in a single tabular form"
... hum so you would have to create a custom process anyway for the update - in which case, why have the view in the first place, there's no point.
>
What are the odds of moving the rows :P works for me anyways =P.
>
I'm not saying it's likely, but it can happen. As a developer you should take this into consideration when designing applications.
So
CREATE TABLE rowid_test
pk_col NUMBER PRIMARY KEY,
col1 NUMBER,
col2 VARCHAR2(6 CHAR)
TABLESPACE DAT_DATA;
CREATE SEQUENCE rowid_test_seq
START WITH 1
MAXVALUE 999999999999999999999999999
MINVALUE 1
NOCYCLE
CACHE 20
NOORDER;
BEGIN
FOR i IN 1 .. 150
LOOP
INSERT INTO rowid_test
(pk_col,
col1,
col2)
VALUES
(rowid_test_seq.nextval,
ROUND(DBMS_RANDOM.VALUE(0, 100000), 2),
DBMS_RANDOM.STRING('x', 6));
END LOOP;
COMMIT;
END;
CREATE OR REPLACE FORCE VIEW rowid_view AS
(SELECT rowid the_id, t.*
FROM rowid_test t);
SELECT *
FROM (SELECT /*+ FIRST_ROWS(n) */
a.*, ROWNUM rnum
FROM(SELECT *
FROM rowid_view
ORDER BY pk_col) a
WHERE ROWNUM <= 30)
WHERE rnum >= 15;
DELETE FROM rowid_test
WHERE pk_col = 17;
COMMIT;
INSERT INTO rowid_test
(pk_col,
col1,
col2)
VALUES
(17,
ROUND(DBMS_RANDOM.VALUE(0, 100000), 2),
DBMS_RANDOM.STRING('x', 6));
COMMIT;
SELECT *
FROM (SELECT /*+ FIRST_ROWS(n) */
a.*, ROWNUM rnum
FROM(SELECT *
FROM rowid_view
ORDER BY pk_col) a
WHERE ROWNUM <= 30)
WHERE rnum >= 15;So row 17 could have a different rowid in the tabular form to the table itself.
If the rowid is used to update then it could either not find the row or find a different row (ludicriously unlikely but you never know).
So the next option would be to combine it with a primary key - very safe but you may not always find your row. So why not just use the primary key? Well, in this case we have two tables involved so we do not have a single PK on which to base the update... So we'll have to write a custom update procedure as APEX will base it upon the primary key... so not having a primary key is no longer an issue.
Either way, your query is ambiguos
CREATE OR REPLACE VIEW "HIHI" AS
SELECT ROWID unique_rowid, d.Dep "Department", t.goal "Sales Goal"
FROM Division d, Target t
WHERE d.target_id = t.target_idWhich table is the rowid coming from??? This couldn't work.
Cheers
Ben
http://www.munkyben.wordpress.com
Don't forget to mark replies helpful or correct ;)
Edited by: Munky on Aug 28, 2009 10:53 AM -
Second LOV based on First LOV in Oracle APEX tabular Form
Hi,
I had created a tabular form in which I am having two LOV's. This form is based on a query.
I had created a javascript function which internally calls AJAX and populates the second LOV based on the value selected in first LOV when onchange.
But the issue is, when the user recalls this APEX page to view the details or edit the details, the second LOV shows all the values instead of showing only the values related to first LOV.
In the second LOV query I am trying to write the below query.
select function_name fn
,function_code_id fci
from catering_function_codes
where function_type_id = NVL(#FUNCTION_TYPE_ID#,function_type_id)
order by to_number(function_code_id)
in which #FUNCTION_TYPE_ID# is the value of first LOV. But I am getting the below error.
report error:
ORA-20001: Error fetching column value: ORA-06550: line 1, column 187:
PL/SQL: ORA-00911: invalid character
ORA-06550: line 1, column 7:
PL/SQL: SQL Statement ignored
How can you refer to the Second LOV the value of First LOV in a report based tabular form?
Kindly let me know if you do not understand the issue.
Please help me in this issue.
Thank you
Regards
DevHi Roel,
Thank you for the quick reply.
I used the query as given by you. This time it is not giving any error but showing all the values in the second LOV irrespective of what ever value is present in the first LOV
This is an apex tabular form which is generated by apex based on a query. The controls will be dynamically generated by APEX for each row. How can we hard code the control name to :P99_FUNCTION_TYPE_ID?
Please help me in this issue. Thank you
Regards
Dev -
Hi,
I have created a tabular form on 2 tables by using a view. Unfortunately when I submit the changes I get the following error.
Error in mru internal routine: ORA-20001: Error in MRU: row= 1, ORA-01779: cannot modify a column which maps to a non key-preserved table, update "PROJECT2"."TASK_MILESTONES" set "TID" = :b1, "MS_ID" = :b2, "CAT_ID" = :b3, "NAME" = :b4, "DESCRIPTION" = :b5 where "TID" = :p_pk_col
Any suggestions on how to get around this?
TomYou will need to combine the following:
1. Crosstab Query. This blog has an excellent article on CrossTab or Pivot queries:
http://thinkoracle.blogspot.com/2005/09/pivot-and-crosstab-queries.html
The limitation with this method is you will need to fix the maximum number of actions that there are for any given case. Alternatively you could use plsql to return the report sql by first looping through the actions to find the maximum number.
2. Custom Tabular Form. You will quickly find that there a limitations with the wizard generated tabular forms. Custom forms built using the apex_item APIs will give you much more control. This how-to is a useful guide for getting started.
http://www.oracle.com/technology/products/database/application_express/howtos/tabular_form.html
If you need more explanation on any of these or help writing the code, please let us know.
Cheers
Shunt -
Tabular Forms and Select Lists
Hi,
I have an updateable tabular form, and one of the updateable columns I want as a select list. I need the SQL that populates this select list to be based on a hidden value in the tabular form. Is this possible?
Cheers
SimonHey Simon,
Sounds reasonable, you'll have to end up using the HTMLDB_ITEM.SELECT_LIST_FROM_LOV function within the query that is populating your form.
http://www.acs.ilstu.edu/docs/Oracle/appdev.101/b10992/mvl_api.htm#CHDFGAEC should give you a bit more help towards sorting it out. Don't hesitate to post again if you have anymore queries.
Ruari -
SQL Loader Constraints with Column Objects and Nested Tables
I am working on loading a Table that (god forbid) contains columns, column objects, and nested tables (which contains several depth of column objects). My question is does SQL Loader have a hidding undocumented feature where it states how the column objects must be grouped in refereneced to the nested tables within the loader file? I can load the various column objects, and nested tables fine right now, however, I am loading them all in strange and insane order. Can anyone answer this question? Thanks.
PeterI just noticed that my email is wrong. If you can help, plese send email to [email protected]
thanks. -
Help- I have added a field in my tabular form and now i get an error in mul
Help- I have added a field in my tabular form and now i get an error in muli update form; Here is the error, how do I go in to change the process, adding the extra field??
Error in mru internal routine: ORA-20001: Error in MRU: row= 1, ORA-20001: ORA-20001: Current version of data in database has changed since user initiated update process. current checksum = "F10F6D7EC4CF938382C6DC2EE22800F6", item checksum = "90E47F32E95B71B7A9D47A1311063445"., update "CAPRS"."CONTRACT_ERRORS" set "ID" = :b1, "CONTR_NUM" = :b2, "REPT_MONTH_CD" = :b3, "REPT_FISCAL_YEAR" = :b4, "REPORT_FAC_CAGE_CD" = :b5, "END_ITEM_NUM" = :b6, "END_ITEM_DESC" = :b7, "WSSC" = :b8, "WBS_CD" = :b9, "WPC_CD" = :b10, "CONTR_CLIN" = :b11, "CO
Error Unable to process update.Hi,
I believe the error is due to the checksum process which doesn't have that additinoal field's information. You can try creating the form again with the additional field, or if needed you can go with the Manual tabular form.
Thanks,
Manish -
Row level cascading in Apex tabular form
Hi,
I have searched alot,but i am not able to find the solution
I have a tabular form and having only one column say column A is dynamic LOV (Select col1 from lov_table will return values as 1,2,3........)
When user press ADD ROW button
row 1 => column A display LOV as _1,2,3.... then if user selects 1
When user press ADD ROW button
row 2 => column A "should" display LOV as 2,3,.....
Anyone could help me out to solve this problem......
Regards,
VenkatHi,
steps i followed:---
i created a dynamic action
event--- change
select type --jquery selector
jquery selector--[name="f05"]
action--Execute PL/SQL Code
script---
DECLARE
V_COLLECTION_NAME VARCHAR2 (30) := 'XXBCT_GPMS_COL';
V_ITEM_ID NUMBER;
L_SEQ_ID NUMBER;
L_ITEM_VALUE NUMBER;
BEGIN
IF NOT apex_collection.collection_exists (p_collection_name => v_collection_name) THEN
APEX_COLLECTION.CREATE_OR_TRUNCATE_COLLECTION (P_COLLECTION_NAME => V_COLLECTION_NAME);
END IF;
V_ITEM_ID := (APEX_APPLICATION.G_X01);
SELECT MIN(seq_id)
INTO L_SEQ_ID
FROM APEX_COLLECTIONS
WHERE COLLECTION_NAME = V_COLLECTION_NAME;
IF L_SEQ_ID IS NULL THEN
APEX_COLLECTION.ADD_MEMBER ( P_COLLECTION_NAME => V_COLLECTION_NAME, P_C001 => V_ITEM_ID );
END IF;
FOR i IN 1..apex_application.g_f05.count
LOOP
SELECT SEQ_ID,
C001
INTO L_SEQ_ID,
L_ITEM_VALUE
FROM APEX_COLLECTIONS
WHERE COLLECTION_NAME =V_COLLECTION_NAME;
IF L_ITEM_VALUE !=V_ITEM_ID THEN
APEX_COLLECTION.ADD_MEMBER ( P_COLLECTION_NAME => V_COLLECTION_NAME, P_C001 => V_ITEM_ID );
ELSE
APEX_COLLECTION.UPDATE_MEMBER ( P_COLLECTION_NAME => V_COLLECTION_NAME, P_SEQ => L_SEQ_ID, P_C001 => V_ITEM_ID);
END IF;
END LOOP;
END;
affected elements-->no
event scope--dynamic
--->for tat tabular form column
SELECT DISTINCT msib.DESCRIPTION,
msib.INVENTORY_ITEM_ID
FROM MTL_SYSTEM_ITEMS_B MSIB,
ORG_ORGANIZATION_DEFINITIONS OOD
WHERE MSIB.ORGANIZATION_ID =OOD.ORGANIZATION_ID
AND OOD.BUSINESS_GROUP_ID =FND_PROFILE.VALUE('PER_BUSINESS_GROUP_ID')
AND MSIB.INVENTORY_ITEM_ID NOT IN
(SELECT AC.C001
FROM APEX_COLLECTIONS AC
WHERE AC.COLLECTION_NAME ='XXBCT_GPMS_COL'
ORDER BY msib.INVENTORY_ITEM_ID
but this script is not working ...
collection itself not creating i don't know y..
kindly help me to solve this problem....................
Thanks,
Venkat -
OCI doc says Cursor and Nested table have the same bind type SQLT_RSET but they don't
5 Binding and Defining in OCI
PL/SQL REF CURSORs and Nested Tables in OCI
says SQLT_RSET is passed for the dty parameter.
If I use SQLT_RSET for the return value of a function that returns a table and pass a statement handle's address for the OCI parameter data pointer, I expected that the statement handle will be instantiated as a result of executing the function on which I can further perform fetch, similar to a cursor. But it throws exception PLS-00382: expression is of wrong type ORA-06550: line 2, column 3. Is the above documentation wrong?
From the OCI header file I see that for varray and nested table it mentions to use SQLT_NCO. I could find no example in the OCI documentation on how to pass or receive as return value a nested value when using SQLT_NCO.
Please help before I shoot myself.So the Nested table I quoted in the doc is not actually used to mean a table type below?
create type t_resultsetdata as object (
i int, d decimal, c varchar(10)
create type t_nested_resultsetdata as table of t_resultsetdata;
create function Blah return t_nested_resultsetdata is . . .
For this you are saying to use SQL_NTY and not SQL_NCO. Can you tell where this usage is documented, because ocidfn.h says
#define SQLT_NTY 108
/* named object type */
#define SQLT_NCO 122
/* named collection type (varray or nested table) */
Another question - Because of the original document I said I followed, I thought I could treat cursor and nested table similarly in the calling application, i.e. I could repeatedly do a fetch on the OCIStmt* which will be bound for nested table. Now from what you say I understand I can't really bind a OCIStmt* for nested table but have an object type. That means it will get all the data of that collection in one go, right? LIke I said, lack of examples is making this tough. I don't want to look into OCI source code, as that will be too much. -
Insert and update in database using apex tabular form
Hi All,
i have tabular form
category_ID
Day
Hours
Start Date
End Date
1001
2
3
01-jun-2013
Null
1002
1
4
02-jun-2013
Null
1003
2
5
03-jun-2013
null
if day or hour change/update then End date will be sysdate.
and new row insert in table
category_ID
Day
Hours
Start Date
End Date
Header 6
1001
1
3
01-jun-2013
04-jun-2013
Day change from 2 to 1
1002
1
4
02-jun-2013
Null
No change
1003
2
5
03-jun-2013
null
No change
1001
1
3
04-jun-2013
null
New record insert which is change/update
how to achieve it.
Thanks in advance,
PrashantI usualy don't use the apex wizards to create forms when you need such custom functionality.
I just make the needed items, and when saving the form elements to the db i run my own written procedure en i submit the page with the request 'UPDATE' and i also set an id item with the newly created id for the inserted record.
So the page knows it should call the procedure that fills up all items with the values of the record i just saved. this also comes in handy when inserting a form in multiple tables. -
Need help with Apex 4.0 tabular form and searchable select list
I would like to use an exisiting plugin for a searchable combo box on a tabular form. When I define the item types on my tabular form I don't see the plugin as an option. I reviewed the help documentation for the apex_item api for the tabular form but I didn't see how I could reference the plugin. Has anyone done this or have other ideas? Any help would be greatly appreciated.
I noticed this problem in the first beta version but I thought this is so obvious and it will be corrected so I didn't follow on it further. This looks like a bug in 4.0. If I use firebug, I will see that the selected value is still RESEARCH allthough the display changes - <option selected="selected" value="20">RESEARCH</option> If I click on SAVE than wrong values will be changed.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
------------------------------------------------------------------- -
ORDS v3 and APEX tabular form issue
Hi,
We encountered strange issue after installing ORDS v3 EA to test, thought I would report this. I'm not sure if its a bug but it seems to be reproducible in our instance.
Steps:
1) Install ORDS v3 with Glassfish deployment.
2) Go to APEX builder -> Page with report (classic or interactive) -> Edit Attributes -> Change data in column attempt to save throws out "ORA-01403: no data found"
or
3) Create APEX app -> Build page with DML form and Tabular form -> Edit tabular form attempt to save throws out same error.
Application error logs shows:
ORA-20987: APEX - Unable to change column attributes. - ORA-01403: no data found
WWV_FLOW_SECURITY
FINAL_EXCEPTION_HANDLER
Also, I was unable to get RESTFul services working with APEX no matter how I configured ORDS v3. I don't encounter these issues when reverting back to version 1.x , 2.x
APEX Version: 4.2.6.00.03
Oracle DB: 11.2.0.3.0
Glassfish : open source edition 4.1
Regards,
-SenthilI too am getting ORA-01403 both when trying to save in the builder and when just hitting submit on the tabular form when using standalone EA3. Happens when pointing at 4.1 or 4.2.6. The v2 listeners works fine when pointing to the same applications/pages.
I asked oracle support whether it is a known EA3 issue but was told to add my observations to the forum.
cheers
~t -
Across row validation in tabular form and across items in row validations.
Hi,
We are upgrading to APEX 4.0.
I need to create a tabular form that will have a start date and an end date. FOr each new row or updated row I need ensure its start date is after the end date of all rows already entered and its end date is after the start date of row being entered. Also that if no end date is entered then no other rows can be found with a null end date.
SO I need across field validations with in a row and across row validattions. That is I need rowset validations as well.
Is it possible to do this with APEX? WHat kind of tabular solution would allow these type of validations. How might these validations be done?Okay, Here's a quick rundown on how to build a manual form using APEX_ITEM and collections. The process goes in 4 steps: gather the data, display the data, update based on user input, then write the changes. Each step requires it's own piece of code, but you can extend this out as far as you want. I have a complex form that has no less than a master table and 4 children I write to based on user input, so this can get as complex as you need. Let me know if anything doesn't make sense.
First, create the basic dataset you are going to work with. This usually includes existing data + empty rows for input. Create a Procedure that fires BEFORE HEADER or AFTER HEADER but definitely BEFORE the first region.
DECLARE
v_id NUMBER;
var1 NUMBER;
var2 NUMBER;
var3 VARCHAR2(10);
var4 VARCHAR2(8);
cursor c_prepop is
select KEY, col1, col2, col3, to_char(col4,'MMDDYYYY')
from table1
where ...;
i NUMBER;
cntr NUMBER := 5; --sets the number of blank rows
BEGIN
OPEN c_prepop;
LOOP
FETCH c_prepop into v_id, var1, var2, var3, var4;
EXIT WHEN c_prepop%NOTFOUND;
APEX_COLLECTION.ADD_MEMBER(
p_collection_name => 'MY_COLLECTION',
p_c001 => v_id, --Primary Key
p_c002 => var1, --Number placeholder
p_c003 => var2, --Number placeholder
p_c004 => var3, --text placeholder
p_c005 => var4 --Date placeholder
END LOOP;
CLOSE c_prepop;
for i in 1..cntr loop
APEX_COLLECTION.ADD_MEMBER(
p_collection_name => 'MY_COLLECTION',
p_c001 => 0, --designates this as a new record
p_c002 => 0, --Number placeholder
p_c003 => 0, --Number placeholder
p_c004 => NULL, --text placeholder
p_c005 => to_char(SYSDATE,'MMDDYYYY') --Date placeholder
end loop;
END;Now I have a collection populated with rows I can use. In this example I have 2 NUMBERS, a TEXT value, and a DATE value stored as text. Collections can't store DATE datatypes, so you have to cast it to text and play with it that way. The reason is because the user is going to see and manipulate text - not a DATE datatype.
Now build the form/report region so your users can see/manipulate the data. Here is a sample query:
SELECT rownum, apex_item.hidden(1, c001), --Key ID
apex_item.text(2, c002, 8, 8) VALUE1,
apex_item.text(3, c003, 3, 3) VALUE2,
apex_item.text(4, c004, 8, 8) VALUE3,
apex_item.date_popup(5, null,c005,'MMDDYYYY',10,10) MY_DATE
FROM APEX_COLLECTIONS
WHERE COLLECTION_NAME = 'MY_COLLECTION'This will be a report just like an SQL report - you're just pulling the data from the collection. You can still apply the nice formatting, naming, sorting, etc. of a standard report. In the report the user will have 3 "text" values and one Date with Date Picker. You can change the format, just make sure to change it in all four procedures.
What is critical to note here are the numbers that come right before the column names. These numbers become identifiers in the array used to capture the data. What APEX does is creates an array of up to 50 items it designates as F01-F50. The F is static, but the number following it corresponds to the number in your report declaration above, ie, F01 will contain the primary key value, F02 will contain the first numeric value, etc. While not strictly necessary, it is good practice to assign these values so you don't have to guess.
One more note: I try to align the c00x values from the columns in the collection with the F0X values in the array to keep myself straight, but they are separate values that do NOT have to match. If you have an application you think might get expanded on, you can leave gaps wherever you want. Keep in mind, however, that you only have 50 array columns to use for data input. That's the limit of the F0X array even though a collection may have up to 1000 values.
Now you need a way to capture user input. I like to create this as a BEFORE COMPUTATIONS/VALIDATIONS procedure that way the user can see what they changed (even if it is wrong). Use the Validations to catch mistakes.
declare
j pls_integer := 0;
begin
for j1 in (
select seq_id from apex_collections
where collection_name = 'MY_COLLECTION'
order by seq_id) loop
j := j+1;
--VAL1 (number)
apex_collection.update_member_attribute (p_collection_name=> 'MY_COLLECTION',
p_seq=> j1.seq_id,p_attr_number =>2,p_attr_value=>wwv_flow.g_f02(j));
--VAL2 (number)
apex_collection.update_member_attribute (p_collection_name=> 'MY_COLLECTION',
p_seq=> j1.seq_id,p_attr_number =>3,p_attr_value=>wwv_flow.g_f03(j));
--VAL3 (text)
apex_collection.update_member_attribute (p_collection_name=> 'MY_COLLECTION',
p_seq=> j1.seq_id,p_attr_number =>4,p_attr_value=>wwv_flow.g_f04(j));
--VAL4 (Date)
apex_collection.update_member_attribute (p_collection_name=> 'MY_COLLECTION',
p_seq=> j1.seq_id,p_attr_number =>5,p_attr_value=>wwv_flow.g_f05(j));
end loop;
end;Clear as mud? Walk through it slowly. The syntax tells APEX which Collection (p_collection_name), then which row (p_seq), then which column/attribute (p_attr_number) to update with which value (wwv_flow.g_f0X(j)). The attribute number is the column number from the collection without the "c" in front (ie c004 in the collection = attribute 4).
The last one is your procedure to write the changes to the Database. This one should be a procedure that fires AFTER COMPUTATIONS AND VALIDATIONS. It uses that hidden KEY value to determine whether the row exists and needs to be updated, or new and needs to be inserted.
declare
begin
--Get records from Collection
for y in (select TO_NUMBER(c001) x_key, TO_NUMBER(c002) x_1,
TO_NUMBER(c003) x_2,
c004 x_3,
TO_DATE(c005,'MMDDYYYY') x_dt
FROM APEX_COLLECTIONS
WHERE COLLECTION_NAME = 'MY_COLLECTION') loop
if y.x_key = 0 then --New record
insert into MY_TABLE (KEY_ID, COL1,
COL2, COL3, COL4, COL5)
values (SEQ_MY_TABLE.nextval, y.x_1,
y.x_2, y.x_3, y.x_4, y.x_dt);
elsif y.x_key > 0 then --Existing record
update MY_TABLE set COL1=y.x_1, COL2=y.x_2,
COL3=y.x_3, COL4=y.x_4, COL5=y.x_dt
where KEY_ID = y.x_key;
else
--THROW ERROR CONDITION
end if;
end loop;
end;Now I usually include something to distinguish the empty new rows from the full new rows, but for simplicity I'm not including it here.
Anyway, this works very well and allows me complete control over what I display on the screen and where all the data goes. I suggest using the APEX forms where you can, but for complex situations, this works nicely. Let me know if you need further clarifications. -
Manually Created Tabular Forms and Firefox 4 Problem
I have a tabular form created with pl/sql dynamic content regions using the apex_item toolkit. An apex collection is used to maintain state for the tabular data entered. It is an application originally created in APEX 1.5 and upgraded through the years to 3.2 . Never a problem with the application until now. I have re-created the issue on the apex.oracle.com site here:
http://apex.oracle.com/pls/apex/f?p=28213
Run the application in IE ( I am using 8) and then run in Firefox 4. Enter a quantity in the first item then hit Next and then Previous multiple times. See the problem? The problem does not occur in FF 3.6 or Chrome either. I have not tried Safari as my mac is at home and I am at the office.
Here is code for both pl/sql regions and the collection update (after submit). Page 2 is just a report selecting from the collection. I have spent a day trying to solve this problem. Any help will be appreciated. Re-architecting without the pl/sql dynamic regions is not an option at this time.
Dave
Report region 1: (collection not exists)
declare
other1 varchar2(2000) default null;
other_char varchar2(32000) default null;
begin
htp.p('<table border="1" width="100%">');
htp.tablerowopen;
htp.p('<th>Description</th><th>Price</th><th>Quantity</th>');
htp.tablerowclose;
for rec in (SELECT id, description,to_char(price,'$9,999.99') price
FROM foodbev_items order by id) loop
select apex_item.hidden(1,rec.id) into other_char from dual;
htp.p(other_char);
select apex_item.hidden(3,rec.description) into other_char from dual;
htp.p(other_char);
htp.tablerowopen;
htp.tabledata(rec.description);
htp.tabledata(rec.price,'right');
-- quantity here
select apex_item.text(6,null,5)
into other1 from dual;
htp.tabledata(other1);
htp.p('<tablerowclose>');
end loop;
htp.p('</table>');
end;
Report Region 2: (collection exists)
declare
other1 varchar2(2000) default null;
other_char varchar2(32000) default null;
begin
htp.p('<table border="1" width="100%">');
htp.tablerowopen;
htp.p('<th>Description</th><th>Price</th><th>Quantity</th>');
htp.tablerowclose;
-- collection BREAKFAST_SELECTION
-- 1 is item_id, 3 is descrip 6 is qty
for rec in (SELECT a.c001 item_id, a.c003 description,to_char(b.price,'$9,999.99') price, a.c006 entered_qty
FROM htmldb_collections a, foodbev_items b where a.c001 = to_char(b.id) and a.collection_name = 'BREAKFAST_SELECTION' order by b.id) loop
select apex_item.hidden(1,rec.item_id) into other_char from dual;
htp.p(other_char);
select apex_item.hidden(3,rec.description) into other_char from dual;
htp.p(other_char);
htp.tablerowopen;
htp.tabledata(rec.description);
htp.tabledata(rec.price,'right');
-- quantity here
select apex_item.text(6,rec.entered_qty,5,5)
into other1 from dual;
htp.tabledata(other1);
htp.p('<tablerowclose>');
end loop;
htp.p('</table>');
end;
Collection Update:
declare
la_cks wwv_flow_global.vc_arr2;
other_char varchar2(2000) default null;
other_char1 varchar2(2000) default null;
begin
htmldb_collection.create_or_truncate_collection('BREAKFAST_SELECTION');
for i in 1 .. htmldb_application.g_f01.count
loop
-- 1 is item_id, 2 is numeric price , 3 is descrip, 6 is qty
htmldb_collection.add_member(
p_collection_name => 'BREAKFAST_SELECTION',
p_c001 => htmldb_application.g_f01(i),
p_c003 => htmldb_application.g_f03(i),
p_c006 => htmldb_application.g_f06(i)
end loop;
end;Dave,
All I am saying is both of your report regions can very easily be made into a sql statement and put into a report region. you can then use the apex builder to format them. How you validate that data is up to you and would not change all that much other than making sure your global arrays are pointing to the same columns. it just looks to me that you are going through a lot more effort to not use what apex will very easily do for you. Plus the more apex built in functionality you use the more robust your application will be in different browsers.
I tried running your application in IE 7 and FF 3.6 and i did not see any problems. i entered 1,6,4 clicked next. Clicked previous numerous times and was redirected back to the page and saw 1,6,4.
What is happening when you run the app?
Thanks,
Tyson Jouglet -
APEX tabular form update recognition
Dear all,
I am quite new to APEX so please apologize if I am asking "stupid" questions. Unfortunately, the information I was able to find up to now was only partially helpful. Apparently I must be missing something obvious. The APEX version I use is 4.0.1.
When submitting a page that contains a tabular form, I need to find out, which record has been created or updated in order to fill in additional information automatically, e.g. logging data (created, last updated, ...). I cannot do this in a trigger, because the trigger sees only APEX_PUBLIC_USER and does not know about the "real" user who has connected to the database. If there is a better or easier way to do this, please let me know.
My problem is to find out, if a new record has been added by clicking the "add row" button and / or if an existing record has been modified, because creation and modification have to be handled differently. Existing and unmodified records in the table must not be touched. I can access the columns by using APEX_APPLICATION.G_Fxx() but how do I recognize modifications? In a thread in this forum I found information about using a MD5 checksum. So I have added a checksum field using APEX_ITEM.MD5_HIDDEN() and tried to check this information. Unfortunately, doing this, I already get a problem when I submit the page after having added an empty record by clicking on "add row" but without having supplied any information. APEX then complains about information that has been modified in the meantime instead of just ignoring the empty record. This is probably because APEX considers the record as changed because of the checksum column I have added (I have read that the SQL query to create the tabular form must not be altered).
Could anybody please show me the right way to do such a check?
Thank you very much for your help.
Best regards,
Ralf GorholtHi Ralph,
Well, if you are wanting to check if anything has been updated before the update button is pressed, using JS, you can use the property of the field 'defaultValue' and compare it to the property 'value'
i.e. for the text input type
function isElementChanged( myElement ) {
var iselementChanged = false;
var returnVal = false;
switch ( myElement.type ) {
case "text" :
if ( myElement.value != myElement.defaultValue )
return true;
break;
default
return false;
} You could cycle through all elements, by:
allEls = form.elements;
for (i=0; i < allEls.length; i++){
if ( allEls.type != undefined && allEls[i].type.length > 0 && allEls[i].disabled == false ) {
if (isElementChanged(allElls[i])) {
//TODO: logic here
}Ta,<br />Trent
Maybe you are looking for
-
how can I acess my ipad content from the pc, without enter the security code on ipad? I broke the screen and it doesn´t work. theres a way to enter the code on the pc? thank you
-
When migrating from time machine to a new hard drive, not all is transferd, only partial documents, applications , settings etc. How can I migrate the latest back-up with all the content.
-
Dear All, I have set delivery complete indicator in customizng for Plant in Inventory Management and also in Purchase Order still I am able to post multiple material documents with reference to the same Purchase Orde Item. What do this delivery compl
-
Hi Guys, We are shifting our prod server to different hardware(box) through backup restore method where OS and DB would be same and the same IP and hostname as that of our current prod server would be assigned to new hardware. As per my understanding
-
I have a bunch of embedded movies that are controlled by hidden buttons. I would like to be able to adjust the stacking order or z-depth of the layers by scripts to solve a design problem. What I've ended up with is if you roll over button 3 the #3 m