Query from a NTB item to retreive data block

I have two NTB text items. first i have enter values in, then i would like to take these values to query my block (table view)
the context of my form is:
Office{ salesmen---->{Agencies---->{customers and so one.
in my form I would like to allow to the user to enter the office code (from listArea) and choose the salesman code(from a LOV). (this part i got it).
From both values office code and salesman code I want to retreive all agencies, customers products and display them on my block.
the second is:
If i can do that, i would like to put a checkbox(table view) in front each row, so when i'll check a row I could take some values and query another table to display a detail form on new canva for this row.
I know I ask a lot, but you know i'm new in the oracle world
thanks

For your first requirement: Use a Pre-Query trigger to test if your Non-Base Table (NBT) items have values. If yes - use the SET_BLOCK_PROPERTY() built-in to add the values of these items to the default where clause of the base table block. For example:
/** Pre-Query trigger */
DECLARE
   vDefWhere      VARCHAR2(500) := GET_BLOCK_PROPERTY('PARENT_BLOCK',DEFAULT_WHERE);
BEGIN
   IF ( :Control_block.C$Office_code name IS NOT NULL ) THEN
      /* Assumes there is an existing WHERE Clause */
      vDefWhere := vDefWhere|| ' AND OFFICE_CODE = :control_block.c$office_code';
   END IF;
   IF ( :Control_block.C$Sales_code IS NOT NULL ) THEN
      vDefWhere := vDefWhere||' AND SALES_CODE = :control_block.c$sales_code';
   END IF;
END;As to the your second request, why not design your form so you have a section where you select your criteria, a section that displays the queries Parent record and then a section that displays the related Child data. Then create a relationship (see the relationship code of the BLOCK in the Forms Navigator) between the Parent block and the Child block. The relationship will handle synchronizing the Child block with the Parent block as the user navigates through the different Parent records. Your form would like something like this:
|---------------------------------------------------|
|  Office Code[       ]  Sales Code[       ]        |
|                                                   |
|--Parent Data--------------------------------------|
| Office Code  Sales Code  Item1   Item2   Item3    |
| [          ] [         ] [     ] [     ] [     ] ^|
| [          ] [         ] [     ] [     ] [     ] v|
|                                                   |
|----Child Data-------------------------------------|
|                                                   |
| Child1          Child2      Child3      Child4    |
| [             ] [         ] [         ] [     ] ^ |
| [             ] [         ] [         ] [     ]   |
| [             ] [         ] [         ] [     ]   |
| [             ] [         ] [         ] [     ]   |
| [             ] [         ] [         ] [     ] v |
|---------------------------------------------------|When the user selects an Office and Sales Code - the Parent record will be queried. The relationship will automatically query the child records and display the results in the Child Data section of the form. If the user selects the second Parent record the relationship automatically queries the child records and displays them in the Child Data section again. This makes for an easier form to develop and maintain.
Hope this helps.
Craig...
-- If my response or the response of another is helpful or answers your question, please mark the response accordingly. Thanks!

Similar Messages

  • Camel Query : Calender list : Get Items agains given date that must be greater than and eqaul to start date and greater less than or equal to end date ?

    Camel Query : Calender list : Get Items agains given date that must be greater than and eqaul to start date and greater less than or equal to end date ?
    A Snap of Employee holiday list
    Case : Anne juul Sondergaar is on leave from 05-06-2014 to 07-06-2014
    I need a query to check wheither Anne juul is on leave at 06-06-2014 ????
    I am using this query that return nothing
    SPQueryquery =
    newSPQuery();
                                query.Query =
    @"<Where>
    <And>
    <And>
    <Leq>
    <FieldRef Name='Til' />
    <Value Type='DateTime'>"
    + WorkingStartDate.ToString("yyyy-MM-dd")
    + @"</Value>
    </Leq>
    <Geq>
    <FieldRef Name='Fra' />
    <Value Type='DateTime'>"
    + WorkingStartDate.ToString("yyyy-MM-dd")
    + @"</Value>
    </Geq>
    </And>
    <Eq>
    <FieldRef Name='Medarbejdere' />
    <Value Type='Lookup'>"
    + EmployeeName.Trim() +
    @"</Value>
    </Eq>
    </And>
    </Where>"
                                query.ViewFields =
    " <FieldRef Name='ID' />";
    Ahsan Ranjha

    Hello,
    Download CAML query builder from below location and use it to build your query:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/f7b36ebc-6142-404a-8b04-9c87de272871/where-can-i-download-the-u2u-caml-query-builder-for-sharepoint-2010may-i-know-the-exact-link?forum=sharepointgeneralprevious
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Can we create a list item as a data block item?

    Hi,
    I have changed a text item to list item on the data block.
    This list item used to get populated when it was control block item, but after i changed it to data block item, it's not getting populated.
    My question is, can we create a list item(poplist) as a data block item?
    Any idea?
    Thanks in advance
    R.G

    Hi
    When you use ctl blocks data dose not fetch from Database. But in data blocks it get fetches when you execute query. So you have to make sure table column values are matching with the List Box values you have given.
    So please check table values.
    Nilaksha.

  • I can not put the data of a field(LONG RAW) consulted into a item of a data block

    I want to query a field that is LONG RAW(it's a image) and put the data into a item of a data block (in Forms Builder), when i write ":BLOCK.FOTO:=vfoto" i recieve this errors: "bad bind variable ....". How can i put the data of field of my DB and put the data in a item of a data block(in Forms Builder)?.
    I can store a image in a table of my DB, but i want to query a image stored in my DB and put it into anothers table, all this on FORMS BUILDER.

    You have to base the image item on a base table and use EXECUTE_QUERY on that block. You can't do a direct select in PL/SQL into the item

  • Loop through all items in all data blocks?

    Is there a way to loop through every item in every data block and set the property of a format mask?

    I do not know what error it is, only that an on-error trigger fires.
    I found out one thing I was definitely doing wrong, using nextblock, nextitem properties at the wrong level.
    DECLARE
         v_firstblock VARCHAR2(50);
         v_currentblock VARCHAR2(50);
         v_firstitem VARCHAR2(50);
         v_currentitem VARCHAR2(50);
         v_counter NUMBER :=0;
         v_counter2 NUMBER :=0;
    begin
       v_firstblock := get_form_property(:System.Current_Form,first_block);
       v_currentblock:= get_block_property(v_firstblock,nextblock);
       MESSAGE(v_firstblock||v_currentblock);
         LOOP
              v_counter := v_counter +1;
              IF (v_counter >10) THEN
                   exit;
              END IF;
              IF (v_currentblock = v_firstblock) THEN
                             exit;
           ELSE
                   v_firstitem :=  get_block_property(v_firstblock,first_item);
                        IF (lower(GET_ITEM_PROPERTY(v_firstitem,format_mask))=lower('mm-dd-yyyy')) THEN
                                       SET_ITEM_PROPERTY(v_firstitem,format_mask,'DD-MON-YYYY');
                        END IF;
                   v_currentitem :=  get_block_property(v_firstblock,first_item);
                   v_currentblock:= get_block_property(v_currentblock,nextblock);
                   GO_BLOCK(v_currentblock);
                        LOOP
                             v_counter2 := v_counter2 +1;
                             IF (v_counter2>15) THEN
                                  exit;
                             END IF;
                             v_currentitem:= get_item_property(v_currentitem,nextitem);
                             MESSAGE(v_counter||v_firstblock||v_currentblock||v_firstitem||v_currentitem||v_counter2);
                             IF (v_currentitem <> v_firstitem) THEN
                                  IF (lower(GET_ITEM_PROPERTY(v_currentitem,format_mask))=lower('mm-dd-yyyy')) THEN
                                       SET_ITEM_PROPERTY(v_currentitem,format_mask,'DD-MON-YYYY');
                                  END IF;
                             ELSE
                                  exit;
                             END IF;
                        END LOOP;
               END IF;
      END LOOP;
         end;Here is updated new code. I am currently trying to debug it, it has crashed my form on the server when tied to a button press.
    EDIT: So far I have found that it infinitely loops through the first 3 items and a null item in the first block. Still looking into why...
    EDIT: Some code changes to temporarily stop infinite loop and make v_currentblock actually change. Still loops through same 3 items in the first data block even though v_currentblock changes.
    Edited by: 878576 on Oct 21, 2011 12:46 PM

  • Disadvantage of 'QUERY ALL RECORDS' set to YES in DATA BLOCK

    Dear all,
    Can any one tell me disadvantage of 'QUERY ALL RECORDS' set to YES in DATA BLOCK. I have made a datablock 'QUERY ALL RECORDS' set to YES becoz of requirement 'restrict duplicate data entry'.For your information
    my datablock is multi record.
    Than You

    What if you have 1,000,000 records in your table and you query all records. Ouch!
    restrict duplicate data entryThat is standard database functionality: primary or unique key on the table.

  • Call query from database as item source

    Hello!
    I have a query that is too long to paste it as the record source for an Apex item. It exceeds the limit of 32K.
    Is there a way to save that query at database level and call it from the apex item?
    If there is, please be so kind and give a small example!
    Thank you,
    Sebastian

    Hello,
    Why not put that code into a PL/SQL packaged function and use the "PL/SQL Function Body" or "PL/SQL Function or Expression" types instead?
    John.
    Blog: http://jes.blogs.shellprompt.net
    Work: http://www.apex-evangelists.com
    Author of Pro Application Express: http://tinyurl.com/3gu7cd
    REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone!

  • Manipulating data from a ref cursor in the data block of a form

    I am using Oracle Forms 10g. I have a ref cursor which returns columns A, B, C, D, E where B, C, D, E are values. The "Query Data Source Name" attribute in the datablock contains "CCTR_Extract_pkg.cctr_refcur". The "Column Name" attribute of item A contains "A", item B contains "B", etc. All of these columns are displayed on the form and it all works perfectly.
    I have a new request, the users would like a 6th column displayed - column F - where it equals D - B.
    Is there any way of doing this in the form only or do I need to change the ref cursor to accomodate the new column and then the form?
    If it can be achieved in the Form (only) - then how do I reference the 2 columns?
    Thanks in anticipation
    Michael
    Edited by: user8897365 on 24-Aug-2011 10:32

    Is there any way of doing this in the form only or do I need to change the ref cursor to accomodate the new column and then the form? The REF_CURSOR is the data source of your block so you will have to modify the CCTR_Extract_pkg package and cctr_refcur REF_CURSOR.
    If it can be achieved in the Form (only) - then how do I reference the 2 columns?After you have modified your database package, I recommend you run the Data Block Wizard on your block and let Forms detect the 2 new columns. You can do this manually, but it is safer to let Forms do it for you. If you want to do it manually, open the Query Data Source Columns property and add your new columns.
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • The values for list items of other data blocks are not getting displayed when executed.

    Hi,
        I have a new problem again.
        I am doing a new form in which there are around 8 blocks. All the blocks have their tables in the oracle database.
        Each block has 18 columns with the same column & column names. But the values in those columns are different & the values do not match.
        The problem lies while i execute the form, it populates only the first block data. Other blocks do not display or populate the values.
        I cannot create a master relationship because all the column values are different.
        How do i display or populate the values of all the tables?
       Please help me. Thank You.

    hi
    if your form has truly disassociated tables, then you could simply use a key-exeqry trigger at forms level to travel to each block in turn and perform an execute-query built-in, eventually returning to the starting block.
    ie
    go_block('..');
    execute_query;
    go_block('..');
    execute_query;
    etc
    go_item(......);
    In this case you would use the block where clause to constrain each table to the appropriate set.
    If however, the database has no relationships between the tables but the data content has some corelation, then you could craft a forms relation manually.
    cheers
    Rod

  • Transported query from DEV to QAS no applicable data

    Hi all, any idea why queries transported from a DEV system to a QAS system will not execute?  I am getting no applicable data even though the data is in the cube. I am not having much luck with new queries either.  Please advise.  Anna Marie

    Hi Anna,
    Looks really strange...
    Are you sure data is reportable on your InfoCubes on QAS? (do you see the table icon on the right of all request ids?).
    Are you sure query is not filtering too much data? Please, check this by displaying filtered values with 'Display text elements -> All' on BEx Toolbar.
    Regards,
    David.

  • Updatable View as data block source - can't get to work

    I have created a simple form with one data block based on an updatable view, but it doesn't work properly after the form executes a query.
    I can use DML on this view using SQL*Plus and it works as it should.
    DML works in the form too, but only until I execute a query, after that I get the "FRM-40602: cannot insert into or update a view" error each time I try an insert, update, or delete.
    This is repeated for each runtime of the form. I have set the "query only" property to yes for the non-DMLable item from the view so that isn't part of the problem. This is an example out of "Developer Advance Forms and Reports (page 112) - Oracle Press" so it should work. There is nothing else (code, triggers, etc...) in this module besides the one data block.
    Any ideas would be appreciated.
    Thanks. Bill Brosnan.

    I have had the same issue and had to go through Oracle Support to get it working.
    First of all make sure that you have a recent patch installed (patch 9 as being the latest one available).
    Second, set in the data block the property key mode to updatable and the property primary key to yes for one item of the data block. (this is bug 1561423)
    Make sure that you only modify those columns that are updateable.
    Quite a large number of bugs have been reported on the concept of updatable views and the installation of a recent patch will most definitely get you working again.
    This functionality does work !
    Goodluck,

  • How to execute the second data block in master child form using lov

    Hi All,
    i am developed a new custom master child form using stacked canvas.Here i am taking two frames with diffrent data blocks.my point is i am enter the value from the lov in first frame automatically execute the second frame data block without button.
    example:
    fisrtdatablock:dept no(dept table).
    second datablock:employee information(emp table).
    select the dept value from lov automatically execute the second data block emp information.
    can help me any one.
    Regards,
    sekhar.
    Edited by: 994418 on 17 Mar, 2013 10:40 PM

    994418 wrote:
    Hi All,
    i am developed a new custom master child form using stacked canvas.Here i am taking two frames with diffrent data blocks.my point is i am enter the value from the lov in first frame automatically execute the second frame data block without button.
    example:
    fisrtdatablock:dept no(dept table).
    second datablock:employee information(emp table).
    select the dept value from lov automatically execute the second data block emp information.
    can help me any one.
    Hi, sekhar.
    Welcome to the Oracle Forums. Please take a few minutes to review the following:
    <ul>
    <li>Oracle Forums FAQ
    <li>Before posting on this forum please read
    <li>10 Commandments for the OTN Forums Member
    <li>How to ask questions the smart way
    </ul>
    Following these simple guidelines will ensure you have a positive experience in any forum; not just this one!
    >
    Your forms mode isn't clear. Is it in enter-query mode or insert mode.
    what can you do ?
    use a timer in post-change or when-validate-item trigger at deptno item at first data block. because go_block isn't supported by p-c or w-v-t trigger.
    and at when timer expire, write your code to go second block and insert/query the associate date from emp table.
    Hope you understand.
    Hamid
    If someone's response is helpful or correct, please mark it accordingly.*

  • Why my scroll bar of a data block doesn't work?

    Hi,
    I have a data block that displays a maximum of 9 records at one time. When the query returns more than 9 records i want to use a vertical scroll bar to navigate to the last records.
    In some forms it works fine but in others not , i still didn't find why ??
    Cheers,
    Nuno

    Nuno,
    Rather than trying to find a needle in a hay stack, I would recommend taking a step backward.  This will help to rule out whether the issue is something you caused or if there is an issue with the environment or product.
    Create a new module in the Builder.  Do not add any of your own code.
    In the Builder, connect to a database (File > Connect).
    From the Builder menu, select Tools > Data Block Wizard
    In the Wizard first screen (after Welcome), select Table or View then click Next
    On the next screen, click on Browse to display the tables available to you.  Choose one.
    All the columns in that table should appear on the left.  Click on the double arrow (>>) to select all of them.  Then click on Next
    Click on Next again
    Choose the option to create the data block then open the Layout Wizard.  Then click Finish
    In the Layout Wizard, click on Next (after the Welcome scree) to choose the default Canvas.  Then click on Next
    Click on the double arrow (>>) to choose all columns. Then click Next
    Click Next again.
    Choose Tabular as the layout style.  Click on Next
    Change Records Displayed to 4 and check the box labeled "Display scroll bar".
    Click on Finish
    Again, do not make any changes to anything in this form.  Run it.  Does it reproduce the same problem you experience in your previous form?  If this form works correctly, likely the issue is in the design of your other form.  If this test form fails in the same manner then you are either exposing a defect or there is an odd configuration issue.

  • Hierarchical tree and interacting with data block

    I have a hierarchical tree that is used to pick records that are shown in another data block. I have a list item in the data block that changes the arrangement of nodes in the hierarchy. My problem is that after the update, I select the node, but the wrong data shows up in the other data block (eg. node x is selected, x becomes a child of y, the data for y still appears in the data block even though node x is selected in the tree). There seems to be something wrong with my triggers, but I can't figure out what.
    Here are the triggers that I am using.
    In the tree block, tree item:
    -WHEN-TREE-NODE-SELECTED
    set_block_property(v_data_block, default_where, 'global_id = ' &#0124; &#0124; v_org);
    go_block(v_data_block);
    execute_query;
    In the data block, list item
    -WHEN-LIST-CHANGED:
    -- find the tree node and select it
    node := Ftree.Find_Tree_Node(...)
    Ftree.set_tree_selection(v_tree,node,Ftree.SELECT_ON);
    -- update the data block to show data from the selected node
    set_block_property('GREENPAGES_DIR', default_where, 'global_id = ' &#0124; &#0124; :greenpages_dir.global_id);
    go_block('GREENPAGES_DIR');
    execute_query;
    Thanks for your help.

    hi
    i didn't try doing it.. i assume the the reasons can be:
    1.check the value of the variable 'v_org' because 'w-t-n-s' trigger fires twice..
    2. 'w-t-n-s' trigger is not firing eventhough u select it through ur code in the list item trigger.. if not firing, use execute_trigger('w-t-n-s') and remove the last set of code (update section) from the list item trigger..(assuming 'GREENPAGES_DIR' = v_data_block)
    hope this helps u
    ajith

  • Inserting multiple records in a data block

    Hi, how do i insert multiple rows from a record group into a data block. Thanks

    You do it manually. Copy the values and move to the next record in the record group and in the block.
    You might like the concept of basing a block on a stored procedure better. Check out the stored procedure based block sample that comes with the Oracle Forms demos.

Maybe you are looking for

  • How do I use an external Monitor to access files on my iMac with a broken screen?

    I have an 20 inch desktop iMac with a broken screen. It is the files on the computer that I wish to recover, after that, I can be on my merry way. Unfortunately, VileVault was on (Not my choice), and for some reason, when I target the disc image of t

  • How to Delete the Photo's in iPad1 , how to fix the simcard for iPad with 3G....

    hello..               How i can delete the photos which are uploaded in ipad . How to fix the sim card in the 3G iPad, where i can get the tool which to open the simcard slot.

  • Motorola W385 does not create /dev/cu.usbmodem device

    Hello, I have a relatively difficult issue... I am trying to use Moto4lin, complied myself from svn, the binary image on the site also has the same problem. When I plug in my phone there is no /dev/cu.usbmodem.* device created. As a matter of fact, t

  • Hinted streaming, fast start and the results.

    Hi, I put some clips onto a website recently, some were 5 min movies. I was pleased with the results, as the movies started almost immediately on several computers I tried. Unfortunately, the client had to wait over 4 min to see the video. My video w

  • Load Images Bundled in a SWC At Runtime?

    If I have a SWC that has some images bundled into it that was created using the compc compiler like: compc -o=images.swc -include-file img1.png img1.png Is there a way to load it into Flash at runtime and use the Images? The reason I'm doing this is