Query with criteria in unbound item

Hi,
I have a block (master) related to another block (detail). I'd like to narrow the returned results by adding a criteria in an unbound item in the master block.
The value in the unbound item seemed to be ignored when I execute the query.
How can I add a criteria for my query ?
Thank you...

If it's a simple value then add in a pre-query trigger onto the detail block with something like :
begin
if :control.my_unbound_item is not null then
:detail.the_item := :control.unbound_item;
end if;
end;
If you need something more sophisticated then post an example of what you'd like to do.
Regards,
Steve

Similar Messages

  • Query with criteria?

    Here's my problem...
    I have a table that I am using for a forum. I have the following fields in table...
    username
    datepost
    post
    postby
    subject
    Whenever somebody posts a new topic - a new record with a new subject is created. Whenever somebody responds to a post - a new record with an already existing subject is created - anotherwards I am grouping the records by subject so when a user views a topic the original post will display and all responses will display by setting the query to "select * from .... where subject like ...."
    My problem is on the forum home page I have a table and I want to set the query to display all the subjects, but only once...anotherwards for each subject I just want to display the oldest record because that record will be the original post and yes datepost is type DATE/TIME in MySQL. I know that I could add a field to this table and do something like everytime a new topic is posted set the new field to 1 and then set all replies to set the new field to 2 and then I could just use this new field in the query to solve my problem, but I DON'T WANT TO ADD A FIELD TO THE TABLE. So does anybody know how I can solve this problem without changing the table?
    Thanks in advance.

    I wonder if my forum etiquette is wrong or something because alot of my posts go unanswered, but either way I solved my problem. I did end up making a new table fields follow...
    screenname varchar
    date date/time (MySQL Date/Time)
    topic varchar
    originator varchar (probably should be boolean to be most efficient and follow best practices, but I was lazy!)
    post text
    notes text (Really just an extra field for admin use)
    forumid varchar
    Here's how it works...
    originator field is updated with char 1 for an originating post...anotherwards when a new topic is created that record gets a 1 in this field...The reason I do this is so when somebody wants to view a post I have to identify one of the records as the originating post and I also need a way to query for only unique topics that are originating post so all replies get char 0 in this field. Now when a client goes to forum home page they will see table with all original posts and the table is not filled with any replies. The table has a hyperlink component for topic that returns a second page with a different query that DOES display FIRST the originating post and then all replies in ASC order by Date. Another note is that I have 2 Forums so I used forumid to identify posts from the two different forums. I have never built a forum before and I have no doubt that I will find problems with this setup, but so far it's all working well. Now if anybody can tell me how to replaceAll /n with <br> to display carriage returns in table...I would be grateful!

  • Select some attributes with criteria api

    Hi,
    How can I specify more than one attribute here:
    query.select((Selection<? extends E>) root.get("name"));
    in other words, how can i get this query with criteria api "select name, second_name from Person" ?
    Thank you!

    Hi,
    How can I specify more than one attribute here:
    query.select((Selection<? extends E>) root.get("name"));
    in other words, how can i get this query with criteria api "select name, second_name from Person" ?
    Thank you!

  • LOV regions - possible to use several items as query-able criteria

    Hi,
    I have a question about LOV regions –
    Is it possible to have several items that are query-able criteria and result for a LOV region?
    Addition to the LOV–input-item itself, I’d like to have another item that will be used as one of the criteria’s to the LOV-query.
    I’ve defined the “Criteria Item” value for an additional item, which his “LOV Region Item” is query-able, but the value doesn’t appear in the search field,
    When entering the LOV-region.
    Do I have to add the additional criteria to the LOV by initializing the VO?
    Thanks in advance,
    Rona

    Seems lot of confusion with LOV. Well first thing to do is to go through the LOV section of Dev guide for more understanding.
    As for your questions, yes, you can have multiple items that are query-able criteria and result. You can use another item as the criteria to lov query, but it has to be a form element.
    If your criteria is set properly, you don't need to initialize VO manually.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • SQL Report query with condition (multiple parameters) in apex item?

    Hello all,
    I have a little problem and can't find a solution.
    I need to create reports based on a SQL query or I.R. Nothing hard there.
    Then I need to add the WHERE clause dynamically with javascript from an Apex item.
    Again not very hard. I defined an Apex item, set my query like this "SELECT * FROM MYTAB WHERE COL1 = :P1_SEARCH" and then I call the page setting the P1_SEARCH value. For instance COL1 is rowid. It works fine.
    But here is my problem. Let's consider that P1_SEARCH will contain several rowids and that I don't know the number of those values,
    (no I won't create a lot of items and build a query with so many OR!), I would like sotheming like "SELECT * FROM MYTAB WHERE ROWID IN (:P1_SEARCH) with something like : ROWID1,ROWID2 in P1_SEARCH.
    I also tried : 'ROWID1,ROWID2' and 'ROWID1','ROWID2'
    but I can't get anything else than filter error. It works with IN with one value but as soon as there are two values or more, it seems than Apex can't read the string.
    How could I do that, please?
    Thanks for your help.
    Max

    mnoscars wrote:
    But here is my problem. Let's consider that P1_SEARCH will contain several rowids and that I don't know the number of those values,
    (no I won't create a lot of items and build a query with so many OR!), I would like sotheming like "SELECT * FROM MYTAB WHERE ROWID IN (:P1_SEARCH) with something like : ROWID1,ROWID2 in P1_SEARCH.
    I also tried : 'ROWID1,ROWID2' and 'ROWID1','ROWID2'
    but I can't get anything else than filter error. It works with IN with one value but as soon as there are two values or more, it seems than Apex can't read the string.For a standard report, see +{message:id=9609120}+
    For an IR&mdash;and improved security avoiding the risk of SQL Injection&mdash;use a <a href="http://download.oracle.com/docs/cd/E17556_01/doc/apirefs.40/e15519/apex_collection.htm#CACFAICJ">collection</a> containing the values in a column instead of a CSV list:
    {code}
    SELECT * FROM MYTAB WHERE ROWID IN (SELECT c001 FROM apex_collections WHERE collection_name = 'P1_SEARCH')
    {code}
    (Please close duplicate threads spawned by your original question.)

  • Entering query criteria in an item(s)

    Hi. In have what I hope is an easy question...
    In the same way a user can enter the % character in an item on the canvas to query records where the column is Not Null, can the user enter some special character in the item that will query only records where the value is null?

    Hi There:
    Try this, it works for me.
    Add the block trigger called PRE-QUERY with the following code:
    DECLARE
         VV_DEFAULT_WHERE VARCHAR2(500);
    BEGIN
         IF :AEMS_PRUEBA.PHONE = '!'
              THEN
              :AEMS_TEST.PHONE := NULL;
              VV_DEFAULT_WHERE := 'AEMS.SEQ IN (SELECT P.SEQ FROM AEMS_TEST P WHERE NVL(P.PHONE, ''!'') = ''!'')';
              SET_BLOCK_PROPERTY('AEMS_TEST', DEFAULT_WHERE, VV_DEFAULT_WHERE);
         END IF;
    END;
    In the above code, yo can see I am modifuying the defaul_where of the based-table block. The block is called 'AEMS_TEST'.
    To do this, I create a local variable called VV_DEFAULT_WHERE. I use an If statement to ask for the special character you want to search for, in my test I ask for the '!'. If the the filed :AEMS_TEST.PHONE = '!' then I do the following:
    I nullify the field :AEMS_TEST.PHONE. Then add the where condition the block will use to retrieve the information form the database, as you request retrieving all the records in the table which are equal to null but using a special character instead of living null the field on the block, so I wrote the following code:
    VV_DEFAULT_WHERE := 'AEMS.SEQ IN (SELECT P.SEQ FROM AEMS_TEST P WHERE NVL(P.PHONE, ''!'') = ''!'')';
    Where AEMS.SEQ is the field on the block [AEMS is the alias of the block]
    after that, just need to setup the new where clause of your based-table block with the following code:
    SET_BLOCK_PROPERTY('AEMS_TEST', DEFAULT_WHERE, VV_DEFAULT_WHERE);
    Then when your user press the F8 to execute the trigger, it will send to the database the following select statement:
    SELECT AEMS.NAME,
    AEMS.ADRESS,
    AEMS.PHONE,
    AEMS.LIMIT,
    AEMS.SEQ
    FROM AEMS_TEST AEMS
    WHERE AEMS.SEQ IN (SELECT P.SEQ FROM AEMS_TEST P WHERE NVL(P.PHONE, '!') = '!'
    Hope this works for you-
    Abdel Miranda
    AEMS Global Group
    Panama

  • Query to find vendor number with whom a particular item was last purchased.

    Hi All,
    I want to frame a SQL query to find vendor number with whom a particular item was last purchased.
    I got to know that we can find this by looking at the open Purchase Order or the Material Transactions for the transaction type of ‘PO Receipt’ whichever is the latest.
    Can anyone please help me in framing such query.
    Regards,
    Shruti

    Here is a hint
    Use the mtl_system_items_b table to get the inventory_item_id.
    Use it in the po_lines_all table to get po_header_id
    Use it in po_headers_all table to get vendor_id
    Use it in po_vendors to get segment1 (i.e. vendor#)
    Hope this helps,
    Sandeep Gandhi

  • Re-query with last criteria programmatically

    I need to re-query a block with criteria from last query
    (after having changed the block's order by-clause), that is
    I need to do something equivalent to calling ENTER_QUERY
    twice followed by EXECUTE_QUERY.
    Anyone done something like this?

    There is a block property called LAST_QUERY.
    You have to extract the where-clause from there and set it as the default-where.

  • Have a multirecord block with several unbound items, filled by calling just

    In oracle forms I have a form with a multi-record block, with several unbound items.
    One of these unbound items is a formula based item.
    The formula for this item fills the others unbound items.
    A procedure with several out parameters is called.
    E.g.
    :cmr.id (holding the unique id of a database record)
    :cmr.unbound_dummy, with formula f_fill_blk_unbound_items(:blk.id)
    :cmr.unbound_adres
    :cmr.unbound_contactperson
    function f_fill_blk_unbound_items(p_id in customers.id%type)
    return number
    is
    l_rc number;
    begin
    customer_pck.get_adres_and_contactperson
    (p_id => p_id --IN
    ,p_adres => :cmr.unbound_adres --OUT
    ,p_contactperson => :cmr.unbound_contactperson --OUT
    return(0);
    end;
    QUESTION: how can I do something similar in APEX; have a multirecord block with several unbound items, filled by calling just one procedure with several out parameters ?

    Thank you for your reply.
    I can write database functions as wrappers, one for each out parameter, and use these in a select.
    But:
    - having one procedure with several out parameters was done for performance reasons.
    - I want to leave my database as is, and just replace the client.
    Easy as this is using Oracle developer forms, I cannot find out how to do this in any of the APEX examples/documentation.

  • Af:query with bind variables and Saved Search

    I have a VO and view criteria(VC).
    VC has a criteria item ObsoleteDate with range specified as bindVariables "dateFrm" and "dateTo" I dragged & dropped the named criteria as af:Query with table. Table toolbar has 2 buttons in which I set & clear the bind variables. Data is fetched as per as expected based on the VC & bind variables.
    The problem is,
    If I save my search with bind variables set and swap between the saved searches , all works fine. But the moment I clear bind variables & swap between searches.. "dateFrm" is populated and "dateTo" is null and I get an Exception oracle.jbo.AttrValException: JBO-27035: Attribute Obsolete Date: is required.
    Why is this happening?? Saved search is supposed to save the VC with all the bind values set while saving and clearing bind variables shouldn't affect the saved search, right?? Or I have understood it wrong?
    I am using JDeveloper 11.1.2.3.0
    Thanks

    Try
    like ? || '%'

  • Concat in unbound item

    Hello,
    I need a concatenation of 2 names and I don't get it to work properly...
    As Unbound Type i have SQL Expression and for Derivation Expression there is L_FWR_ACHTERNAAM||' '||L_FWR_ROEPNAAM
    I also tried this with the function concat() itself but this result in the same problem. When I try to generate the module I have the error message:
    CDG-01061 ERROR: Unbound Item OIFF0420301.ILD.FWR_NAAM: Invalid derivation expression 'L_FWR_ACHTERNAAM||' '||L_FWR_ROEPNAAM' for this item's type
    Anyone who knows what to do?
    Sofie

    Hi Sofie,
    I think you can't do that on a lookup column usage, because these fields are filled using a post-query trigger (and using a SQL Expression it should be part of the main block query). Try using a 'client side function' or create a function in the database that will return the "fwr_naam" using the "fwr_id" and call that function in the SQL Expression - using only columns from the 'main' table usage.
    HTH
    Roel

  • SAP QUERY report for vendor line items

    Hi
    I have created a SAP QUERY report for vendor line items with fields vendor no.,vendor name,amount,company code and period.But there is one line item i donot know from wher system is getting it picked with is not in that vedor account,when i compare with fbl1n.I checked the document number too...the same doc number is twice in my query report.One with correct amount and another with wrong one.How do i chk.Where did i go wrong in creating query.I used logical database KDF.
    Please advise.

    i chked...how do we get the amount displayed in query...it just displays amount no debit credit symbol... i have selected BSEG-DMBTR field but no -/+ sign,how is it done in query,please suggest.

  • Report query with bind variable

    Trying to create a report query for xsl-fo print. For output format I pick "derive from item" then pick the item name from the list, on the next screen, I paste the query with the bind variable. on the next step test query, I always get "data not found" regardless what value I type in. This is the same query that I ran under sql commands without any issues.
    Does anyone run into the same issue as I have when attempted to create a query with bind var ? There is no problem creating a query without bind varibles. . thanks.
    Munshar

    Hi, please did you get any solution to this issue? I am having similar challenge right now.
    select     EMP.DEPTNO as DEPTNO,
         DEPT.DNAME as DNAME,
         EMP.EMPNO as EMPNO,
         EMP.ENAME as ENAME,
         EMP.JOB as JOB,
         EMP.MGR as MGR,
         EMP.HIREDATE as HIREDATE,
         EMP.SAL as SAL
    from     SCOTT.DEPT DEPT,
         SCOTT.EMP EMP
    where EMP.DEPTNO=DEPT.DEPTNO
    and      DEPT.DNAME =upper(:dname)
    This run perfectly in sql developer, toad, and even inside publisher if I login directly to publisher to create report.
    Generating this same query in shared component query builder and testing it returns no data found. If I remove the last line, it works. but with the last line, it return no data found. It seems no one has been able to provide solution to this issue

  • Report and ready for input Query, with similar shadings are confusing

    Some customers mix report and planning queries in their templates.
    usually the shades for PLAN Queries are
    o white - ready vor input
    o blue- display data (e.g. LY, calc KPI)
    In a Query with NO INPUT ready Cells the query has a zebra shading, blue and white, row by row.
    That is confusion for users if they believe every Number on a white background can be changed.
    Is it possible to change the shading for reporting queries to blue only?
    Best Regards,
    Georg

    Hi.
    You can cancel zebra by setting off for ALTERNATE_STYLES in properties if analysis item in WAD, BUT it sets all cells as WHITE and not blue.
    I dont know how it will be usefull, but you may try ...
    Regards.

  • How can I create a query with web service data control?

    I need to create a query with web service data control, in WSDL, it's query operation, there is a parameter message with the possible query criteria and a return message contains the results. I googled, but cannot find anything on the query with web service. I cannot find a "Named Criteria" in web service data control like normal data control. In Shay's blog, I saw the topics on update with web service data control. How can I create a query with web service data control? Thanks.

    Hi,
    This might help
    *054.     Search form using ADF WS Data Control and Complex input types*
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html

Maybe you are looking for