Populate Form Field from Post-Query Trigger

I have a form with some fields like "start_date", "company_id", "previous_start_date", "previous_company_id". Out of these, the "previous" fields are unbound and the others are bound to "my_companies" table. All are in the same block on the form. I have a post-query trigger which runs a cursor to select "previous" values based on the "start_date" and "company_id". More than one "previous" values is retrieved each time. My problem is that my cursor writes back only one value into my form field. I ran the cursor as a pl/sql block in TOAD to test and it fetches all the records that I need. I'm not sure what I'm doing wrong in writing the values into form items. The form items are of type "custom" and display type is "text" (I'm creating the form in Oracle Designer). My cursor code is something like this:
declare
cursor previous_data_cur is 
        select company_id,start_date
           from my_companies
           where company_id = :myblock.company_id
           and start_date < :myblock.start_date;       
BEGIN 
    open previous_data_cur;
    LOOP
    fetch previous_data_cur into :myblock.prev_company_id, :myblock.prev_start_date;
    EXIT WHEN previous_data_cur%NOTFOUND;
    END LOOP;
    close previous_data_cur; 
END; Can anyone provide any pointers on what I could be doing wrong or what I should do to make this work?
Any help is greatly appreciated.

Do you have several previous date fields per record?
How are they named? Previous_date_1, previous_date_2,...?
Try this:
declare
cursor previous_data_cur is 
        select start_date
           from my_companies
           where company_id = :myblock.company_id
           and start_date < :myblock.start_date;
   l_previous_data previous_data_cur%ROWTYPE;       
   l_count NUMBER;
BEGIN 
   l_count := 1
   FOR l_previous_data IN previous_data_cur
   LOOP
       copy(l_previous_data.start_date, 'my_block.previous_start_date_'|| l_count);
    END LOOP;
END; Caution:
- number of retrieved records may not exceed number of previous_date fields.
- not tested

Similar Messages

  • How to populate form fields from ODBC Database?

    Using LifeCycle ES2, i have created a form, to which through ODBC i have connected a database. Although in MS Query database picks up table relationships, including unique parent records of the table. However when input records from db tables in their respective position on the form, no db relation remains. What im trying to do is to make form populate all fileds based on change of unique parent record. Do i have to use XML schema for that [is there any generating software?] as im not familiar with XML. or are there any settings i have missed in LifeCycle? Because right now, altering any db fields in pdf forms do not affect any other db fields in the form. Please help!

    I think I am trying to do the same thing and I hope someone had done this before. I have a form that an employee will fill out for their travel expense reimbursement. On the top of the form, there is a drop-down-list that is alreay populated with a list of employees. The person who fills out the form will pick his/her name from the drop-down-list and the information will be populated for other fields such as employeeID, department and supervisor's name...
    The information that is supposed to be populated is in a database. How do I go about achieving this?
    Thanks in advance for any helps.

  • Is there an Oracle Forms Post-Query trigger equivalent

    Hi.
    Jdeveloper 11.1.1.2
    Is there a way in ADF to populate extra read-only text-columns in an af:table (based on a ViewObject) as was possible in Oracle Forms with a Post-Query-Trigger:
    Post-Query
    Perform an action after fetching a record, such as looking up values in other tables based on a value in the current record.
    Fires once for each record fetched into the block.
    Best regards
    Erik

    Erik wrote:
    Hi.
    Jdeveloper 11.1.1.2
    Is there a way in ADF to populate extra read-only text-columns in an af:table (based on a ViewObject) as was possible in Oracle Forms with a Post-Query-Trigger:
    Post-Query
    Perform an action after fetching a record, such as looking up values in other tables based on a value in the current record.
    Fires once for each record fetched into the block.
    Best regards
    ErikHi,
    http://docs.oracle.com/cd/E15523_01/web.1111/b31974/appendix_formstriggers.htm#sm0350

  • Master-Detail Form - implementing some thing like Post-Query trigger

    Hi all,
    I am struggling to implement an eqivalent of a post-query trigger in Oracle Forms. Please bear with me as I am trying to explain in detail what the problem is.
    Here is my situation.
    I have three tables EMP, DEPT and LOCATION. I created a Master/Table pages on EMP and DEPT.
    Basic relationships.
    Each LOCATION has one or more DEPTs; Each DEPT is at one and only one LOCATION.
    Each DEPT has one ore more EMPs; Each EMP is assigned to only and only DEPT.
    Not getting too complicated, here are the table layouts:
    LOCATION:
    ID number(10,0) not null,
    NAME varchar2(20) not null
    DEPT
    ID number(10,0) not null,
    NAME varchar2(20) not null,
    LOC_ID number (10,0) not null foreign key from LOCATION
    EMP
    ID number(10,0) not null,
    NAME varchar2(20) not null,
    DEPT_ID number (10,0) not null foreign key from DEPT
    Assume I have all the constraints, BIU triggers, sequences defined properly.
    I am using the APEX page wizard to create a Master/Detail Form on DEPT and EMP. The first page is the Master Report on DEPT. I want to display the Location Name on this page also. Because the Master Report allows
    you to change the query, I was able to add the Location Name as part of the
    query. This was very simple.
    Select a.name "Department_Name",
    b.name "Location"
    from dept a, location b
    where a.loc_id = b.id
    Moving on, In the Master Detail Form, I would like to get the Location Name as part of the first Region (Dept Region).
    In this region, I would like to include the Location Name also. So my first region on the Master Detail form includes:
    Dept Id: ________
    Dept Name: _______
    Location Name: __________
    As Region are automatically populated using using a Fetch Row from EMP table (Automated Row Fetch) on an After Header process point, I don't have a way of including the Location as part of query. So I created a Region level Item called Location Name, made it Display only.
    In the old SQL*Forms, or Oracle Forms days, I used to use a Post-Query trigger, or Post-Change trigger to fire on the Loc_Id column to populate the Location Name. Simple fetch like:
    Select name
    into :P80_location_name
    from location
    where loc_id = :P80_loc_id
    However, I am struggling to implement some thing simple like this in APEX. Tried creating a processes, computatations etc, but nothing is working.
    I have seen some previous responses to fetching values from a foreign table
    using a button or AJAX script, but this should be very basic. What am I
    missing here?
    Appreciate any insights.
    Thanks.
    John

    Hi John,
    I'm not too familiar with the post-query triggers in Oracle Forms, but the use of a List of Values (LOV) on your LOCATION table might do the trick for you. If you create a dynamic LOV based on your LOCATIONS table, it can then be referenced by the LOC_ID item on the Master-Detail page, to display the Location Name. You could try doing the following:
    1. Create a new dynamic LOV, LOCATIONS, using a query similar to the following:
    select Name d, ID r
    from LOCATION
    order by 1
    2. Edit the "Create" button on the Master report page, and in the "Optional URL Redirect" section set "Request" to CREATE. Click Apply Changes, to save the setting.
    3. Edit the LOC_ID item on your Master-Detail page, and set the following:
    * in the "Name" region change the "Display As" setting to Select List
    * in the "Label" region change the Label to Location Name.
    * in the "List of Values" region set the "Named LOV" to LOCATIONS
    * in the "Read Only" section, set the condition to Request != Expression 1, and set Expression 1 to CREATE.
    Click Apply Changes to save the settings.
    When you run the pages now, the Location Name field will appear as Read-Only when editing a selected Master row. The item will appear as a Select List when the user clicks "Create" on the Master page, to create a new Master row.
    I hope this helps.
    Regards,
    Hilary

  • POST-QUERY trigger cannot retrieve the database field in TEMPLATE.fmb

    I have tried to create a form using TEMPLATE.fmb in Oracle Apps R11i. I found that the POST-QUERY trigger cannot retrieve the database field (which is display item property) properly. Can anyone tell me how to retrieve the displayed database fields? Thanks for any helps.

    POST-QUERY would fire after the query has been executed, it does not do the actual data retrieve.
    See if the items you have put have the data source properties set and are not control items.
    btw, this forum is for OA users, you would get better response to your query if you post it in forms forum
    Thanks,
    Tapash

  • Post-Query Trigger Implementation in ADF

    Hi,
    I am working on a migration project.I need the equivalent functionality of POST-QUERY trigger of Oracle Forms,so i overrided the createInstanceFromResultSet(QueryCollection qc,ResultSet rs).can anybody suggest after getting some data from this method how to populate it in the client side field.?
    Thanks In advance

    All you've done is tell us how you implemented a particular use case in Forms - you haven't told us what is the use case... Describe to us what you are trying to accomplish, not how you did it in forms or how you've tried to do it in JDev.
    For example, "when the user retrieves the sales order, the shipping address should be retrieved and displayed on the screen" - something like that.
    John

  • POST-QUERY TRIGGER

    Hello.
    I'm a newbie here.
    I'm currently studying Oracle Form Builder and I'm a student.
    I've encountered this problem where I need to create a post-query trigger in a data block that counts a total number of rows in a particular item using a display item.
    I'm know I need to use the INTO clause to populate the display item but I got stuck.
    Please help.
    Thank you very much..

    First of all your code to calculate the total rows returned from a query is wrong.
    Try this one in a Post-Query Trigger
    DECLARE
    total_rows_returned NUMBER;
    BEGIN
    SELECT COUNT(*)
    INTO total_rows_returned
    FROM table_name;
    :block_name.display_item := total_rows_returned;
    END;
    Good Luck
    Saadat Ahmad
    Oracle Developer

  • Post Query Trigger with cursor

    Good afternoon to all of you!
    I need your help. I create a master detail form. I created also a post quey trigger, inside I wrote the code below.
    A cursor looks to another table and returns to the form some values i need!
    declare cursor C1 is select apofaa,startdate,enddate,transport
    from trapofdet
    where trapofdet.apofcode = :trapof.apofcode;
    begin
    open C1;
    loop
    fetch C1 into :TRAPODOSI_NEW_NEW.APOFAA, :TRAPODOSI_NEW_NEW.STARTDATE, :TRAPODOSI_NEW_NEW.ENDDATE, :TRAPODOSI_NEW_NEW.TRANSPORT;
    exit when C1%notfound;
    next_record;
    end loop;
    close C1;
    first_record;
    null;
    end;
    How to solve the a. frm-40737, illegal restricted procedure go block in post-query trigger
    b. It seems tha returns all the records but it appears only the last one.
    Please can anybody help with these?
    Thanks in advance!
    Christos

    Christos,
    The Post-Query trigger will fire once for each record returned to your form therefore you need to write your query to return a single row rather than a multiple rows. Using the Post-Query trigger to fetch additional data into your form can cause your form to be very slow - depending on the number of records returned and how many columns are fetched by your Post-Query cursor as well as how quickly the query executes.
    Is your Post-Query trigger on your Master or Detail block. Are you using the Post-Query trigger to populate your Detail block? Are you using a Block Relationship to coordinate your Master and Detail blocks?
    Also, it is helpful to know which version of Oracle Forms you're using.
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Post-query trigger order for data blocks in master detail relationship

    Using Forms [32 Bit] Version 10.1.2.2.0 (Production) Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production.
    I have the following problem with a form I am working on. It has a master data block with multiple detail data blocks. I am trying to create a post-query trigger on one of these detail blocks that will do a select using the value of a field from another of the detail blocks.
    The problem is that the post-query trigger of the data block I am trying to do the select with is firing before the post-query trigger of the block I need the value from is firing. I tested by just putting in a display message and having it return the value of the id I am tryign to use. Right after I do a query on the form, I get the messages saying:
    "Error: cannot find price for id:" and there is no id, and then the message from the other datablocks post-query saying, "id is: 123"
    Is there a way to change the order that the datablocks are queried? Or should I be using a different trigger to do this?

    Do you mean as it is displayed in the object navigator? It's not the first block under the data block section, but it is above the other block that is exceuting before it, so I assumed the order in that did not matter.
    EDIT: Thanks Magoo! That solved the issue.
    Edited by: a small rabbit on Sep 4, 2009 11:28 AM

  • Duplicating form fields from one PDF document to another

    Hi,
    Does anyone know of a way to select and duplicate all acrobat form fields from one PDF document into a new PDF document. I know I can do so one field at a time but would like to know if there is a way to do so in a wholesale fashion.
    Our PDF documents are created in-house each year and are nearly the same as the previous year's document containing 99% of the same form fields in the same locations. These forms contain a lot of form fields, anywhere from 50 to 100 fields.
    Rather than start from scratch each year defining the same fields that were present in the previous year's document, I am looking for a way to copy the form fields from an existing PDF document (last year's PDF in our case) and copy the form fields into a new PDF document (that does not yet have any form fields defined) and hopefully maintain all the field attributes and positions from the previous years document.
    Thanks for any suggestions,
    Steve

    The PDF template we need to copy the form fields "to" doesn't start out having any form fields. It is the fields that we need copied from a previous year's PDF template.
    Here's an except from my original post: "I am looking for a way to copy the form fields from an existing PDF document (last year's PDF in our case) and copy the form fields into a new PDF document (that does not yet have any form fields defined)"
    The "new" PDF template is a complete "paper" form with updated legal text and calendar year referrences but NO form fields. In our IS group, we then take these forms, add form fields to them and are then able to populate them with database-resident user data. We serve them up to the user in their browser pre-populated with their application data.
    So again, our need is to find a way to copy form fields from "last year's" PDF template and copy just the form fields to an fresh "new year's" PDF template that contains no form fields to begin with. What we begin with is just a PDF representation of a paper student loan application.
    Thanks for the suggestion!

  • How to revise form field value in query and skip validation

    Hi all,
    I have a 10g form that has a field which I want to manipulate during query. I want to display a different value depending upon its orignal value. I did this with a Post-Query trigger on the field's datablock. However, now, when I attempt a new query, the form thinks I've changed the field (which I did). I want to change the field but trick Forms into thinking there were no updates. How do I do this? Note: the field is a list item that has a style of combo box.
    Thanks, Mike

    Ammad,
    The reason is that sometimes the list returns the record group's key value (the second column) instead of the intended value (in the first column). This is because the record group is based on a SQL query. There are some values which are no longer in the table queried by the record group, thus the key value is displayed. I would rather nothing be displayed. As of now, I display a message indicating that there is a problem with the LOV.
    I know about using a non-database form field. But I don't have any room left and I don't want to lay the non-database field on top of the database field and then have to enable/disable the two fields.
    A friend at work suggested setting update_permission to trick Forms. Tried it but not successful yet.
    Thanks, Mike

  • Problem with post query trigger

    Hi,
    I have a multi record block and there is a post-query trigger on it. Based on values of this block I populate other values over the other control block.
    I wrote code in post-query trigger and when I execute the query and go to last but one record. The values in the control block are from last record instead of last but one record. Pls help me to fix
    Thanks,

    if you want to see the data in the control block synchronized with the database block then use the WHEN-NEW-RECORD-INSTANCE and not the POST-QUERY.
    with the POQ you add additional data (in non-basetable-items) to the records in the database block

  • Is there a sensible way to import form fields from an old pdf into a new pdf?

    I'm working with Acrobat X Pro on a Windows PC platform.  I've been working with a file that was originally created in CorelDraw X3, in landscape orientation. That document was then saved as a pdf and set up with many form fields (it's an order form). The document needed to be updated with minor changes made in the Corel file. I resaved as a pdf and now want to transfer the existing form fields from the old document into the newly revised one. I've tried copy/paste, but have to do small sections at a time because the program doesn't let me bring in all of the fields at the same time. I then tried Document > Replace page, which I've seen described in other forum posts; but when I do that, the entire set of fields comes in rotated at 90 degrees counterclockwise. I did read that if the original document was created in a different orientation, that could affect how the fields paste in, but that is not the case here. The original file, and all successive pdf files all have been the same orientation. I'm boggled and think that there has to be an easier way than copying fields, a section at a time, and resizing them all over again.
    This older post is pretty similar to what I am trying to do, but it seems I'm getting a different end result. Any suggestions?
    Create fillable form with changing source document

    I am using Acrobat Pro 10. I have the same problem and finally after numerous different attempts of solving based on all the suggestions, I resolved my problem by Printing to PDF via the print dialog in Word. When I pasted the fields that were previously rotating onto the new "printed" PDf, the fields retained their orientation as desired.
    To clarify, I am using Word 2007, Acrobat Pro 10, the document is landscape, both the original (with fields) PDF and all attempted new PDF's were of the diemnsions 11 x 8.5. The only noticeable difference in the PDF properties for the PDF's were Tagged PDF and Fast Web View. The original PDF (with fields) was No in both cases and all attempts other than the Print to PDF were Yes, meaning that the Print to PDF was No. I am not sure if this made the Print to PDF work or not as I have already spent too much time trying to resolves this issue. Hope this helps.

  • LEFT OUTER JOIN, Problem in POST-QUERY TRIGGER

    Hi,
    Please guide for the following
    I wrote below query in POST-QUERY Trigger of a TABULAR DATA BLOCK, having only one text item, called INVENTORY_ITEM
    select c.cat||' '||s.subcat||' '||l1.lvl1 ITEM INTO :DATABLOCK.INVENTORY_ITEM
    from itemcat c
    LEFT OUTER JOIN itemsubcat s on (c.catid = s.catid)
    LEFT OUTER JOIN lvl1 l1 on (s.subcatid = l1.subcatid)
    When I compile the module an error is generated
    *" Encountered the symbol 'LEFT' when expecting one of the following ,; for group having intersect minus order start union where connect ".*
    Above query is working fine in ORACLE SQL DEVELOPER .
    Any solution please.
    Regards,

    Difference

  • Post-query trigger ? save changes?

    I have a similar problem to that posted by 'nova' on Dec. 27, 2000. I have a form generated by Designer. The problem is that upon subsequent querying (F8 pressed twice), it asks me if I want to save my changes, when I have not made any changes.
    I looked in the generated code for the post-query trigger and found SET_RECORD_PROPERTY(:SYSTEM.TRIGGER_RECORD, 'NEW_CUST', STATUS, QUERY_STATUS) which is apparently not the problem, according to this prior post. I am at a loss and have tried everything I could think of.
    What else could be causing this? I checked to see if there were any items being set in the property sheet to default values, and removed the defaults - that did not work.
    ??? I would greatly appreciate any assistance. Thanks.

    Hi Pina,
    my similar problem I have solved like this:
    Post-Record trigger:
    BEGIN
    *** this is important to test the record status - without this I had the same problem
    IF :SYSTEM.Record_Status='INSERT' THEN
    IF :TRANZIT_ZADAJ.ID_SADZBY_TV_PRENOSOV IS NULL THEN
    :TRANZIT_ZADAJ.ID_SADZBY_TV_PRENOSOV:=:SADZBY_ZADAJ.ID;
    END IF;
    END IF;
    END;
    You can check Pre-... and Post-... triggers
    if there are any items being set to any values.
    I hope this will help you.
    Helena

Maybe you are looking for