1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

How to query a block and get only the records that fulfill a certain condition

Discussion in 'Oracle Forms and Reports' started by Urosh, Jan 28, 2013.

  1. Urosh

    Urosh Active Member

    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    80
    Hi guys,
    I'm using Oracle 10g and I want to know how to query a block and get only the records that fulfill a certain condition.
    There are 3 blocks - let's call them blocks A, B and C.
    Block C is taking one key from block A and also another key from block B (these are its only keys, A and B are "parents" of C)
    In blocks A and B only one record is shown at a time (its not displayed in a tabular form)

    So I want to make it like this:

    I enter the form and query block A, I find the record that I need and leave it there.
    Now I want to query block B and in that query (by executing query and also by pressing "next record") I want to see only the records that passed their keys to block C AND also I want these records to correspond only to the CURRENT displayed record in block A (to its key that is also passed to C)
    Help :)
     
  2. sivaramakrishna.d

    sivaramakrishna.d Active Member

    Messages:
    61
    Likes Received:
    6
    Trophy Points:
    160
    HI Urosh,

    Please use default where condition.
    it will work out.
    I think already the same has been explained to you ealrier in previous post.
    if you want in detail reply me i ll send you details.

    Siva Ram
     
  3. Urosh

    Urosh Active Member

    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    80
    Details please.
    Urosh
     
  4. sivaramakrishna.d

    sivaramakrishna.d Active Member

    Messages:
    61
    Likes Received:
    6
    Trophy Points:
    160
    Dear Urosh,

    Step 1 : Create a non data base block with the list of fields you want to search with for example : Name
    Step 2 : Create a button in the non data base block with "find"
    Step 3 : In When Button pressed trigger of button write go_block('DB_block_name'); set_block_property('DB_Block_name',Default_where,' db_block_name.name like ''%name%''');

    it will populate the data in DB block based on default_where condition.

    Siva Ram
     
  5. Urosh

    Urosh Active Member

    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    80
    Sorry, tried some things but I still don't get it.I'm a beginner.
    How exactly does it work?
     
  6. ac.arijit

    ac.arijit Forum Advisor

    Messages:
    217
    Likes Received:
    22
    Trophy Points:
    280
    Location:
    Kolkata, India
    Hey Urosh!!

    Got your requirement somewhat .. but still few things need to be cleared. I cudn't get ur following statements...
    Plz clear these things(according to ur imagination n desire):
    1. How r u gonna "press" next record? Or did u meant internally?
    2. Are blocks A and B single record blocks? If yes, then is the data static or variable or if No, then how r u querying those two blocks? (Share the code)
    3. You said, A and B are "parents" of C. Whereas, i believe usually we've only single parent for a child or else it'll violate the foreign key. It can be multiple tier hierarchy.
    Like A->B->C ... (dunno but haven't implemented anywhere anything with two same level parent) ..

    *Suggestion*: As far as i understood it, u gotta implement master-detail blocks in your form. Do some RnD on this concept, it'll resolve ur issue. Don't hesitate to ping, if stuck(but atleast put some effort on ur own.. gud 4 u ;) )
     
  7. Urosh

    Urosh Active Member

    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    80
    Hey Ari!

    I'm using Oracle Form Builder and on my layout I have these blocks based on db tables.

    1.I use the RUN FORM button and in IE I get my form in run-time(i guess that's how its called). When I want to query I just chose one of the fields in specific block and press button EXECUTE QUERY and i get, in those fields, data from that block(table) and when i press NEXT RECORD button I can see data in those fields record by record (row by row from my db table). Those buttons are part of the Form Builder itself.
    2.Blocks A and B are not single record blocks. Data is variable (I guess)
    3.Block C has only 3 items(fields) none of them is null-able. One item is primary key of block A, other item is primary key of block B(those are foreign keys in C), third item belongs only to block C but it is not the key of any sort. When I look in my oracle database express it says that those foreign keys together are primary keys to table C

    I implemented master/detail relationships
    Thanks for helping :)
     
  8. Urosh

    Urosh Active Member

    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    80
    I mean I implemented them (m/d) when I first made that form
     
  9. ac.arijit

    ac.arijit Forum Advisor

    Messages:
    217
    Likes Received:
    22
    Trophy Points:
    280
    Location:
    Kolkata, India
    Ok! So u're still sticking with multiple-parent concept.
    Fine, then what did u observe after implementing master-detail relationships?
    Is it not working or u're facing some other problem?

    *And also plz share the doc supporting the scenario of yours with all the program flow and user-input everything alongwith screenshots.
    It'll be helpful to understand it better.
     
  10. Urosh

    Urosh Active Member

    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    80
    I've got it.It was a stupid question from me, tried to do the impossible
    Thanks for helping.
     
  11. ac.arijit

    ac.arijit Forum Advisor

    Messages:
    217
    Likes Received:
    22
    Trophy Points:
    280
    Location:
    Kolkata, India
    Hi !!

    Don't worry!! No question is a stupid one, its only when we know the answer we underestimate it. :D
    And also, don't 4get "Impossible reads I'm Possible".