Avoiding miscalculation of calculated item in query mode

Hi:
Imagine an invoice data entry system. 2 Blocks... the master (orders) and the detail (order_products). In the master you have the customer info and all that usual data... the details are the lines of products that this customer bought (quantity, price, etc) .
Now imagine that I have calculated items that do the sum of the values from the lines and that are saved in the totals of the master block. And these calculations work very well...
UPS... no they don't!
Now imagine an order with 5 lines of products. Now imagine that you open that order and you go to the detail block and query that block and execute the query and the query only returs one or two lines for instance. The calculated items will change it value for the sum of the prices of these only 2 lines... but the order has 3 more products... and imagine that you click save... now the order totals are miscalculated...
My question... HOW Can I avoid this? It's crucial!!!
Best Regards
Joao Oliveira

Hi gerd :
May a pre-commit-trigger selects the values from the database including the updated rows in the form?
These computations are very very difficult. The values of the master table depends on the detail tables and the opposite is also true. By implementing triggers it will not work cause at the time the trigger fires in the master table the values from the detail table are not yet updated. This is a tricky issue...
If I could avoid querying clauses in the detail block and avoid for instance the Clear_Record key... it would solve part of my problems.
BR
Joao

Similar Messages

  • [ Forms10g2 ] Default item value in Enter-Query mode

    Hello!
    How could I specify default value for an item in Enter-Query mode? E.g. I press KEY-ENTQRY, and :L_YEAR item gots current year as a default search condition (though it may change). I've tried to implement it this way:
    <pre>
    Enter-Query;
    :l_year := extract(year from sysdate);
    </pre>
    This work in a rather awkward way. If I run this once (e.g. as a result of a hotkey press), it just enters Enter-Query mode, but if I run this twice (by pressing hotkey second time) it fills :year variable and does search with it as a search condition! Then, I've tried to go straight and wrote:
    <pre>
    Enter-Query;
    :l_year := extract(year from sysdate);
    Enter-Query;
    :l_year := extract(year from sysdate);
    </pre>
    Well, this didn't work. And SYNCRONIZE call before the second Enter-Query didn't help either. So, my questions are: 1) how can I achieve needed behaviour? 2) What's going on in my experiments? Why :L_YEAR gets assigned on second keypress (as in first experiment) but not on second subsequent call (as in second experiment)?
    Thanks in advance!

    I don't know why that won't work but I have something which might:
    when-new-record-instance trigger:
    if :system.mode = 'ENTER-QUERY' then
      :l_year := extract(year from sysdate);
    end if;It's always best to use both the block and item names...:block.l_year

  • Disableing an item in enter query mode

    Hello experts,
    i want that a perticular item will be disabled after you press enter button of query menu.(or query->enter).Can any body please tell me what is the actual trigger in which i write the disable statement.
    set_item_property('itemname', enabled, property_false);
    Regards
    Anutosh

    You can't set the enabled property if the cursor is in the item and I expect it's the same for the query_allowed property. if the cursor is in the item which you set to Query_Allowed=false and then you go to enter-query mode, perhaps forms doesn't know what item to move the cursor to, so just leaves it where it is.
    You can solve the problem by moving to a different item (with go_item) before setting the property.
    When do you need to set the item back to enabled? If you want it enabled at all times other than when a query is being entered then use the Property Pallet to set the Query Allowed property. If you want to disable the field under certain conditions then the when-new-record-instance trigger might be better for you. Eg
    if :system.mode = 'ENTER-QUERY' and <condition> then
      go_item(<another item>);
      set_item_property(<item>, enabled, property_false);
    else
      set_item_property(<item>, enabled, property_true);
      set_item_property(<item>, update_allowed, property_true);
      set_item_property(<item>, navigable, property_true);
      set_item_property(<item>, update_null, property_true);
    end if;It might be better to set the query_allowed property instead of the enabled property, but I can't check right now whether that's possible after the enter-query mode has begun.
    The update_allowed, update_null and navigable properties are all set to false as a consequence of the enabled property being set to false. If they should be true then you need to reset them after reenabling the item.

  • Non-Database items in enter-query mode

    I have a form with 2 base table blocks, typical master details situation. I wish to allow a field from the detail block to be queryable from the master block. I was considering adding a non-database item to the master block (visible only when in Enter-Query mode). In a pre-query trigger I would amend the DEFAULT-WHERE property of the master block when the appropriate where clause using the non-database item value. My prototype/test version works fine except the non-database item is not enabled while the master block is in enter-query mode.
    I think basically forms will enable only field s if they are database items and queryable set to yes. There are no more database items I can use to set the non-database item column name property.
    Any suggestions would be appreciated.
    Ralph
    Oracle Developer - Unisys Australia

    Hi Ralph,
    we have several Forms using non-database items as query-items which works fine.
    What we did is following:
    1) create non-database item xy in master-data-block
    2) set property database item to no
    3) set property query allowed to yes
    4) create a pre-query trigger on master-data-block where we change the where-clause (this is forms6i, in 9i we would use the one-time-where-clause)
    Peter

  • Including non database item in the query mode

    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??
    thnx alot

    Hi, it is probably best for you to post your question in the EBS forum
    General EBS Discussion

  • Need help on new calculated item column

    Hi Guys,
    Could you please help me with the formula on a new calculated item on the attached report?
    Details on the screen shot of the link
    http://img339.imageshack.us/img339/5606/70548266.jpg
    Thanks and Regards
    G.

    Nikkolas wrote:
    i found dv5-1251nr with 512 megs dedicated nvidia graphics ( NVIDIA GeForce 9200M GS)  Intel Core 2 Duo Processor T6400 4 gigs ram  320 hd for 849 now i tested this system with battery in
    6 cell on balanced mode internet surfing, looping a 3 min video clip, 3 other windows open including chess and the 3d game fate and battery that was 100% dropped to 75% after 30 mins, so if i figured it out right means battery lasts for about 2 hours
    this any good and whats deal with all the chips intel centrino, intel centrino 2 etc and i know amd  athlon is old and turion is better but is it that much better?
    Intel Core 2 Duo's are the most efficent, so if you are looking for good battery life, that is what you want.  Avoid AMD as they eat the battery life quite quickly.
    The battery life depends on what the computer is doing, so if you are stressing it with a lot of applications, yes the battery is going to die quicker than normal.
    My opinions are mine, and mine alone.

  • [Solved] Problem with LOV and 'enter query' mode

    Hi all,
    I'm kind of new to Forms and I'm having some problems that I'm not being able to resolve. I already search it on the net, but nothing relevant came up. If anyone could help me I appreciated it.
    In my form I have some fields, and in one of them I have a LOV, and almost everything works fine. I inserted data, changed it, deleted it and all it's ok.
    But when I change to 'enter query' mode, when I try to search for data on the LOV field it ignores what I write.
    That is, for it, it's the same if I make F11 -> write 'aaaa' -> ctrl + F11 or if I make F11 -> '%' -> ctrl + F11.
    It behaves the same way, shows me all the records.
    Probably I'm missing something basic, but I'm not getting it...
    Thanks,
    Ana

    when you create a lov by wizard the lov and record group have always the same name..
    the problem is that the item is NOT based in the tabe.
    what kind of query do you execute if you choose something from a love which is not based on the db?
    i mean, this item has no influence on the query of the table, so whatever you choose it's like a "select * from table"
    i hope i was clear

  • What is the differences between viewCriteria query modes?

    Hello all,
    recently we faced a performance issue in a production application. after tracing  we found  that the issue was caused by setting the query mode of the view criteria to in memory.
    bussiness case description:
    when creating a new record for table A, I want to populate one field depending on records in another table B, so I used model driven LOV.
    The problem was that new records were created for both tables in the same ADF train i.e. the data for both tables were not posted or committed yet.
    so by using a query based ViewObject + viewCriteria with query mode set to memory for viewCriteria I managed to populate the LOV with the correct data,
    in another page I will show database records for table A with LOV to show meaningful messages to users ,  but I can as well create new records for table A ,but the loading of this page is very slow.
    tracing:
    using alter session set sql_trace=true; I found that table B is fully scanned and all rows are fetched-180000+ record-.
    Problem description:
    from the trace file generated found that the query issued did not have a where clause.
    also found that the viewObject fetched the entire table into memory- 180000+ record,-  then searched them in memory.
    Solution:
    changing the query mode of the viewCriteria seems to solve the issue
    so in order to avoid such issues in the future ,I wanted to make sure I understand the differences between the query modes of view criteria and their impact on the performance and if there are any differences if the viewObject is based on an entity or a sql dml.
    this is what I know so far -please correct me if I am mistaken-:
    1)database: search the database appending the conditions of the viewCriteria to whatever the query is
    2)memory: search the rows that are already in the memory.
    3)both: search both database and memory.
    also, in case I updated one of the records in the memory but did not yet post or commit will the fetched rows have the updated values? and if these changes fails the condition from the viewCriteria , will the rows be shown?.

    The camera roll contains all the photos and videos taken on your device, as well as any saved on your device from the internet, emails, text messages, etc.  The photo library contains photos synced to your device from your computer.
    Only camera roll photos are synced using iCloud with photo stream.  And photo stream only syncs photos, not videos.

  • Export in Query mode settings

    Hi All,
    Can anyone tell me where can we get Export in Query mode(Used to export grids to Excel sheet) settings?
    One more problem with this is that the Excel that is exported on clicking on "Export on Query mode" button overwrites the current Excel working file that we are working upon. How can this be solved?

    It is the behavior, Query ready mode will only pulls the members which are in Essbase (no FR calculated fields)
    Regards
    Celvin
    http://www.orahyplabs.com

  • Change background color in enter-query mode

    Hi everyone,
    I am trying to Change background color in enter-query mode in forms10g. I am using this
    Set_Item_property('org.branch_code', BACKGROUND_COLOR, 'Green' );
    Thanks

    This is the code that allows to colorise items in enter_query mode, then de-colorize them after execute_query.
    Assume that you have created a VA_QUERY visual atribute in your module.
    -- Colorise in enter-query mode --
    PROCEDURE Start_query IS
      LC$Block      Varchar2(30) := Name_in('system.trigger_block') ;
      LC$item       varchar2(60);
      LC$itemdeb    varchar2(60);
      LN$len        pls_integer ;
    BEGIN
      lc$itemdeb := get_block_property(LC$BLOCK, FIRST_ITEM) ;
      lc$item := LC$BLOCK || '.' || lc$itemdeb ;
      while lc$itemdeb is not null Loop
        IF GET_ITEM_PROPERTY(LC$Item , ITEM_TYPE) NOT IN ('BUTTON','RADIO GROUP','DISPLAY ITEM') Then
          IF GET_ITEM_PROPERTY(LC$Item , QUERYABLE ) = 'TRUE' Then
            set_item_property(LC$item, CURRENT_RECORD_ATTRIBUTE, 'VA_QUERY');
          End if ;
        End if ;
        lc$itemdeb := get_item_property( lc$item, NEXT_NAVIGATION_ITEM );
        lc$item := LC$BLOCK || '.' || lc$itemdeb ;
      end loop ;
    END;
    -- Unclororize after execute_query --
    PROCEDURE End_query IS
      LC$Block     Varchar2(30) := Name_in('system.trigger_block') ;
      LC$item     varchar2(60);
      LC$itemdeb     varchar2(60);
      LN$len          pls_integer ;
      LN$Multi  pls_integer ;
    BEGIN
      lc$itemdeb := get_block_property(LC$BLOCK, FIRST_ITEM) ;
      lc$item := LC$BLOCK || '.' || lc$itemdeb ;
      LN$Multi := GET_BLOCK_PROPERTY(LC$Block , RECORDS_DISPLAYED ) ;
      while lc$itemdeb is not null Loop
        IF GET_ITEM_PROPERTY(LC$Item , ITEM_TYPE) NOT IN ('BUTTON','RADIO GROUP','DISPLAY ITEM') Then
          IF GET_ITEM_PROPERTY(LC$Item , QUERYABLE ) = 'TRUE' Then
             If LN$Multi > 1 Then
                set_item_property(LC$item, CURRENT_RECORD_ATTRIBUTE, 'VA_CURRENT_RECORD');
             Else
                set_item_property(LC$item, CURRENT_RECORD_ATTRIBUTE, '');
             End if ;
          End if ;
        End if ;
        lc$itemdeb := get_item_property( lc$item, NEXT_NAVIGATION_ITEM );
        lc$item := LC$BLOCK || '.' || lc$itemdeb ;
      end loop ;
    END;Francois

  • How to display LOV on web in ENTER-QUERY mode with form or block query only.

    Hello all
    How can I display lov automatic on the web in from enter-query
    mode in form or block query only mode.
    thankx

    If I understand correctly your explanation, your called form
    fails to activate the LOV in enter-query mode when it is deployed
    and test on the browser.
    So lets proceeed like this, to make it work in all environments,
    let us programetically activate the LOV.
    HOW?
    In the called form, write in the WHEN-NEW-ITEM-INSTANCE TRIGGER
    at block level (if have more than one LOV)
    IF :SYSTEM.MODE = 'ENTER-QUERY' THEN
    IF get_item_property(:system.cursor_item,lov_name) IN ('YOUR
    LOV1', 'LOV2' etc) THEN
    IF SHOW_LOV(get_item_property(:system.cursor_item,lov_name))
    THEN
    NULL;
    END IF;
    END IF;
    END IF;
    The above code maybe tweak to suite your need and condition.
    This way, we explicitly make the LOV appear in ENTER-QUERY mode
    whenever the user clicks on an item with an attached LOV.
    Hope this helps.
    Mohammed R.Qurashi

  • Query mode trigger....

    Hello folks,
    I have this problem, i need when-validate-item to fire in query mode, in the help they say this trigger can't be fired in query mode is there any way to produce the same effect or validation in query mode, what i need is when a user fill a text item and before to query the datablock to test thsi text item... and thank you...

    I would say pre_query is a better place to test your query condition, or set your query condition if nessary.
    or if you need the same check fire normal mode, you could the checking in a program unit and call it from pre_query and when_validate_item trigger.
    hedy

  • Developering ADF form in query mode (Oracle forms simulation)

    Hi,
    we have a requirement for developing the existing Oracle form using Oracle ADF. The existing Oracle form displays the form in query mode by default. We can enter the search criteria in any of the text fields and then execute query to get the results. If the user does not enter any search criteria, then the form loads specific record based on default criteria into the form. Could you please help developing similar form using ADF.
    At present I created the view object with one bind variable and dragged the view as ADF form to the jspx page. Then I am launching the form in query mode (executing the find method on the view object using operation binding at the time of loading the page). After entering the query criteria in the form, If I click on a button I am executing a method in the managed bean. In the managed bean I am executing the "Execute" operation on the view and it is working fine.
    But my problem is if the user does not enter the search criteria I have to pass default parameters to the view object and return the default record in the form.
    Can you please help in resolving the issue.
    Thanks and Regards,
    S R Prasad

    Hi Frank,
    Thank you for providing information. I created the query panel with the table by dragging all the named criteria. But this is not the look we are expecting for this form. As we have to deveop ADF form with the same behavior as oracle forms, the user must be in a position to edit the data in the same field as that of query field.
    As an example, we have to design a form for Dept table. We have to display all the columns of the dept view in the form at the time of launching the form in query mode. Once the user enters any search criteria in the form, we have to perform search and display the record(s) matching the query criteria in the same columns displayed in the form. User should not see any changes in the form layout.
    If the user does not enter any data in the form, then we have to display the record(s) in the form with the specific department id(This department id can be calculated based on the data in another table).
    Can you please help us in resolving the issue.
    Thanks and Regards,
    S R Prasad

  • Query mode & default values

    Hi,
    When a block is put into QUERY MODE all the
    fields in it are blanked.
    I am looking for a way to put in default
    values in some of my fields when in
    query mode.
    Is this possible.
    Any help is appreciated.
    Regards,
    Klas Malmstrom
    [email protected]

    You could try the When-New-Record-Instance trigger for the block and assign values to items when the :SYSTEM.MODE = 'ENTER-QUERY'. Users may be able to change these default values.
    To have hidden default values use the default where property of the block and either set on the property sheet or dynamically in the PRE-QUERY trigger; or assign values to database items in the PRE-QUERY trigger.

  • Prevent interpretation of special characters in enter-query mode

    My problem goes as follows:
    - forms version: Forms [32 Bit] Version 6.0.8.10.3 (Production)
    - non-database item block.X, char
    - block.X is filled in post-query trigger. The post-query logic cannot be integrated in a view because it uses procedures, and usage of a pipelined function + view is currently not allowed due to "internal restrictions". Put simply: all logic to fill the field must remain in the post-query trigger
    - user wants the field to be queryable. This is achieved by storing the entered criterium in a variable in the pre-query trigger, and using it in the post-query trigger to exclude records. E.g.
    pre-query ==> help_block.query_X := block.X;
    post-query ==> if help_block.query_X is not null and block.X is null or not block.X like help_block.query then raise form_trigger_failure; end if;
    - this works fine for "regular" search strings. However:
    - whenever the search string starts with <, <=, >, >=, !, forms seems to interpret the leading characters before doing anything else. During pre-query, block.X is null, and as soon as I use it in pl/sql, I get FRM-40831: Truncation Occured: value too long for field. E.g.
    user puts the following in block.X ==> '<X', so he wants to search for records with value '<X' (text; not 'smaller than ...')
    pre-query => msg.show(block.X) ==> appears to be empty/null, but right after the message, I get FRM-40831 Truncation Occured: value too long for field ...
    This only happens if < is the first non-space character in the search string.
    Does anyone know of a way to prevent oracle from interpreting the <, <=, ... characters entered in enter-query mode?

    I'm sorry for not making myself clear; I'll give it another go:
    The problem is that, if I enter '<abc' in a form field in enter-query mode (so during creation of the "example record"), forms immediately interprets the < as 'smaller than' and does some obscure things with it (my guess: converting to a where clause, but since I'm using a non db field, this actually does nothing), and finishes by erasing the field contents (in the example record). In the pre-query trigger, I can no longer get the '<abc' and store it. I want one of the following:
    - prevent forms from interpreting the '<' in front (same thing happens for !=, <=, >=, =, ...)
    or
    - capture the entered string ('<abc') before forms reacts to the '<' in front
    Edited by: [email protected] on Feb 17, 2009 12:30 PM

Maybe you are looking for