Instead of Trigger for tabular form
I have a tabular layout on a form that returns data from a database view. Based on user interaction I would like to update the underlying view records that are returned by a query in the form using an INSTEAD OF trigger. I have my trigger working, however I can only get it to update the first record of the tabular layout item on the form. I realize that INSTEAD OF triggers are row level triggers, but is there a way to get this trigger to fire for multiple records? I've written a simple update statement in the form that updates the view: update newborn.nb_ltfu_positive_v
set export_dt = sysdate
where barcode = :nb_ltfu_positive_v.barcode;
and my INSTEAD OF trigger looks like this: if :old.export_dt <> :new.export_dt then
update nbpat set export_dt = sysdate
where spec = :old.spec;
end if;
if :old.export_dt <> :new.export_dt then
update nbhear_audiotest set export_dt = sysdate
where barcode = :old.barcode;
end if;
Do I need to do some looping in the trigger?
Any assistance would be greatly appreciated.
Thanks
No you cannot do any looping in the database trigger. The database trigger will for every record which is involved in an UPDATE issued againt the view.
The problem is your code inside the form. In general you do not issue "manual" update against a table/view in forms, but let forms do so. So, if you want to update a record in a tabular block in forms you would just assign the new value to the forms-item, such as
:BLOCK.EXPORT_DT:=SYSDATE;in your example. This code marks the "active" reocrd in the block as "to be updated" in the next transactions, mean when the user presses "Save". If you want to update multiple records in forms, this is either done when the user navigates between different record and then does some changes in the block-fields, or if you want to do it "programmatical", by looping over the block, something like:
FIRST_RECORD;
LOOP
EXIT WHEN :SYSTEM.RECORD_STATUS ='NEW';
-- do some stuff on the current record, exampel code
:BLOCK.EXPORT_DT:=SYSDATE;
EXIT WHEN :SYSTEM.LAST_RECORD='TRUE';
NEXT_RECORD;
END LOOP;hope this helps
Similar Messages
-
I am trying to use HTML directly in SQL statement for tabular form (see SQL below). When the tabular form runs it is not converting the HTML so it displays as this:
Manala<span style="color:blue;">pan</span>
Am I missing something?
select
"PK_ID",
"CODE",
decode(instr(upper(city_name),upper(:P3_SEARCH)),
0, city_name,
substr(city_name,1,
instr(upper(city_name),upper(:P3_SEARCH)) - 1)
|| '<span style="color:blue;">' ||
substr(city_name, instr(upper(city_name),upper(:P3_SEARCH)),
length (:P3_SEARCH))
|| '</span>' ||
substr(city_name, instr(upper(city_name),upper(:P3_SEARCH)) + length(:P3_SEARCH) )) "CITY_NAME",
"STATE_CODE"
from "#OWNER#"."ZIP"
where upper(city_name) like '%' || upper(:P3_SEARCH) || '%'Right. The HTML is correct but the only way it will display right is when I changed the field attribute to 'Standard Report Column'. Unfortunately, that removes the field from being a text field (input).
-
Multi Row Update for Tabular Form
1) I'm trying to understand how the built-in MRU works for tabular forms: While running through every row, does it check for changes before issuing an UPDATE or does it blindly UPDATE every row in the current pagination range?
2) If I need to write my own Multi Row Update process for tabular forms, could someone give me some tips on how to do that?
Thanks,
Pavel1) It stored a checksum for each row that it renders. It calculates the checksum again before processing the rows. The UPDATE statement it issues has a predicate like where old_checksum!=new_checksumSo, it only updates the rows that have at least 1 column value that is different (causing the row checksum to be different)
2) See the howto at http://www.oracle.com/technology/products/database/application_express/howtos/tabular_form.html -
Dynamic LOV FOR TABULAR FORM 6i
Hi,
I have tabular form of two Items(ID,DESC) and I want to Populate LOV for item(ID) every record
and record_Group & SQL statments are stored in DB.
ACTION: when query in POST-QUERY Trigger get for every record in tabular form -- the stored SQL-Statment from table then put it into dynamic record_group and populate the dynamic LOV.
Please advice,
Thanks in Advance.OK daniel
This form used for get reports
then header get the name of Report (Table-A) (report_ID),(report_desc).
then details for get the Parameters will send to report builder (Table-B) (detail_id),(report_id),(sql_stm).
so parameters may be need for example stock code so this record need to query from stocks table to get stock code and stock name.
next record for item Code so need to query from Items table to get the Item code and Item name
another report for employees so the user enter report code then when query and get in details block employee code and employee name.
so the lov will check if this record have query sql-statment or not if have execute it in the record_group then in lov
then go to the next record if sql_stm is null then no lov in this record and so on.
thanks.. -
Wizard for Tabular Form Region
Is it possible to generate a tabular form using a wizard into a new region on an existing page where other regions of various types exist?
I have a page with a region for capturing details of a call. There are other regions on the page that hold information relating to the call, e.g. reasons for the call, requirements of the call, and actions performed relating to the call. These are all one-to-many relationships from the call, with links between each other, i.e. an action can be linked to a particular reason for the call. This all works fine.
What I would like to do is to replace some of the reporting regions (e.g. reasons,requirements and actions) with tabular forms (currently to modify entries in these reporting regions, I use the standard column link functionality to another page containing the maintenance form).
Thanks.Hi,
I have the same problem. Have you found a solution? -
Hello,
I am using AE 2.1. I have a tabular form, I want to add a search facility on all fields in the tabular form.
How can I do this?
ThanksCosmos,
In the region source attribute of the tabular form, you specify the query that populates the form.
You could create a new HTML region that holds your search criteria page items. You can then add these page items to the WHERE clause of your tabular form. When you submit the page then, the form will only display records that match your criteria. For example:
If you have the following items in your HTML searching region
PX_EMP_NAME
PX_EMP_NO
You could use the following in your tabular form:
SELECT
e.employee_name
, e.employee_num
FROM
employees e
WHERE
UPPER(e.employee_name) LIKE UPPER('%'||NVL(:PX_EMP_NAME,%)||'%')
AND
e.employee_num = :PX_EMP_NO;
Hope this helps.
Cheers,
Cj -
Page level process doesn't works for tabular form.....
I am developing an application on inventory of an chemical factory.......
I have an master-detail form where detail table is in tabular form.......
I have an LOCATION1 AND QUANTITY1 COLUMN in detail table..........
I have location say...LT01A02 AND limit of each location to hold an quantity is .....say 1000.
I wrote an process for these but it doesn't work.......
declare
x NUMBER(6);
z number(6);
begin
selecT NVL(SUM(QUANTITY1),0) INTO x from RM_LOCATION1 where LOCATION1 = :P3_LOCATION1;
z := x;
if :P3_LOCATION1 LIKE'%1)' or :P3_LOCATION1 LIKE'%2)' then
if z > 1200 then
raise_application_error(-20101,'LOCATION YOU HAVE SELECTED IN LOCATION1 IS 1ST OR 2ND PALLETE ,WHICH CAN HAVE MAXIMUM 1200KG,PLEASE CHECK IT PHYSICALLY');
end if;
elsif :P3_LOCATION1 LIKE'%3)' or :P3_LOCATION1 LIKE'%4)' then
if z > 800 then
raise_application_error(-20101,'LOCATION YOU HAVE SELECTED IN LOCATION1 IS 3RD OR 4TH PALLETE ,WHICH CAN HAVE MAXIMUM 800KG,PLEASE CHECK IT PHYSICALLY');
end if;
elsif :P3_LOCATION1 LIKE'%5)' or :P3_LOCATION1 LIKE'%6)' then
if z > 750 then
raise_application_error(-20101,'LOCATION YOU HAVE SELECTED IN LOCATION1 IS 5TH OR 6TH PALLETE ,WHICH CAN HAVE MAXIMUM 750KG,PLEASE CHECK IT PHYSICALLY');
end if;
elsif :P3_LOCATION1 LIKE'%7)' or :P3_LOCATION1 LIKE'%8)' OR :P3_LOCATION1 LIKE'%9)' or :P3_LOCATION1 LIKE'%10)' OR :P3_LOCATION1 LIKE'%11)' or :P3_LOCATION1 LIKE'%12)' then
if z > 600 then
raise_application_error(-20101,'LOCATION YOU HAVE SELECTED IN LOCATION1 IS 7TH OR 8TH OR HIGHER PALLETE ,WHICH CAN HAVE MAXIMUM 600KG,PLEASE CHECK IT PHYSICALLY');
end if;
end if;
end;
I HAVE SEEN THAT APEX DOESN'T PICKS VALUE CALLED... _:P3_LOCATION1_*
NOW WHAT TO DO ,CAN ANY ONE HELP ME....HOW TO RUN THESE PROCESS......Hi User XY,
tabular forms do not have Page Items. The values you entered in the tabular form are stored in arrays like APEX_APPLICATION.g_f01 to g_f50.
Here are some links you might find helpful: http://www.talkapex.com/2008/07/manually-creating-tabular-form.html
http://download.oracle.com/docs/cd/E23903_01/doc/doc.41/e21676/apex_app.htm#CHDICJDA
brgds,
Peter
Blog: http://www.oracle-and-apex.com
ApexLib: http://apexlib.oracleapex.info
BuilderPlugin: http://builderplugin.oracleapex.info
Work: http://www.click-click.at and http://www.wirsindapex.at -
Select query based LOV for tabular form attributes
Hi HTMLDB Team,
Congrats u all for the new release of HTMLDB in htmldb.oracle.com.
I badly need a solution of the below problem.
Say , i have table called user_col_comments now i want to display the table_name ,column_name and comments in a tabular form.I displayed only one row for the tabular form.Now i create a select query based LOV for attribute table_name where i got all table_name in drop down list.
Point is that after selecting any data from drop down table list i want to get the corresponding fields to be populated in column_name attributes.How can i wrote the select query based LOV for the attibute column_name.
I wrote it as 'select column_name d,column_name r from user_col_comments where table_name=:TABLE_NAME Its not working?
Similarly i want same thing to display for comments after matching both table_name and column_name.
Any solution to get rid of those problem will be highly appreciable...
If u need my htmldb.oracle.com userid and password to solve the problem i will sure let u email it.
Cheers,
Emanhi rchalton,
can u plz little bit more clearer .I know hopefully u can imagine the problem and may u guide me thru proper way.....One think i understand that there must be multiple process and submit but "only when..." that u have said i cant understand that part........
U are welcome to give me proper solution.....
Thanks for the reply ....atleast one can pay hid to me.....
Cheers,
Eman -
Popup window for tabular form row edition
To edit existing or new rows in a tabular form (page 1), I would like to open a popup window (page 2) with fields mirroring original tabular form fields. So, some basic data can be viewed/typed in the tabular form and the whole of the record data are viewed/typed on a separate popup form.
On opening popup, I pass a tabular form's current line number (filled with up to three zeros on the left).
When the user clicks on OK button on popup page, data will be put to the corresponding tabular form row. That should allow me to get /set tab form data from popup using following syntax:
opener.document.getElementById('f04_' + line).value
However, when I call data-initialization javascript function on onload of the popup form, popup fields to be filled are not rendered yet. At which point (and how) could I call this javascript initialization function?
Another question. With Firebug Inspector, I see that right in front of each tab form data tag, there is a "label" tag with the name of the column as it was defined in report attributes. As long as I have a information, opener.document.getElementById, what HTML/Javascript syntax should I use to get to this label tag?
IgorOK, the first part of question is OK now. Simply, I was putting a javascript code calling my initialization predure in the HTML Body Attribute section of the page, instead of simply writing there: onload="initFunction();"
The second one stands still: once I have a tabular form's element id like f20_0003, how can I get to the symbolic name, e.g., "FIRST_NAME", that is in the label tag in the same table cell? -
Insert a number of rows for tabular form based on frequency value
Hi,
I have a page with two search items.
Based on the values in the search item, a report is created as tabular form.
The information displayed has a frequency column.
Values for frequency can be Q, Y, M, D
I would like to know if it is possible to to load the form with a standard numbers of row depending on the frequency.
Example: If frequency is Q ,then when i click the go button in the search region, the tabular shoud load with the information displaying 4 rows, even if the information returned is less than 4 rows.
If frequency is Y ,then when i click the go button in the search region, the tabular shoud load with the information displaying 2 rows, even if the information returned is less than 2 rows.
When no data is found, the form should load displaying a number of empty rows depending on the frequency.
ThanksFollowing this example:
http://apex.oracle.com/pls/otn/f?p=31517:209
you should be able to achive that.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
Error when creating breadcrumb for tabular form
Dear all,
I when I tried to create a breadcrumb in tabular form, I got:
1 error has occurred
* This Menu Identification Page already has an associated Menu Option. You must select another page.I found other thread that discussed the same subject and it mentioned about "deleting entries in tabular view" when apex_application_bc_entries showing the corresponding page was included in defined_for_page and url column (my corresponding page was included in those columns also). However I don't know how to delete those entries.
Could anybody advise me?
best regards,
ValI have resolved the problem by copying the page I want to link to another page in the app without breadcrumbs, then added the breadcrumb region,
a breadcrumb entry. I then pointed the 'home' page to the new page and was able to navigate to the new page and back to the home page. -
No Data returned for tabular form APEX 4
Hi,
I have a page that uses a tabular form, however it is not showing me any data. If I click the add row button and enter some details and press submit, the data is saved to the database but the page is refreshed and still shows me no data. I don't however get a No Data Found message.
If I create a region on the same page based on a sql report, that returns the data I have added through the tabular form.
Any ideas
Cheers
PaulMy previous post appears to be incorrect as neither pages are now returning data!!!!
So I started again and this is what I have done.
1) Run the page and get no data. The SQL statement on the page is
select
"ID",
"ID" ID_DISPLAY,
"REFERRAL_ID",
"REASON",
"CREATED_BY",
"CREATED_ON",
"UPDATED_BY",
"UPDATED_ON"
from "#OWNER#"."REFERRAL_REASON"
where referral_id = :P82_REFERRAL_ID
2) Checked the wwv_flow_activity_log and can see that the number of rows returned is correct (12 in this case)
3) Traced the page and looked at the trace file which has the following statement
select NULL "CHECK$01",
NULL "ID",
NULL "ID_DISPLAY",
to_number(123) "REFERRAL_ID",
NULL "REASON",
NULL "CREATED_BY",
NULL "CREATED_ON",
NULL "UPDATED_BY",
NULL "UPDATED_ON",
NULL "ROWID"
from dual
union all
select "CHECK$01" "CHECK$01",
"ID" "ID",
"ID_DISPLAY" "ID_DISPLAY",
"REFERRAL_ID" "REFERRAL_ID",
"REASON" "REASON",
"CREATED_BY" "CREATED_BY",
"CREATED_ON" "CREATED_ON",
"UPDATED_BY" "UPDATED_BY",
"UPDATED_ON" "UPDATED_ON",
"ROWID" "ROWID"
from (select NULL "CHECK$01",
"ID" "ID",
"ID_DISPLAY" "ID_DISPLAY",
"REFERRAL_ID" "REFERRAL_ID",
"REASON" "REASON",
"CREATED_BY" "CREATED_BY",
"CREATED_ON" "CREATED_ON",
"UPDATED_BY" "UPDATED_BY",
"UPDATED_ON" "UPDATED_ON",
"ROWID" "ROWID"
from (select "ID",
"ID" ID_DISPLAY,
"REFERRAL_ID",
"REASON",
"CREATED_BY",
"CREATED_ON",
"UPDATED_BY",
"UPDATED_ON"
from "IMPULSE"."REFERRAL_REASON") apex$_rpt_src
order by 1)
call count cpu elapsed disk query current rows
Parse 4 0.00 0.00 0 0 0 0
Execute 4 0.00 0.00 0 0 0 0
Fetch 16 0.00 0.00 0 24 0 12
total 24 0.00 0.00 0 24 0 12
4) Amended the page to remove the where clause
5) Amended the page to removed the process that adds 5 empty rows
6) Run the page and still get no rows
7) Checked the wwv_flow_activity_log and can see that the number of rows returned is correct (12 in this case)
8) Log out of application and log back in
9) Run the page and get 500 rows
10) Checked the wwv_flow_activity_log and can see that the number of rows returned is correct (500 in this case)
11) Added the where clause back in to the SQL statement and rerun the page and get the correct numer of rows (12 in this case)
12) Log out of application and log back in
13) Run the page and get no rows!!!!!!!
14) Checked the wwv_flow_activity_log and can see that the number of rows returned is correct (12 in this case)
So I can only conclude that whilst the data is being retrieved from the database it is not being displayed on the screen. So what would be stopping the data from being displayed?
Regards
Paul -
Set value for user input in tabular form
Hello all
I have a tabular form wherein I want to set the length of values a user an enter into certain columns.
For an example, column1 should only allow users to input a 5 digit number and no more. Column2 should only allow 6 digits and so on.
Is this something that can be done? and if so, how?
Thank you for any help -TreyHi Trey,
APEX doesn't support that out of the box, it always creates a HTML input item with a maxlength=2000. But have a look at the ApexLib Framework which supports a length property for tabular from fields. See http://www.inside-oracle-apex.com/2007/02/restrict-input-length-for-tabular-form.html and http://apex.oracle.com/pls/otn/f?p=44394:54 for details.
Patrick
My APEX Blog: http://www.inside-oracle-apex.com
The ApexLib Framework: http://apexlib.sourceforge.net
The APEX Builder Plugin: http://apexplugin.sourceforge.net/ New! -
How to create validation only for created rows in tabular form
Hi all,
I have a simple question. Is it possible to create a validation for tabular form which will be fired only for created?
There is a possibility in APEX 4.1 to choose two types of "*Execution scope*" first is "*For created and Modified Rows*" and second is "*All Submitted Rows*".
Thanks in advance!
Regards,
JiriHello Jiri,
>> Is it possible to create a validation for tabular form which will be fired only for created?
You can still use the scope of For created and Modified Rows and use a PL/SQL Expression condition of:
:APEX$ROW_STATUS = 'C'You also need to change Execute Condition to For Each Row .
Hope it helps,
Arie.
Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all. -
Hi,
I have two tables
CUSTOMERS
===========
Name Null Type
======================
CUST_UID NOT NULL NUMBER(4)
CUST_NAME VARCHAR2(50)
ITEM_PRICES
===========
Name Null Type
======================
IP_UID NOT NULL NUMBER(4)
IP_ITEM_DESC VARCHAR2(50
IP_COST_PRICE NUMBER(6,2)
IP_SELL_PRICE NUMBER(6,2)
I have a view IPS_VW which is the cartician product of CUSTOMERS and ITEM_PRICES, and an instead of trigger for UPDATE on this view which either inserts or updates data in the following third table
ITEM_PRICES_SPECIAL
===========
Name Null Type
======================
IPS_UID NOT NULL NUMBER(4)
CUST_UID NUMBER(4)
IP_UID NUMBER(4)
IPS_SELL_PRICE NUMBER(6,2)
The following is my view
SELECT 'A'||ROWNUM AS "IPSVW_UID",
0 AS "IPSVW_IPS_UID",
"CUSTOMERS"."CUST_UID" AS "IPSVW_CUST_UID",
"ITEM_PRICES"."IP_UID" AS "IPSVW_IP_UID",
"ITEM_PRICES"."IP_SELL_PRICE" AS "IPSVW_IPS_SELL_PRICE"
FROM "CUSTOMERS" "CUSTOMERS",
"ITEM_PRICES" "ITEM_PRICES"
WHERE NOT EXISTS
(SELECT 1
FROM "ITEM_PRICES_SPECIAL" "ITEM_PRICES_SPECIAL"
WHERE "ITEM_PRICES_SPECIAL"."IP_UID" ="ITEM_PRICES"."IP_UID"
AND "ITEM_PRICES_SPECIAL"."CUST_UID" ="CUSTOMERS"."CUST_UID"
UNION
SELECT 'B' ||ROWNUM AS "IPSVW_UID",
"ITEM_PRICES_SPECIAL"."IPS_UID" AS "IPSVW_IPS_UID",
"ITEM_PRICES_SPECIAL"."CUST_UID" AS "IPSVW_CUST_UID",
"ITEM_PRICES_SPECIAL"."IP_UID" AS "IPSVW_IP_UID",
"ITEM_PRICES_SPECIAL"."IPS_SELL_PRICE" AS "IPSVW_IPS_SELL_PRICE"
FROM "ITEM_PRICES_SPECIAL" "ITEM_PRICES_SPECIAL";
And this is the instead of trigger
CREATE OR REPLACE TRIGGER "TRG_IPSVW_UPDATE" INSTEAD OF
UPDATE ON IPS_VW REFERENCING NEW AS N FOR EACH ROW
BEGIN
IF :N.IPSVW_IPS_UID = 0 THEN
INSERT INTO ITEM_PRICES_SPECIAL
( CUST_UID, IP_UID,IPS_SELL_PRICE )
VALUES
( :N.IPSVW_CUST_UID,:N.IPSVW_IP_UID, :N.IPSVW_IPS_SELL_PRICE );
ELSE
UPDATE ITEM_PRICES_SPECIAL
SET IPS_SELL_PRICE = :N.IPSVW_IPS_SELL_PRICE
WHERE IPS_UID = :N.IPSVW_IPS_UID;
END IF;
END;
Everything works fine in SQLPLUS, if i update a rate in this view, a record is either inserted or updated in the third table.
But when i try to create a tabular form based on this view, i get the error
ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP BY, etc.
Could someone help me please?
Thanks,
AllenI think The tabular form needs to be able to identify some primary key and using a rownum concatenation cannot provide that.
Cheers
Kofi
Maybe you are looking for
-
Urgent help with nokia 5230 and ovi suite
translated from Spanish to English translator by gogle I need help because my nokia 5230 I can not install applications from nokia ovi suite because it is not clear that anything the phone as you ago I can sync I can send things to your suite ovi ovi
-
Hi, I have created bunch of users in the Central system. How do I copy these users to the child systems? Please let me know. Thanks Seelan
-
How can I get my dad's iMac to produce typewriter sounds? He's visually impaired and it really helps him.
-
Printing in Chinese for photobook
Hello All, I want to print the photobook with introduction in Chinese. Did anyone in the forum print the album by Apple in Chinese before? What is your experience? Many Thanks, Anthony iMac 2Gb intel duo core Mac OS X (10.4.8)
-
After updating to 7.0 apple tv won't play certain tv shows.
I keep getting the error message "An error occured loading this content. Try again later." I've tried resetting the device, restarting my computer, and turning on/off home sharing on both devices. I don't have any problem watching movies from my libr