Updating Multi-Row Form Data
Hi Folks,
I have the following multi-row form:
!http://img216.imageshack.us/img216/7250/screenexample.jpg!
This is based on the following query:
SELECT id,
ticker,
deal_date,
deal_type,
no_shares,
price_per_share,
commision,
stamp_duty,
APEX_ITEM.CHECKBOX( 1, NULL ) AS group_ind,
trade_group_id
FROM trades
WHERE ticker = 'FXPO'
ORDER BY trade_group_id,
ticker,
deal_dateWhen I tick the GROUP_IND Checkbox, I want only the TRADE_GROUP_ID column value to be updated in the database for the associated row. Obviously, I could tick the checkbox in multiple rows.
My questions are:
1. Is it possible to modify the ApplyMRU routine to do this?
2. If not, how would I go about submitting the ID and TRADE_GROUP_ID columns to a stored proc via an array from the APEX front end?
3. Is there a best practice solution for my reports.
I have some layout questions aswell, but I'll post those on a separate thread once the main functionality is working.
Cheers.
James
James,
You have access to the checked IDs using the apex_application.g_f01 array. You can pass it to your pl/sql ie:
procedure test(p_arr in vc_arr2)
begin
for in in 1..p_arr.count
loop dbms_output.put_line(p_arr(i));
end loop;
end;
now you can just call your procedure with a process test(apex_application.g_f01);
Similar Messages
-
Hi,
I've a wizard based Multi Row Form (MRF) based on a view (on 2 tables) with Instead of triggers to handle the DML. I have an onchange event on one particular Select List based item in each row that simply disables/enables other row items depending on the value. All this is working fine, but I need to repeat the disable/enable of items for each row once the page has loaded.
My initial thought is to use an onload event in the Page definition, but can and should I be handling this in a Page Process instead (bear in mind that this is a wizard generated MRF)? Also, I need to ensure that new rows (via the Add Row button) are handled correctly. If I go down the onload event route, then is the simplest way just to get an array (getElementsById?) of the items and loop through them? Any thoughts would be most appreciated on the most efficient way to do this.
Cheers,
PaulBHi,
Yes, it appears the same as an onload but, fortunately, doesn't interfere with any existing onload code - you can only have one onload function call for the window object.
You can loop through the items on the form using something like:
function disableItems()
var x = document.getElementsByName("f03");
var y = document.getElementsByName("f04");
for (int k = 0; k < x.length; k++)
if (x(k).value == 'A')
y(k).disabled = true;
else
y(k).disabled = false;
}This assumes that the select list is in column 3 (which should mean that the SELECT objects should have a name attribute of "f03") and that the item you want to disable/enable is in column 4 ("f04") - so adjust as necessary.
As you have the same number of items in column 3 and column 4 - the above loops through the ones in column 3, checks the value selected and then disables/enables the item in the same row in column 4.
Andy -
Multi-Row Form Validations - Cannot Re-Use Phone Nos from select LOV
1) I need some help with a "Multi-Row" data-entry form (page 9)...I have a select list of phone-no's that user picks from the drop-down lov list on a page multi-row select list-drop down - P9_PHONE_ID (has built in lov). The data form is built on 'site_phone_assign' table.
However, I need to put a page-level validation where the user CANNOT select a pre-assigned phone id (reuse a phone) that's already been assigned (used) and a record exists in the site_phone_assign table. I built the following page level validation on the multi-row edit form which is built on 'site_phone_assign' table...NOT WORKING!
PLEASE HELP WITH THE BEST WAY TO DO THIS..Thanks!
--validation type: Function returning boolean
<code>
DECLARE
v_count pls_integer default 1;
BEGIN
IF (:P9_PHONE_ID IS NOT NULL) THEN
select count(*)
into v_count
from datahub.site_phone_assign s
where s.phone_id = :P9_PHONE_ID
and s.ASSIGN_START_DATE <= SYSDATE
AND NVL(s.ASSIGN_END_DATE,SYSDATE+1) >= SYSDATE;
END IF;
IF (v_count) > 0 THEN
RETURN (FALSE);
ELSE
RETURN (TRUE);
END IF;
END;
</code>
2) How can I apply validations on a multi-row edit form page where say - start_date is always less than end_date? Both start/end dates are date-picker type of items.
3) Can ITEM NOT NULL validation be applied on a multi-row edit page? I guess its page-level validation right? Please advice.
Edited by: Shravanv on Feb 18, 2010 1:50 PMHello,
In a Tabular Form you need to loop through the records on the screen, so doing a check on :P9_PHONE_ID doesn't work...
Patrick Wolf made a general solution for this problem, you can read about it here: http://www.inside-oracle-apex.com/plug-play-tabular-form-handling/
Regards,
Dimitri
http://dgielis.blogspot.com/
http://www.sumneva.com/ -
How to populate a multi row form in Apex
Hi
I have a form in Application Express built using "Tabular Form" option while creating the page. The table being filled by the form is as follows
Cell_ID(varchar) reading_date(date) Value1(num) Value2(num) Location(varchar2)
Now I need to do the following
1. I want the page to display 200 rows for data entry on page load itself instead of user clicking Add Row button 200 times. ( For every location 200 entries need to be made for 200 diff Cell_IDs at the same date )
2. I want each row to take value for the Date column from the single date picker item displayed on top of page instead of entering the same date 200 times by user.
3. The cell_IDs are automatically populated with values loc1_001 loc1_002 .......... loc1_200 on selection of Location from another Item (select list) placed on top of the page.
Please Help anyone. Looking forward to a response.
Regards
Saurabh<h3>Please help any one guys.</h3>
-
Multi-row form with button to save and add another row
Can you have a button on a multi-row tabular form that would save the current changes, and than open a new row up on the fom for a new entry to be entered? This would combine the save and add a row button functions.
Add Row button is doing exactly what you are asking for - it will save the chages you
made and add a new row.
Denes Kubicek -
Update multiple rows with datas from the same table
i have a table like
name version value1 value2
2 A 4,31 3,5
3 A 3,45 10
2 B 6,97 12
4 B 12 16
so name + version is unique
i have to update the datas value1 and value2 ( version A) with the datas from version B where the name ( VersionA) = name version B
i.e the result should be
name version value1 value2
2 A 6,97 12
3 A 3,45 10
2 B 6,97 12
4 B 12 16
is it possible to do this in sql? ( sql. 8.1)... if your table does not contain exactly what you expect you could get:
'single row sub-query returns more than one row'
To prevent that, put a unique index on (name, version). If this combination is not always unique, you will need to cater for the possibility in the update statement. -
Updating one row of data using CMP
Hi,
How should I update a single row mapped with a CMP persitence, should I write a differetnt method for update , pl clarify in detail.Hi,
How should I update a single row mapped with a CMP
P persitence, should I write a differetnt method for
update , pl clarify in detail.Hi,
You can just find that particular Row using the findByPrimaryKey method the entity.
This method actually returns the Remote Interface for the Entity which contains taht particular row of record.
Use The setters of the Remote interface to update your existing Row. -
Dear all,
I create a region with this information :
select
htmldb_item.hidden(1,QRY_IDS),
htmldb_item.hidden(2,SIT_ID),
SIT_ID SIT_ID_DISPLAY,
htmldb_item.checkbox(4,used_bl,decode(used_bl,'Y','CHECKED',NULL))used_bl,
dsc
from BSF_QRY_SITES qst,
bsf_sites sit
where sit.id = qst.sit_id and
qst.qry_ids = :p30_qry_ids
When I try to create to update my checkbox information it doesn't work.
Here the process to update it.
declare
t_use_bl char(1);
begin
for i in 1..htmldb_application.g_f01.count loop
t_use_bl := 'N';
for x in 1..htmldb_application.g_f04.count loop
if htmldb_application.g_f01(i) = htmldb_application.g_f04(x) then
t_use_bl := 'Y';
end if;
end loop;
update bsf_qry_sites
set used_bl = t_use_bl
where qry_ids = htmldb_application.g_f01(i)
and sit_id = htmldb_application.g_f02(i);
end loop;
end;
I take this example in the htmldb handbook.
Can someone help me please.
Thanks in advance
EricHello,
Now I receive this error message when i try to update.
ORA-01722: invalid number
Now my select is :
select
htmldb_item.hidden(1,ids) ids,
qry_ids,
"SIT_ID" SIT_ID_DISPLAY,
htmldb_item.checkbox(2,used_bl,decode(used_bl,'Y','CHECKED',NULL))used_bl
from test_eric
and my process to update is :
declare
t_use_bl varchar2(1);
begin
for i in 1..htmldb_application.g_f01.count loop
t_use_bl := 'N';
for x in 1..htmldb_application.g_f02.count loop
if htmldb_application.g_f01(i) = htmldb_application.g_f02(x) then
t_use_bl := 'Y';
end if;
end loop;
update test_eric
set used_bl = t_use_bl
where ids = htmldb_application.g_f01(i);
end loop;
end;
Why I receive this error ?
I need to solve this problem to develop a new application. If I'm not able my user will ask to develop with an other tools.
Thanks in advance for your help
Eric -
Re: Update Oracle from form data?
Too much to peruse. You should debug it yourself, for example by inserting System.out.println statements in there to figure out where it's giving you trouble.
"...Too much to peruse..." - indeed.
I'd recommend that you write a Java object that does all your database interactions and test it seperately from the servlet. Once you have that working, then let you servlet create an instance and just call its methods. By then you'll be 100% certain that your database object is working, and you can turn your attention to other problems.
I'd recommend JUnit as a good Java unit testing framework:
http://www.junit.org
I'd also recommend that you look into JSTL and JSPs. Jakarta has a great implementation of JSTL (Java Standard Tag Library). It'll help simplify this code a lot. - MOD -
Need to perform multi-row update/delete
Gday,
I have a request to have one update button for a multi-row form. Also needed will be a checkbox as part of the row.
The check boxes only purpose is to signify the record should be deleted. Thus I am assuming I cannot use default
apex functionality and must manually build the multi-row form. I guess I would loop through and check to see if a
record is checked delete otherwise loop through and update all columns for that record? I am assuming I should
use the examples in http://www.oracle.com/technology/products/database/application_express/howtos/tabular_form.html
is that all still valid for apex 3.2.1?
CheersHello:
You could also do the following
Generate the tabular form page using the wizard
Delete or not display the 'Delete' button
Delete or not execute the 'ApplyMRD' process
Create a new page process with a sequence higher than the standard MRU processes. Make this process conditional on the 'Submit' button. Use code similar to the one below for this page processfor i in 1..apex_application.g_f01.count loop --- f01 is the selector checbox, f02 is the hidden column with the table's PK
delete from emp where empno=apex_application.g_f02(apex_application.g_f01(i));
end loop;Now, when you click 'Submit' records with their selector checkbox checked will be deleted by the newly added page process. The rest of the functionality of the tabular form remains the same.
varad -
can someone repost the instructions for tricking the master
detail form into emulation a single table multi row form. I
found someone who poited to an old posting that is no longer
availablerepost
-
Hi,
I am trying to update AD process form data through the OIM API. I have to clear all the telephone numbers. I am getting this error when i run it.
varbinary is incompatible with text
2011-06-24 10:48:31,918 ERROR [XELLERATE.SCHEDULER.TASK] Class/Method: SchedulerBaseTask/run encounter some problems: {1}
java.lang.NullPointerException
at com.thortech.xl.schedule.tasks.UpdateAD.execute(UpdateAD.java:116)
at com.thortech.xl.scheduler.tasks.SchedulerBaseTask.run(Unknown Source)
at com.thortech.xl.scheduler.core.quartz.QuartzWrapper$TaskExecutionAction.run(Unknown Source)
at Thor.API.Security.LoginHandler.jbossLoginSession.runAs(Unknown Source)
at com.thortech.xl.scheduler.core.quartz.QuartzWrapper.execute(Unknown Source)
at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
2011-06-24 10:48:31,918 ERROR [XELLERATE.SERVER] Class/Method: QuartzWrapper/run encounter some problems: Operand type clash: varbinary is incompatible with text
com.microsoft.sqlserver.jdbc.SQLServerException: Operand type clash: varbinary is incompatible with text
Please help
MThis is the code I am using..
map.put("UD_ADUSER_TELEPHONE",rs.getString("usr_udf_telephone"));
long pinstancekey = 215041;
formOp.setProcessFormData(pinstancekey,map); //This line is throwing the error -
Inserting new rows in a JSP multi-row page
Hi all.
I´ve been implementing a JSP multi-row editable page according to the paper:
http://www.oracle.com/technology/products/jdev/tips/mills/JSP_Multi_Row_Edits.html
I noted that the code provided in the example just considers handling updates from the multi-row page, by comparing the existing rows in the ControlBinding rangeSet with the ones that came from the page.
However, I need the ability to handle new rows from the same multi-row form that came from the page. So how can I achieve this task? What code should I include in the processUpdateModel method to handle new inputs?
regards.
DenisI think I will have to look inside the JHeadStart source code that extends DataAction, understand how that code works, and finally get the pieces I'm interested in...
-
Updating Multiple Rows With A Sequence
I'm trying to update multiple rows of data in one column based on if its date is greater than a certain date. Starting with the lowest date from those dates I'll give it a 2000 and every ascending date from that point will be another number in sequence (2001, 2002, 2003, etc.).
Apologization Edit:
11g XE
Edited by: spysmily1 on Jun 4, 2012 5:50 PM
Edited by: spysmily1 on Jun 4, 2012 5:51 PMI would use a counter and start at a specific number. Then I would try to keep updating with this number and incrementing each time. The part I can't quite grasp is how to use this number with the lowest record and apply this sequence to each date that ascends from there. What I was going to try to come up with is something like:
DECLARE
counter := 2000;
BEGIN
loop
update table_name
set column_name = counter
where date > specified date;
counter := counter + 1;
end loop;
This is my first thought but I couldn't see a way to just update the first one that is greater than the specified date and then keep cycling through the dates until the last date(most recent). I know I would need a loop but what can I set that loop to so it would know when to stop. I could use a variable I know is less than the total amount that need to be altered.
Edited by: spysmily1 on Jun 4, 2012 6:21 PM -
How to re-query changed record in multi-row block after update in a called form
Hi,
I have a form that I use to perform searches, which is a multi-record block.
The user can navigate to a record, press a button on call another form which provides
more detail, and allows update of the record.
If the user changes it, and returns to the original search form, how can I re-query the
changed record to update the fields on the search form.
Is there a way other than to re-query the
whole block - a built-in to just update on record if it's changed on the database.
If not, can I use globals to pass back the data (since only a few fields are updatable),
and change the record without effecting its forms status.
Many thanks
BernieBD,
I haven't managed to look at a solution yet, but the block is a large multi-row block,
with an ORDER BY, and since it can return a large number of records, there is a short
delay. I was hoping there was a way of just
re-querying the one record, which was displayed
in the second form for update.
I'll give the query a go, or might try and pass back some globals with the update values.
By the way, DML Return Value is an excellent feature, but only works against Oracle 8.
It basiclly adds the RETURNING clause to any DML statement (see SQL manual), so that if
a trigger changes/adds values you didn't provide, it will return them back to you
so the values in your form are correct.
I use a trigger on the DB to populate history fields (create/update,who/when) and
the PK sequence. Using this feature, those values are returned to the block and displayed.
Regards
Bernie
Maybe you are looking for
-
When we went from Vista to Windows 7 and tried to sync the iPod Touch - I lost my apps. Can these be recovered somehow?
-
Corrupted images captured by new 5D Mark III
Hi, I got two corrupted images while shooting with my new 5D Mark III..I was using 45mbps sandisk extreme SD card and the mode was only JPEG(fine). After getting two corrupted images I shoot 1k images but no problem there after..Later I copied those
-
Bluetooth: Not Available mac book pro 15 inch
My Bluetooth has gone missing and when i click on bluetooth file exchanger i get this message: no bluetooh hardware found. In order to use this application, you must have a bluetooth module. please verify that your bluetooth hardware is properly atta
-
Hello Friends, I am facing the problem in VA03. After entering order no it gives me Error message that 'Address doent exits'. I have traced out the problem and found that the entries in table ADRC are vannished. but the related entries are present in
-
IWeb site for selling my books
I'm an author who is selling my books on an old web site where my Merchant account provided HTML snippits to create a shopping basket where customers can buy my books. When they put in their credit card data it transfers the $ to my bank account, and