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
Simon
Hey 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
Similar Messages
-
APEX 4.01 Tabular form with select list error
When i create a tabular form and i add a select list(query based LOV) the form is not displayed but gives me the next error
report error:
ORA-20001: Error fetching column value: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
somebody have an idea what is happening here
is this still a bug in APEX 4.01?
hope to have an answer soon.
Hugo PerforsHi Jari,
It returns about 1100 records which i think is not much.
But even when i narrow the amount of records the problem is not solved.
it this a bug?
Best
Hugo -
Issue with my Tabular form Cascading Select List
Hello Friends,
I have implemented a Cascading select list in a tabular form with the below SQL ...
SELECT apex_item.hidden(31,line_no)
|| apex_item.select_list_from_query(32, POLE_CODE_ID, 'select POLE,POLE_ID from CAP_PLAN_POLE_DETAILS', 'style="" '
|| 'onchange="f_set_casc_sel_list_item(this,'
|| 'f33_'
|| LPAD (line_no, 4, '0')
|| ')"', 'YES', '0', '- Select Pole -', 'f32_'
|| LPAD (line_no, 4, '0'), NULL, 'NO' ) POLE_CODE_ID,
apex_item.select_list_from_query(33, COUNTRY_CODE_ID, 'SELECT COUNTRY,COUNTRY_ID FROM CAP_PLAN_COUNTRY_DETAILS', 'style=""', 'YES', '0', '- Select Country -', 'f33_'
|| LPAD (line_no, 4, '0'), NULL, 'NO' ) COUNTRY_CODE_ID,
apex_item.text(34,LEGAL_ENTITY) LEGAL_ENTITY,
apex_item.text(35,BUSINESS) BUSINESS,
apex_item.text(36,COUNT_OF_NAMED_USERS,NULL,NULL,'onkeyPress="return OnlyNumbers(event)"') COUNT_OF_NAMED_USERS,
apex_item.text(37,COUNT_OF_CONCURRENT_USERS,NULL,NULL,'onkeyPress="return OnlyNumbers(event)"') COUNT_OF_CONCURRENT_USERS,
apex_item.text(38,INVENTORY_ORG) INVENTORY_ORG
FROM cp_sites_details
WHERE cap_plan_id = nv('P94_CP_ID')
UNION ALL
SELECT apex_item.hidden(31,NULL)
|| apex_item.select_list_from_query(32, 0, 'select POLE,POLE_ID from CAP_PLAN_POLE_DETAILS', 'style="" '
|| 'onchange="f_set_casc_sel_list_item(this,'
|| 'f33_'
|| LPAD (9900 + LEVEL, 4, '0')
|| ')"', 'YES', '0', '- Select Pole -', 'f32_'
|| LPAD (9900 + LEVEL, 4, '0'), NULL, 'NO' ) POLE_CODE_ID,
apex_item.select_list_from_query(33, NULL, 'SELECT COUNTRY,COUNTRY_ID FROM CAP_PLAN_COUNTRY_DETAILS WHERE POLE_ID=0', 'style=""', 'YES', '0', '-
SELECT Country -', 'f33_'
|| LPAD (9900 + LEVEL, 4, '0'), NULL, 'NO' ) COUNTRY_CODE_ID,
apex_item.text(34,NULL) LEGAL_ENTITY,
apex_item.text(35,NULL) BUSINESS,
apex_item.text(36,NULL,NULL,NULL,'onkeyPress="return OnlyNumbers(event)"') COUNT_OF_NAMED_USERS,
apex_item.text(37,NULL,NULL,NULL,'onkeyPress="return OnlyNumbers(event)"') COUNT_OF_CONCURRENT_USERS,
apex_item.text(38,NULL) INVENTORY_ORG
FROM dual
WHERE :REQUEST='ADDSITES'
CONNECT BY LEVEL = 2The filters to list the countries[2nd col of SQL, field : f33] will work on Change of Pole after a selection is made..the whole list of countries will appear with out the Pole being considered. I understand that is the case because, I have not used PoleID in the query for f33
SELECT COUNTRY,COUNTRY_ID FROM CAP_PLAN_COUNTRY_DETAILS'Now, how can I fix this to use the Pole Id every time the country Select List is touched..Can I just modify the query or should I add a Java Script OnChange function to handle this...
Please please help..
Thanks for reading the question...Isn't this given in my example:
http://apex.oracle.com/pls/otn/f?p=31517:176
The second list is extended by adding:
|| 'WHERE deptno = '
|| c001to make sure it renders correctly once you call your report. In your case the second list would be extended by adding the following
apex_item.select_list_from_query(33, COUNTRY_CODE_ID, 'SELECT COUNTRY,COUNTRY_ID FROM CAP_PLAN_COUNTRY_DETAILS ' || 'WHERE POLE_ID = ' || POLE_CODE_ID
, 'style=""', 'YES', '0', '- Select Country -', 'f33_'
|| LPAD (line_no, 4, '0'), NULL, 'NO' ) COUNTRY_CODE_ID,and that should work.
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
------------------------------------------------------------------- -
Disable columns in a tabular form on select list
I am trying to void out or disable certain columns based on the option value selected from the select list. I have done this on a form with regualr page items. However, I am now trying to accomplish the same on a tabular form. I have tried the following function and onChange event but it doesn't seem to be working. Any idea what could be wrong?
var htmldb_delete_message='"DELETE_CONFIRM_MSG"';
function Disable()
var sel = document.getElementById('f08_0001');
if (sel.options[sel.selectedIndex].value != '5' || sel.options[sel.selectedIndex].value != '7') {
document.getElementById("f04_0000").readOnly = true;
document.getElementById("f05_0000").readOnly = true;
} else {
document.getElementById("f04_0000").readOnly = false;
document.getElementById("f05_0000").readOnly = false;
THe onChange event : onChange="Disable()"I've even gone ahead and tried th following code but still am having no luck
function Disable(pThis)
var currIndex = $('select[name="'+pThis.name+'"]').index(pThis);
if (pThis.value=='2') {
$('select[name="f04"]')[currIndex].disabled=true;
} else {
$('select[name="f04"]')[currIndex].disabled=false;
} -
Tabular form with select list not updating
I have created a tabular form with a dynamic select list
select primary_key, column1,
htmldb_item.select_list_from_query(10,column2, 'select descr d, column_value r from lookup_table where column_value = '||column1) column2
from main_table
The select list appears to work correctly but the new value is not saved to the database. I assume this is because the tabular form element display as field for column2 is set to "standard report column" but when I select any of the "display as text" or "LOV" options either the current data is not displayed or errors are generated.
Any suggestions?
Thanks,
BobHi Ian,
As you have seen, sorting on the project_manager_id column will sort by the id value rather than the textual value. This is, of course, because this is the value in the field.
I haven't tried this out, but one thing that may work is the fact that you don't have to include the ORDER BY fields within the SELECT statement. You could, for example, do:
select p.project_number, p.project_manager_id
from projects p, users u
where p.project_manager_id = u.id (+)
order by u.name
Obviously, you won't be able to do this in the existing statement as you would then be blocked from using column sorting. However, it implies that if you could construct the SQL statement dynamically, appending appropriate ORDER BY strings to the end of the base select statement, you could sort by anything you like. This does, of course, mean that you would have to create a mechanism to allow the user to select the sort order, generate the appropriate string and reconstruct the entire sql statement.
I had had a similar request quite a while ago. The underlying reason for that request turned out to be that the user just wanted to quickly locate records relating to one person. In the end, we agreed that a search filter was the best thing to do.
Regards
Andy -
Tabular form, dynamic select list
Hi,
Direction as to how to tackle this problem politely requested please:
I have a "choices" table of three columns. Sample data shown below:
col1 col2 col3
a b c
a b d
a b e
f g h
f g i
The plan is to show these "choices" as a tabular form. With the example data shown above, this
would be shown as a two row grid, with the first row showing "a b" and at the end of the row there
would be a select box showing four possibilities: "c", "d", "e" or blank.
The "blank" meaning "no choice".
The second row would show "f g" and a select box for "h", "i" or "blank".
Neither the first two columns are editable by the end user - they just get to alter the third column.
How would I go about building this? Would it be a Report with a fancy piece of html for column three,
or perhaps a tabular form?
There can be more than two rows on the screen (of course) - beyond the sample data.
Any directional help appreciated; thanks in advance.
MungoHi Jure,
On reflection, that mention of the "stragg" function was very useful.
My first reply to you was a little uncharitable, for which I apologise.
Tom Kyte seems to have moved away from the "stragg" function and
has used "sys_connect_by_path" instead.
See http://tkyte.blogspot.com/2007/03/stringing-them-up.html
Once all that is in place (tested out via SQL Developer - not even a mention of Apex) it
seems relatively straightforward to integrate this into an Apex region.
Thanks again.
Mungo -
Apex 3.2 Tabular form - dynamic selection based on prev selection
Hi guys,
I am using apex 3.2. I am having difficulty in setting up a tabular form which provides an option to record information in other columns based on a value selected in the drop down.Here is an example
I have a table product. All the products are added using a tabular form by selecting type from a drop down list.
This allows the user to add multiple products without having to press save each time.
e.g.
product | type
monopoly | game
vase | home
coffee | food
cards | game
Depending on the product type, I want the user to be able to multi-select other options using checkboxes based on the option selected.
So for example if they add a product of type food, it should give additional options like beverage, cereal etc. If they select game, then they should get other options like for age_groups 10-12; 12-16; 18 and over;
Is it posisble to do this on a tabular form in apex 3.2?
If yes, please can someone help.
Thanks
SamClosed
-
Tabular Form and Link to document and No Data Found error
I have used this numerous times in an INTERACTIVE REPORT to link records out from the report to a document in a folder on our server and it works beautifully thanks to one of you guys who helped me a couple of years ago. In the column for which I want to use as a link I do the following:
LINK TEST #ISO_NUMBER#
LINK ATTRIBUTES a href=#DOC_LINK#; TARGET="_BLANK"
URL #DOC_LINK#
I've been banging my head against the wall trying to figure out why I keep getting a 'No data found' error in my TABULAR FORM. The good news is I figured out why it's happening. The bad news is I do need to link out to the documents listed in my tabular form that are saved on the server.
Is there any other way to do this?
Application Express 4.0.0.00.46
TIA,
AlexandraFinally back...
I have a tabular form that lists documents stored on one of our servers. In an interactive report I can set up a link to those docs using the document number column in the IR. I can't get it to work in the same way on the tabular form. Hopefully the steps of the catalog process will shed light on what may be the problem:
Step One
1. User1 catalogs doument using standard form (page 3) on DOC_INFO table.
2. Button on form redirects to Approval Tabular Form (for this example, page 100). This tabular form displays DOCUMENT_NUMBER (display as text saves state), APPROVER (select list), APPROVED(select list), RELEASED (select list) fields among others from DOC_APPRV_DOC table
3. Add Row adds fields in #2 above and other fields
4. User1 selects APPROVER in select list and Adds Row for all additional APPROVERS required
5. User1 hits SUBMIT button
Step Two
1. User2 opens different page but Approval Tabular Form (for this example, page 200) on same DOC_APPRV_DOC table, restricted to :P101_USERNAME
2. User2 uses APPROVED select list to approve or reject
3. User2 hits SUBMIT button
Step Three
1. User1 opens Approval Tabular Form (page 100) with User2 (and all other documents requiring approval) results
2. If rejected User1 uses Reset Approval checkbox and select list on User2's tabular form is reset
3. If approved User1 uses Released submit list and and record is deleted from User2's tabular form
The Problem
User2 ought to be able to review each of these documents on the server. In other parts of my application, an interactive report is used, I've got a case statement in the report creating the link, and have the column itself setup up so that User2 merely clicks on the DOCUMENT_NUMBER on the report and he's redirected to the document itself.
This works fine when set up the same way on the tabular form ONLY THE FIRST TIME a row is added. If I ADD ROW for any additional documents the DOCUMENT_NUMBER field on the tabular form does not populate on User1's form.
The entire process works beautifully if the link is not set up.
Note that from the standard form, the DOCUMENT_NUMBER is sent to a hidden item (default = :P3_DOCUMENT_NUMBER) in a region above the tabular form (page 100). This is then used to populate the DOCUMENT_NUMBER on the tabular form as the default value (:P200_DOCUMENT_NUMBER).
Your thoughts? Thanks in advance!
Alexandra -
How to get the text boxes and select lists dynamically?
Hi,
I have a requirement such that I need to create the text boxes and select lists depending on the user input at the run time. It means that if the user requires four text boxes/select lists then I need to have 4 such thing. If the user need 6 then I need to have 6.
The design may be such that initially only one text box/select list will be available when the page launches. Then as ad when the user asks for more those will be available to the user accordingly.
regards,
Dipankar.You can use Ajax to call textboxes and select list based on what user enters.
Otherwise make those items conditional and based on what user enters you can display textbox or select list.
You can call Single Textbox and Select List using Ajax for any number of conditions.
Regards
Chandra -
Open system form and select a row number on matrix by click on button
Hi experts,
I have to open the purchase order form and select a specific row number from the matrix by clicking a button on sales order form.
is it possible ?
can anyone help me to achieve it?
Thanks in advance.
Best regards
AndreaAndrea,
To Do? Clicking on a Button on Sales Order -> Opens a PO form, and selects the row?
In the eventhandler of a button click if the PO is not linked to SO by SAP B1 standard functionality
step 1. call ActivateMenu ("2305") of Sbo_application , this opens the PO form
step 2. Change the form to Find mode
step 3. enter po number to the Item UID "8" which is the document number.
step 4. Send enter key, or Clikc On button UID "1" which finds the PO
step 5.read the value from SO form, from matrix "38" line where you selected
step 6. use the code above to locate the line in PO (use # column for position numbers which UID is 0)
at step 5, i think you should select a line from SO matrix which you would like to open.
IN sales order, If you used PO chekcbox on logistics tab to create the PO, you can find a direct link between PO and SO (only in docentries are linked not positions) on sales order, Column UID 158 field name: potrgnum. If this connection is exists, you have an easy way:
SO form, when a user clicks on COlumn 158 (po number), you can implement an eventhandler, which
step 1.read the value from SO form, from matrix "38" line where you selected
step 2. use the code above to locate the line in PO (use # column for position numbers which UID is 0)
By processing theses steps, you can build up you solution.
Regards
János -
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 -
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
------------------------------------------------------------------- -
Manual tabular form and query based LOV
Happy new year everyone!
Okay so, I've run into an error when making one of the fields in a tabular form into a select list.
report error:
ORA-20001: Error fetching column value: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
The query works fine in SQL Workshop and Toad, it returns over 100 rows.
I have tried to use a Popup LOV, which works but I'd like to know what is going wrong with the select list.
We're using version 3.0.1.00.07 of apex, for what it's worth.
Help appreciated!
Kieran
Message was edited by:
KieranKeiran,
In the select list there is a display value and a return value.
The return value is the Foreign Key and the Display value is what is displayed in the LOV.
Are you getting these the wrong way round ?
I usually put the return value first and alias is with r and put the display value second and alias the display value with d.
Hope this helps
Regards
Chris -
Is there an example of populating a tabular form by selecting node in tree
Hi, I am using apex 4.1. I have created a tree region, and would like to click on a child node and have it populate a tabular form. My tree attribute has the following query:
select case when connect_by_isleaf = 1 then 0
when level = 1 then 1
else -1
end as status,
level,
"NODE_LABEL" as title,
null as icon,
"SEQ_NBR" as value,
null as tooltip,
'f?p=&APP_ID.:900:'||:APP_SESSION||'::::P900_SELECTED_NODE:'||"SPECIES_QC_ID" as link
from "#OWNER#"."SPECIES_TREE"
where partner_id = :G_ISSUING_AGENCY and nvl("SPECIES_TREE"."DISPLAY_FLAG",'Y') <> 'N'
start with "NODE_PARENT" is null
connect by prior "SEQ_NBR" = "PID"
order siblings by "NODE_PARENT"
I am not certain how to set up the tabular form....are there any examples out there? thanks! KarenThanks Tony,
The application I have is a means of commercial seafood dealers recording what species they have purchased/landed. The page is designed with a tree listing all of the species and their sizes and then the tabular report of landings. The current application uses a collection to display the landings....I was trying to get rid of the collection and populate the table directly.
thanks for getting back to me. Sounds like I will need to keep the collection....just looking for examples. -
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.
Maybe you are looking for
-
How to change email address on iCloud
My email address was hacked into so I had to change it. Which caused me to change my apple ID also. Now I am not sure how to change my email address on Icloud. It still show my old apple ID. Do I have to delete the whole account an start it over? Not
-
Photoshop CS3 crashes on open file
Hi All My Photoshop crashes if I open two *.psd files at the same time. If I open only one file everything works. If I try afterwards to create a new file it crashes again. It seems it can't handle more than ONE file. Error note: AppName: photoshop.e
-
Hi, I would like to run a cron job every minute. I can find cron.hourly, cron.daily, cron.weekly, cron.monthly in my /etc, but no cron.minutly. Can I get it? What should I do? Thanks! Nathan
-
Shadows and Borders Not Appearing
When I publish my page, certain things are not appearing. For example, the drop shadow behind the lettering and the border around the photo(s) is not showing up. It shows up when I construct my page using iWeb, but not when I view the page using Safa
-
Closing multiple sequences that are open at once.
I usually have quite a few sequences open at once....I usually close them by selecting each one, right clickign and selecting close...please tell me if there is a way of lcoing all of them at once...even if I close the timeline and re open they are s