Ordering in a non-database datablock

Hi all,
What is the best way to handle this.
I have a non-database datablock which I populate the contents manually.
I want to sort the the contents of this data block.
What do you suggest ?
If I cant find a good solution from oracle I need to handle it while populating the data-block.
Thanks for your suggestions
-msoyer

Here is a sample that works fine with Forms 10gR2 (10.1.2)
create the following database types:
rem --record --
create or replace type TP1 as object(
   num1  number(3),
   char1 varchar2(40)
rem -- table of records --
create or replace type TYP_TAB_TP1 is table of TP1
/Then, you are able to handle this object in the forms module:
declare
  tt typ_tab_tp1 := typ_tab_tp1();
  cursor cc is select * from table(tt) order by 1 desc;
Begin 
for i in 1..10 loop
   tt.extend ;
   tt(i) := TP1(i, to_char(i));
end loop;
for c in cc loop
   :bl.res := :bl.res || c.num1 || '-' || c.char1 || chr(10);
end loop;
end;As you can see, your pl/sql internal collection is treated and selected like a standard database table with any WHERE or ORDER BY clause.
Francois

Similar Messages

  • Order By Clause on Non-Database Column using Forms

    How to Sort by using Order by Clause on Non-Database Column using Forms6i

    Eugene,
    What is the error message/ number you are seeing? If you run "select name from tblperson order by name" do you still get an error?

  • Ordering a non-database block....

    Hi ,
    Is it possible to order and how a non-database block according to user's willing...????
    Thanks , a lot
    Simon

    That will work in sql*plus but to use it in a program you'll need to parameterise the Order By clause. That's why I wrote mine the way I did. It will work in sql*plus if you enter 'A' and 'B' (including the quotes) and it will work in a program if you replace the placeholders with variables.
    SQL> WITH data AS(
      2    SELECT 1 a, 9 b FROM dual UNION ALL
      3    SELECT 1 a, 1 b FROM dual UNION ALL
      4    SELECT 1 a, 8 b FROM dual UNION ALL
      5    SELECT 1 a, 2 b FROM dual UNION ALL
      6    SELECT 1 a, 7 b FROM dual UNION ALL
      7    SELECT 2 a, 8 b FROM dual UNION ALL
      8    SELECT 3 a, 7 b FROM dual UNION ALL
      9    SELECT 4 a, 6 b FROM dual UNION ALL
    10    SELECT 5 a, 5 b FROM dual UNION ALL
    11    SELECT 6 a, 4 b FROM dual UNION ALL
    12    SELECT 7 a, 3 b FROM dual UNION ALL
    13    SELECT 8 a, 2 b FROM dual UNION ALL
    14    SELECT 9 a, 1 b FROM dual
    15  )
    16  SELECT a, b FROM data
    17  ORDER BY
    18    Decode(&ordr1,'A',a,'B',b),
    19    Decode(&ordr2,'A',a,'B',b)
    20  ;
    Enter value for ordr1: 'A'
    old  18:   Decode(&ordr1,'A',a,'B',b),
    new  18:   Decode('A','A',a,'B',b),
    Enter value for ordr2: 'B'
    old  19:   Decode(&ordr2,'A',a,'B',b)
    new  19:   Decode('B','A',a,'B',b)
             A          B
             1          1
             1          2
             1          7
             1          8
             1          9
             2          8
             3          7
             4          6
             5          5
             6          4
             7          3
             8          2
             9          1
    13 rows selected.
    SQL> /
    Enter value for ordr1: 'B'
    old  18:   Decode(&ordr1,'A',a,'B',b),
    new  18:   Decode('B','A',a,'B',b),
    Enter value for ordr2: 'A'
    old  19:   Decode(&ordr2,'A',a,'B',b)
    new  19:   Decode('A','A',a,'B',b)
             A          B
             1          1
             9          1
             1          2
             8          2
             7          3
             6          4
             5          5
             4          6
             1          7
             3          7
             1          8
             2          8
             1          9
    13 rows selected.
    SQL> var ordr1 varchar2(1);
    SQL> var ordr2 varchar2(1);
    SQL> exec :ordr1 := 'A';
    PL/SQL procedure successfully completed.
    SQL> exec :ordr2 := 'B';
    PL/SQL procedure successfully completed.
    SQL> WITH data AS(
      2    SELECT 1 a, 9 b FROM dual UNION ALL
      3    SELECT 1 a, 1 b FROM dual UNION ALL
      4    SELECT 1 a, 8 b FROM dual UNION ALL
      5    SELECT 1 a, 2 b FROM dual UNION ALL
      6    SELECT 1 a, 7 b FROM dual UNION ALL
      7    SELECT 2 a, 8 b FROM dual UNION ALL
      8    SELECT 3 a, 7 b FROM dual UNION ALL
      9    SELECT 4 a, 6 b FROM dual UNION ALL
    10    SELECT 5 a, 5 b FROM dual UNION ALL
    11    SELECT 6 a, 4 b FROM dual UNION ALL
    12    SELECT 7 a, 3 b FROM dual UNION ALL
    13    SELECT 8 a, 2 b FROM dual UNION ALL
    14    SELECT 9 a, 1 b FROM dual
    15  )
    16  SELECT a, b FROM data
    17  ORDER BY
    18    Decode(:ordr1,'A',a,'B',b),
    19    Decode(:ordr2,'A',a,'B',b)
    20  ;
             A          B
             1          1
             1          2
             1          7
             1          8
             1          9
             2          8
             3          7
             4          6
             5          5
             6          4
             7          3
             8          2
             9          1
    13 rows selected.
    SQL> exec :ordr1 := 'B';
    PL/SQL procedure successfully completed.
    SQL> exec :ordr2 := 'A';
    PL/SQL procedure successfully completed.
    SQL> /
             A          B
             1          1
             9          1
             1          2
             8          2
             7          3
             6          4
             5          5
             4          6
             1          7
             3          7
             1          8
             2          8
             1          9
    13 rows selected.
    SQL>

  • Sort a non database item

    I have one datablock (ma_erz) in my forms based on the table test1.
    Datase-Items of table test1:
    :ma_erz.MAE_ID,
    :ma_erz.MAE_SYSART
    Non-Database-Items:
    :ma_erz.L_KM_USERNAME
    My problem is, that I could not sort the records of a non-database-item.
    Does anybody know a workaround? I would like to sort the records to username.
    I am saving the username in :MA_ERZ.L_KM_USERNAME in Post-Query
    of datablock ma_erz:
    /* CGFK$QRY_LOOKUP_DATA */
    /* Query lookup data for the foreign key(s) */
    BEGIN
    IF (
            (name_in('MA_ERZ.MAE_SYSART') IS NOT NULL)
      THEN
        BEGIN
          CGFK$QRY_MA_ERZ_MA_ERZ_SYS_ERZ(
            :MA_ERZ.L_ERZSYS_ERZ_BEZEICHNUNG,    /* OUT: Value in item :MA_ERZ.L_ERZSYS_ERZ_BEZEICHNUNG */
            :MA_ERZ.MAE_SYSART);                 /* IN : Value in item :MA_ERZ.MAE_SYSART */
        EXCEPTION
          WHEN NO_DATA_FOUND THEN
            MESSAGE('Fehler : Sys Art does not exist');
          WHEN OTHERS THEN
            CGTE$OTHER_EXCEPTIONS;
        END;
        SET_RECORD_PROPERTY(:SYSTEM.TRIGGER_RECORD, 'MA_ERZ', STATUS , QUERY_STATUS);
      END IF;
      IF (
            (name_in('MA_ERZ.MAE_ID') IS NOT NULL)
      THEN
        BEGIN
          CGFK$QRY_MA_ERZ_MA_ERZ_SYS_KM_(
            :MA_ERZ.L_KM_VORNAME,    /* OUT: Value in item :MA_ERZ.L_KM_VORNAME */
            :MA_ERZ.L_KM_NAME,       /* OUT: Value in item :MA_ERZ.L_KM_NAME */
            :MA_ERZ.L_KM_USERNAME,   /* OUT: Value in item :MA_ERZ.L_KM_USERNAME */
            :MA_ERZ.MAE_ID);         /* IN : Value in item :MA_ERZ.MAE_ID */
        EXCEPTION
          WHEN NO_DATA_FOUND THEN
            MESSAGE('Error :  does not exist');
          WHEN OTHERS THEN
            CGTE$OTHER_EXCEPTIONS;
        END;
        SET_RECORD_PROPERTY(:SYSTEM.TRIGGER_RECORD, 'MA_ERZ', STATUS , QUERY_STATUS);
      END IF;
    END;
    /* CGFK$RESET_BLOCK_WHERE_CLAUSE */
    BEGIN
      IF (CG$PROTOTYP_MA_ERZ_V01_GLOBALS.MA_ERZ_WHERE <> 'first_time') OR
        CG$PROTOTYP_MA_ERZ_V01_GLOBALS.MA_ERZ_WHERE IS NULL THEN
        set_block_property('MA_ERZ', DEFAULT_WHERE, CG$PROTOTYP_MA_ERZ_V01_GLOBALS.MA_ERZ_WHERE);
        CG$PROTOTYP_MA_ERZ_V01_GLOBALS.MA_ERZ_WHERE := 'first_time';
      END IF;
    END;

    Or, even simpler, put the following in your order by:
    ORDER BY (SELECT THELOOKUPCOLUMN
                FROM THELOOKUPTABLE X
               WHERE X.MAE_ID=Y.MAE_ID)Additionally, set the ALIAS of the block to Y
    p.s. you could even skip the "ORDER BY" itself.

  • HOW TO CREATE MULTIPLE RECORDS IN A NONE DATABASE BLOCK?

    I have a Form where I have a none database block with unbound items. The block
    has 10 records. In the when-new-block instance I run a query by which I would
    like to fill up the block with data. The code fragment looks like the
    following:
    begin
    declare
    tmp_curr_rec_id number;
    begin
    -- a hibak kiolvasasa
    for c_hibak in ( select h.*, h.rowid
    from hibak h
    where 1=1 -- WF - Ide kerul a szurofeltetel
    order by bejelentes_datum asc
    ) loop
    -- bemasoljuk az adatokat az unbound item-ekbe
    :mc_adat.ub_azonosito := c_hibak.azonosito;
    :mc_adat.ub_verzio_letrehozas_datum :=
    c_hibak.verzio_letrehozas_datum;
    :mc_adat.ub_bejelento := c_hibak.bejelento;
    :mc_adat.ub_bejelentes_datum := c_hibak.bejelentes_datum;
    :mc_adat.ub_wf_verzio_csomopont :=
    c_hibak.wf_verzio_csomopont;
    :mc_adat.ub_wf_utolso_esemeny_szoveg :=
    c_hibak.wf_utolso_esemeny_szoveg;
    :mc_adat.ub_hiba_leiras := c_hibak.hiba_leiras;
    :mc_adat.ub_hiba_hely := c_hibak.hiba_hely;
    :mc_adat.ub_rekord_jelleg := 'H';
    :mc_adat.ub_rowid := c_hibak.rowid;
    -- beallitjuk a rekordot-ot olyanra, mintha semmi nem valtozott
    volna
    -- nem szeretnenk a form bezaraskor mindenfele figyelmezteteseket
    -- olvasni a kepernyon
    tmp_curr_rec_id := get_block_property( :system.current_block,
    current_record );
    set_record_property( tmp_curr_rec_id, :system.current_block,
    status, new_status );
    create_record;
    end loop;
    end;
    end;
    The block's update allowed, insert allowed, delete allowed property is set to
    true.
    The result of the code above is that only the last record fetched shows up in
    the block. The problem is - as I found out - is that aech record is fetched,
    the values are copied to the block items, but the create_record built-in
    command would not move the cursor to the next row.
    Can some one please help me with this?
    TIA,
    Tamas Szecsy

    The problem was with the following code segment:
    tmp_curr_rec_id := get_block_property( :system.current_block, current_record );
    set_record_property( tmp_curr_rec_id, :system.current_block, status, new_status );
    After omitting these two lines, the code worked properly.
    Thansk for all whoe replied.
    Regards,
    Tamas

  • Non-Database Item Sort Using Multiple Block Values

    I need to sort the result set of a block based on a calculated item. I found several messages addressing this, however they all speak to using the columns from within the same block as input variables to the function used to calculate the non-database column value.
    My problem is that I need to use values from a different block as input variables. I have not found a way to use them since I need to use the full block.column syntax. Forms does not like this and always thows an error right at the period(.). I need to do this because the column names are the same in each block. the function compares the column values and changes the record instance background a different color based based on how many of the column pairs match. Each block is mutually exclusive from each other and doing a accurate join is not really possible.
    I tried renaming the block column name to something unique, however I get a variable not bound error when I try to use it in the order by function even though their values are in the top most block.
    For Example:
    First Block. Contains a list of cases that need to be worked because the automated process could not find a valid provider based on the values received. This list is created by a background process.
    Table: CASE_MAIN
    TIN
    CASE_ID
    FCLTY_CM
    MEDICARE_CM
    Unrelated Second Block (i.e., no join). It uses the TIN value in the first block to get a list of all of the providers for the TIN associated with the Case so that a person can assign the correct Provider to the case (A TIN has a provider and address associated with it). As a result there is no link to the results of this table and the CASE_ID. That's what the users needs to do manually
    Table: PROVIDER_MAIN
    FCLTY
    MEDICARE
    I need to take the values in the first block and compare them in the second block so that I can recolor the background based on matching logic in the function below.
    order by clause = get_vals( ''||:FCLTY_CM||''
    ,''||:MEDICARE_CM||''
    ,fclty
    ,medicare) desc
    I am able to do the coloring within the form easily, however I need to order them by how many values match exactly so the ones that match to most value pairs show at the top. Hence ordering by the result of the function. I return a 0,1, or 2 based on the matches. 0 for none and 2 for both.
    I cannot create a view because the sources of the information I need to compare are NOT related to each other, yet. that is what the application is designed to do. I have a case without a
    provider assigned, but I have a tax id number that possible identifies the provider. I use this TIN to query the provider table for all of the possible providers under that TIN. As a result there is no link between the case information and provider information. The goal is to get this list compare the values from the target information and put the most likely matches on top, with
    the ones with the most matches first. I can create a function many ways that takes in various parameters. For example Case ID and Provider Id and query the records in subselects
    individually like so;
    select count(*)
    from (select fclty, medicare from case_main where case_id p_case_id) cm
    ,(select fclty, medicare from provider_main where prv_id = p_prv_id) pm
    where cm.fclty = pm.fclty
    and cm.medicare = pm.medicare
    If the number is greater than zero I know I have a match with that provider and I can sort accoringly. I can also pass in the target information from case_main and the provider inforation from provider_main and then do an if/then statement for comparing. Then I can use this function to create a column value for each record and then use the same reference to the function in the order by clause to order by that value.
    The problem comes in trying to reference the case_id or target information from a different block than where the fucntion needs to be used. I get a variable bound not error message. What am I missing here. Why can I not reference a uniquely named block item as a input variable to a function in a different block? Does Forms first figure out what it needs to retrieve and then executes the SQL for each block in isolation, or does the first block's result set get retrieved, then the second, third, etc. Based on the message i am getting I would suspect the former since it appears their is no value in subsequent blocks. If so is there anyway around this? thanks.

    Don't quite understand your problem completely. But this might help. I sure hope your Provider_Main is a single-record block ...otherwise, how would you supply a list of values of FCLTY and MEDICARE to the function that does the sorting? Be awere, too, that the order-by is processed by the server, and NOT by Forms.
    Assuming it is a single-record block, you can put the values into parameters:
    :Parameter.Fclty := :Provider_Main.Fclty;
    :Parameter.Medicare := :Provider.Medicare;
    Execute_Query;
    And your order-by clause would be
    get_vals( ''||:FCLTY_CM||'',''||:MEDICARE_CM||'',
    :Parameter.Fclty,
    :Parameter.Medicare) desc
    By the way, the first line of your order-by looks strange. Shouldn't it be:
    get_vals( FCLTY_CM || ',' || MEDICARE_CM,
    or even better, get_vals should take in 4 parameters:
    get_vals(Fclty_cm, Medicare_cm, :parameter.Fclty, :parameter.Medicare)

  • How to promt user to save changes when changing non-database fields?

    Hi,
    I have a form with two tabs. The datablock Block_1 on tab_2 is based on a database view. But all the displayed items of Block_1 are non-database items. Whenever a user changes some items in Block_1 and presses save button, the values from non_db items get copied to the db_items (based on view) and commit_form is called. This works fine.
    But the problem here is: after changing some items in block_1, if the user navigates to some other option/form from the menu , the form doesnt promt the user to 'save the changes' and all the changes made are lost. How can I fix that?
    I have a form level key-exit trigger, (which does not fire) with following code :-
    Declare
      X  Number;
      alert_is             alert;
    Begin
    If :System.Mode = 'ENTER-QUERY' Then
           Exit_Form;
    Else
      If :System.Form_Status In ('NEW','QUERY') Then
           alert_is := FIND_ALERT('TMPL_EXIT'); -- "Are you sure you want to exit?"
        X := Show_Alert('TMPL_EXIT');
        If X = Alert_Button1 Then
           Exit_Form(no_validate);
        End If;
        Else
           Exit_Form;
      End If;
    End If;
    End;

    Slava Natapov wrote:
    Samita wrote:
    Whenever a user changes some items in Block_1 and presses save button, the values from non_db items get copied to the db_items (based on view) and commit_form is called. Try to copy values to the db_items not in save button, but in WHEN-VALIDATE_ITEM of non_db items.- I created the non-db items becoz, it was asking me 'Do you want to save changes', even when I only queried data from the view (becoz i was doing some computations while displaying the items. and the form assumed that the DB items were begin changed ). Inorder to get rid of that problem, i used mirror_items (non-db) for all the db items.
    So under this scenario, when i copy values to the db_items in WHEN-VALIDATE_ITEM trigger of non_db items, the form considers the db_items are changed and asks 'Do you want to save changes' even when the user has not made any changes and only queried data.
    Edited by: Samita on Dec 9, 2009 10:12 AM

  • How to include non database item in the query

    Hi
    I have a Master-Detail form. where in the detail block one of the field is text item 'X' attached the list of values(Y). Master block includes non database items which is based in the decoding result of the database items for example:
    Gender(Male, Female)>> non database item
    Gender_id(M,F)>>database item
    the form is created based on the template.fmb form for apps. When I run the form in the query mode, i can query about any database item while including query about others non database item does not affect.
    how to can i modify it so this could be handled??
    I know that one way to avoid this issue is to create a view with all my desired field.
    but there should be away to override the build in query used by oracle apps...
    any one has a link, source, document... etc that help on this??
    any idea how to do it without creating a view??
    thnx alot

    Hi HST,
    You can code the handling in POST-Query of the corresponding block to retrive the corresponding data depending on the Queried data.
    Regards,
    Kiran

  • Check box as a non database item

    Hi.,
    I am using jdev 11.1.5
    My scenario:
    I need to use checkbox in my af:table which is a non database item
    if i check that check box i need to select the current row in that table
    ex:
    yr        period     type
    2010    2            AJ    [checkbox]
    2010    3            AJ    [checkbox]If I check the 2nd period check box then the value of
    Row row= vo.getcrrent();
    row.getAttribute("period");  //   this value must be 2
    check box must be a non-database item
    how can i do this

    is this what you want?
    Row row= vo.getcrrent();
    row.getAttribute("period");  //   this value must be 2
    int index =vo.getRangeIndexOf(row); //Get the index of the given row relative to the beginning of the range. http://download.oracle.com/docs/cd/E12839_01/apirefs.1111/e10653/oracle/jbo/RowIterator.html#getRangeIndexOf%28oracle.jbo.Row%29

  • Using javascript to set non database values

    I finally figured out how to set the values of a non database form field using Javascript. The only problem is, I want this
    field to be a display only field, and the value does not get set if I make the field non updateable on the form. Can
    somebody please help me!! This is urgent.

    Stan,
    One way to do this is to call the doSubmit() function and create a page branch to handle your request. This way you can use apex validations and other goodies if your requirements change. Also this will save the state of your items on the page you are leaving.
    Edit
    I forgot to mention that you can pass a string parameter to the doSubmit function. The parameter will be the request sent to apex. For instance you could use doSubmit('DO_SOMETHING') and you can have a page branch which will fire if the request is equal to DO_SOMETHING.
    Cheers,
    Tyson Jouglet
    Edited by: Tyson Jouglet on Dec 1, 2009 10:11 AM

  • Function not returning database rows properly in non-database item

    Hi,
    I have 3 database items that I'd like to concatenate into one field and display it in a non-database item. I have setup two different methods to do this for testing purposes. First, I created three separate database items (SECTION, ROW, & SEAT_NUM) and a non-database item (SEAT). I created a formula (in SEAT) to do the concatenation and this way works fine. For my second method, I created a function where I selected the 3 fields and performed a concatenation into a single value to be returned in a seperate non-database item (SEAT_TEST).
    Here's my function:
    FUNCTION SeatLocation(p_id IN event.id%TYPE)
    RETURN VARCHAR2 IS
    CURSOR a IS
    (SELECT ltrim(rtrim(event.section,' '),' ')||' '||
    ltrim(rtrim(event.row,' '),' ')||' '||
    ltrim(rtrim(event.seat_num,' '),' ') seat
    FROM event
    WHERE event.id = p_id);
    BEGIN
    FOR rec IN a LOOP
    IF rec.seat IS NOT NULL THEN
    RETURN rec.seat;
    ELSE
    RETURN ' ';
    END IF;
    END LOOP;
    END SeatLocation;
    And I'm calling it in a POST_QUERY trigger with the following: :event.seat_test := SeatLocation(:event.id);
    I put both non-database items side-by-side, run the form, and the first method works fine. I doesn't quite work for the function to display in SEAT_TEST. For my program, an ID can have multiple seat locations and I'd like to display all those seats as I scroll through the form (for a given ID). What the function is returning is only the first records seat location even though there are two more locations (from the remaining two records) that need to be displayed, but are not. It works fine for the formula method. Is there a work around this within my function code and/or the SEAT_TEST item? I'd like to keep my function instead because I could use the code elsewhere. I thought that since there is more than one record retrieved for a particular ID, the for loop would return one value each loop iteration and display the different value seat locations as I scroll/arrow down through the form. I didn't know if you had to call the POST-QUERY trigger multiple times for the number or records you retrieve in the cursor. I hope this makes sense.
    Any advice would be greatly appreciated.
    Thank you,
    Eric

    Even though your function is written to loop through multiple records, as soon as it hits the first one inside the FOR loop, it returns that value. The Return command is an exit, so the function is done, and you cannot expect it to magically run a second time just because the cursor found more than one row.
    You need to pass the function all the parameters to form a unique key into the row you are looking up. ID is not unique.

  • Querying a record from a non-database item

    I am working in Apex 4.0. I have a page based on a table with the following columns: dktnr, borrower, amount, previous_dktnr, subsequent_dktnr. The precious_dktnr is the dktnr under which the loan was financed in the past, before its assumption or refiancing. The subsequent_dktnr is the dktnr under which the loan is later identified. When a loan is refinanced, it is assigned a new dktnr in a new record, and the old dktnr is placed in the previous_dktnr column of that new record, and the current dktnr is placed in the subsequent_dktnr column of the old dktnr record.
    I created two buttons, one for the previous_dktnr and one of the subsequent_dktnr. When I click either of these buttons, the action redirects to the current page and places the value of either the previous or subsequent dktnr into the dktnr item. This queries the record for the dktnr that has the same value as the previous or subsequent dktnr.
    This works. It allows the user to shuffle back and forth between the two dktnr's.
    One would assume then that, if a non-database item were created, say :P22_QUERY_DKTNR, you would be able to enter an existing dktnr into that item and have a button, using the same logic as the previous and subsequent dktnr buttons, that would be able to return the record for the dktnr entered.
    I have tried this, and it does not work. Can anyone tell me why it does not work?
    Edited by: Doug on Apr 9, 2011 3:42 PM
    Edited by: Doug on Apr 9, 2011 3:43 PM
    Edited by: Doug on Apr 9, 2011 3:43 PM
    Edited by: Doug on Apr 9, 2011 3:45 PM
    Edited by: Doug on Apr 9, 2011 3:46 PM

    Doug,
    Made copies of your two page within your workspace, page 3 & 4.
    The issue was the page did not have a value in session containing your Look_Up value. I altered the Look-Up button to Submit the Page so as to capture the Look_Up value and then added a new Page Branch that was sequenced prior to your existing branch. This new branch sets your P4_DKTNR with the Look_Up value and then returns your results.
    Jeff

  • Problems with query on a non-database field

    Hi,
    Hopefully I am in the correct section...
    I have some problems. I wanna query a non-database field but it does not work for one of them. I have tried the following...
    declare
    vsNewDefaultWhere varchar2(4000);
    vbFirstWhere boolean;
    cursor curArea is
    select a1_area, a1_hbno, a1_seqno
    from b1_in, c1_hdr, a1_bl
    where b1_sequenceno = a1_seqno
    and b1_shipid = a1_hbno
    and b1_id = :c1_shipid;
    rowArea curArea%ROWTYPE;
    procedure mergeStrings (sNewWhereClause varchar2) is
    begin
    if not vbFirstWhere then
    vsNewDefaultWhere := vsNewDefaultWhere || ' and ';
    end if;
    vsNewDefaultWhere := vsNewDefaultWhere || sNewWhereClause;
    vbFirstWhere := false;
    end mergeStrings;
    begin
    navigate.resetselrows('IMP_HDR');
    navigate.resetselrows('IMP_DTL');
    if not navigate.customwhereclause then
    navigate.resetwhereclause('IMP_HDR');
    end if;
    vsNewDefaultWhere := Get_Block_Property('IMP_HDR', DEFAULT_WHERE);
    vbFirstWhere := vsNewDefaultWhere is null;
    ---- does work!
    if :IMP_HDR.c1_usecode is not null then
    mergeStrings('c1_shipid in (select b1_id from b1_in where b1_fac = ''' || :global.fac || ''' and b1_comp = ''' || :global.comp || ''' and b1_code like ''' || :c1_usecode || ''')');
    end if;
    ---- does not work!
    open curArea;
    fetch curArea into rowArea;
    if curArea%found then
    if :IMP_HDR.c1_area is not null then
    mergeStrings('c1_shipid in (select b1_id from b1_in, c1_hdr, a1_bl where b1_fac = ''' || :global.fac || ''' and b1_comp = ''' || :global.comp || ''' and b1_sequenceno = ''' || rowArea.a1_seqno || ''' and b1_shipid = ''' || rowArea.a1_hbno || ''' and rowArea.a1_area like ''' || :c1_area || ''')');
    end if;
    end if;
    end;
    Thanks for your help in advance and let me know if you Need more Information.

    Hello,
    Ask Personalization questions in the dedicated E-Business Suite forum ;-)
    Francois

  • When-validate-record trigger only if  a non database item is changed

    Hi,
    I am trying a code in the when-vaidate-record trigger in the BLOCK level.
    The trigger should fire only if a checkbox item value is ticked(Value ='Y) for the present record(i.e, if already existing other records have a value ticked (='Y), it doesnt matter and trigger shouldnt fire)
    Please help me achieve this :
    The code I have tried in when-vaidate-trigger, which does not work as what I want :
    DECLARE
    X NUMBER;
    BEGIN
    if
      nvl ( :DEFLOC.to_be_defaulted, 'N' ) = 'Y' and :DEFLOC.COMMENTS is NULL
      and :SYSTEM.RECORD_STATUS ='CHANGED'
         then
        set_alert_property(
             'err_alert',
             alert_message_text,
             'You must enter a comment when defaulting localities.');
              x := show_alert('err_alert');
              RAISE FORM_TRIGGER_FAILURE;
              end if;
    END;The above code does not fire at all..
    If I remove the part,
    and :SYSTEM.RECORD_STATUS ='CHANGED'
    it fires for "all records"(not just the currently changed records) where nvl ( :DEFLOC.to_be_defaulted, 'N' ) = 'Y' and :DEFLOC.COMMENTS is NULL
    Please help !!
    Note: :DEFLOC.to_be_defaulted is a non database item ; :DEFLOC.COMMENTS is a database item

    Hi kriti,
    There is one more way,
    In the when-checkbox-changed trigger,
    if :your_chk_box = 'Y' then
    set_Record_property(:system.cursor_Record, 'your_blk',status,changed_Status);
    else
    set_Record_property(:system.cursor_Record, 'your_blk',status,Query_Status);
    end if;
    Then it is easy for you to find out the changed records using get_Record_property((:system.cursor_Record, 'your_blk',status)
    Hey let me ask you one Question, is that check_box item is database item ???
    If so,
    it is easier..the fol. code will work for that
    if   nvl ( :DEFLOC.to_be_defaulted, 'N' ) = 'Y' and :DEFLOC.COMMENTS is NULL
      and nvl(get_item_property('DEFLOC.to_be_defaulted',database_value),'N') = 'N'      then
                      set_alert_property(
             'err_alert',
             alert_message_text,
             'You must enter a comment when defaulting localities.');
              x := show_alert('err_alert');
              RAISE FORM_TRIGGER_FAILURE;
              end if;otherwise
    If your are creating that temp. item, it should be in the same block as non-db item.
    I will explain this... You are setting the status of to_be_defaulted check box of some queried record to Y based on some conditions, right?
    These records anyways are not updateable. Now your requirement is to find out the newly checked check boxes.
    So in the post query or the place where you set to_be_defaulted as 'Y, we will default the new item with value Y, so that in the when validate trigger, you
    know which record needs to attacked, It is those records with nvl( new item ,'N') = 'N' and to_be_defaulted = 'Y'...
    Regards
    Dora...

  • Problem with non-database item

    I have a 10g rel 2 form that has a post-query trigger that populates a non-database item. The non-database item has a when-validate-item trigger which I only want to fire when the user changes something in that field not at query time because it causes the form status to be changed. How can I either prevent this trigger from firing in query mode or test within the trigger that I'm in query mode so that the logic won't get executed?

    Put this at the top of your when-validate trigger:
      If :system.mode = 'QUERY' then
        return;
      End if;I have found that post-query activity often causes ALL when-validate triggers at the item and block level to run. So you may need those three lines in every when-validate trigger.

Maybe you are looking for

  • How do I transfer music from my iPod to my iPad?

    I have so many wires and leads and cannot see one that connects my ipad to ipod or ipad to PC. Do I now have to buy yet ANOTHER accessory from Apple or can this be done wirelessly? Any help appreciated, thanks. :-)

  • Flash movies made in keynote are not working in firefox

    I have just finished a 65 page iwebsite at www.acendedmasterscards.com it is a card reading with a flash movie - made in keynote for each card. It looks beautiful in Safari but in firefox I get a blank white bit instead of the movie. Help! I would al

  • HT4865 How do I get into my phone when it wont recognize the password?

    My iphone will not recognize the password and keeps locking me out of my phone??? Plus it has other languages coming up as well.

  • Open & Save Dialog Window Location

    It's a hard one to give a name to, that's why I can't seem to find it on a search. Basically, I'm wondering if anyone knows of a way to get the "save dialog" to not sit over the top of a program when it comes up. Best example is MS Word 2008 (mac) -

  • Mail Features Disappeared

    I'm going to try to explain this as best I can. I use a Microsoft mouse with my Mac G5. I use it, because I like the convenience of being able to right and left click. Whenever I wrote an email using the Mail application, I was able to highlight and