Af:query and or conditions

Is it possible to use af:query for and or conditions , i am able to create view criteria with groups of and or conditions , but in run time it only uses the first group. looks like it is not possible , but wondering if anybody successful with work around
I was hoping to implement functionality similar to what's documented in below link for 10.1.3 in version 11 using af:query
http://my.opera.com/dominionspy/blog/2007/02/26/an-advanced-custom-search-form-for-adf
Thanks

Frank
Thanks for your reply
I found this in developer guide after posting my question here
Note: Query search forms do not support view criteria defined by
nested expressions (multiple groups of view criteria items). Therefore
avoid creating a view criteria with multiple groups in its expression
when you intend for the UI designer to be able to create a query
search form.
The main reason i want use the qf:query is to make use of the save search feature with mds
our users need advanced search filters for this application and they need different filter based on which customer data they are searching , but for any particular customer the filter will stay the same and can be used when they need to search data for that customer again in future. thought save search will help a lot here
i can code the same way as the above example i posted for 10.1.3 in 11g , but i need the save search feature and i do not know how to code for that on on my own
Regards

Similar Messages

  • Function return boolean with combine query and validation

    Wondering how would you combine a query and the condition together...
    Right now i have a computation that would do a single sql query.
    and in my validation i would use a function return boolean call the result from the computation to do some if statements
    wondering how would you combine the two in the validation? ( tried pasting both in the validation but it doesn't seem to work.)
    Select count(NAME_ID)
    FROM table
    WHERE to_char(NAME_ID) = :P1_NAME_ID;
    IF :P1_results = 1 THEN
    RETURN TRUE;
    END IF;
    RETURN FALSE;

    OK, then does this work for you as validation on your item; P1_NAME_ID ?
    DECLARE
       l_rowcount   PLS_INTEGER;
    BEGIN
       SELECT COUNT (name_id)
         INTO l_rowcount
         FROM my_table
        WHERE TO_CHAR (name_id) = :P1_NAME_ID;
       IF l_rowcount = 1
       THEN
          RETURN TRUE;
       ELSE
          RETURN FALSE;
       END IF;
    END;Jeff

  • IF and ABS condition statement in BEX query designer

    Hi,
    I would like to ask the best way for me to produce an acceptable result from Excel IF and ABS Condition statement.
    The condition statement that I have on my Excel file is
    =IF((A2-B2)>0,ABS(A2-B2),0)
    I'm trying multiple times to reproduce this in BEX Query designer, unfortunately I'm getting a bad result or unacceptable formula.
    Anyone who could help me with my issue?
    Thanks,
    Arnold

    Hi Arnold,
    Thank you,
    Nanda

  • How to implement Quick Query and Saved Searches in ADF?

    We are using 11gR2 ADF.
    The requirement is to enable Quick Search and save the Searches.
    In the Oracle ADF documentation, it is mentioned that
    - Create a view with view criteria named.
    - In the .jspx drag and drop the view criteria and Select Quick Query
    Upon doing the above, we see that a Search panel is getting created, but with a message 'No Search Fields Added'.
    In the named view criteria, Under 'UI Hints' we have set
    -- execution mode as Both
    -- Search region mode is Basic
    -- Show Operators in Basic
    Under 'Criteria Definition'
    the attributes are added in a group with OR condition.
    Thanks for your reply. Oracle ADF developer guide does not help!!
    If you have any other documentation that helps in implementing this Quick Query and Saved Search, your help is greatly appreciated.

    Set the following on your af:query component
    SaveQueryMode = hidden
    ModeChangeVisible = false
    This should work for you ..
    Regards,

  • Different LOVs in af:query and af:form for the same VO attribute

    Hi,
    We need to display different LOVs in af:query and af:form for the same attribute in VO.
    Is it possible to use LOV Switcher for this ?
    What condition can we use in LOV Switcher attribute to check if it is View Critearia row or VO row ?

    We have a VO attribute "User" which needs to be displayed as LOV in a Search Panel ( af:query component created using View Critearia ) and in a af:form.
    When this VO attribute is displayed in search panel, in LOV, we need to show all users.
    When this VO attribute "User" is displayed in a form for editing, in LOV, we need to show only active users.
    For this, we created two LOVs "ActiveUsersLOV" ( which shows only active users ) and "AllUsersLOV" ( which shows all users ) on VO attribute "User".
    LOVSwitcher attribute should return "ActiveUsersLOV" if the LOV is displayed in form and "AllUsersLOV" if the LOV is displayed in search panel.

  • Plz help don't know how to create a query and link it to a UDF

    hi,
    i am new to business one and however hard i am trying to use a query to link it to a UDF, it is not working. i think i am doing the whole thing wrong,so ill just post one problem i have and if any one of u can explain to me in steps i may be able to learn to link other queries and UDFs.so plz help me out .
    problem:
    i want to display the account balance of every customer/vendor whenvever i open a marketing document. i have created a UDF for the marketing documents in the title with name and description 'account balance'.
    Now how do i link the customer/vendor name field to this UDF so that the query generated will show the account balance of the corresponding customer/vendor.plz tell me in steps as to what tables to choose ,what fields to choose, what conditions and relatoins to use in a query wizard
                                                                                    thank you

    hi,
    A/R invoice
    for name UDF:
    SELECT T0.CardName FROM OCRD T0 WHERE T0.CardCode = $[OINV.CardCode]
    for balance UDF:
    SELECT T0.Balance FROM OCRD T0 WHERE T0.CardCode = $[OINV.CardCode]
    A/P invoice
    for name UDF:
    SELECT T0.CardName FROM OCRD T0 WHERE T0.CardCode = $[OPCH.CardCode]
    for balance UDF:
    SELECT T0.Balance FROM OCRD T0 WHERE T0.CardCode = $[OPCH.CardCode]
    FOR OTHER FORMS ONLY CHANGE THE END OF THE QUERY    FOR Example
    $[OPCH.CardCode]
    OPCH  is the table name, change it to other table.
    save the query and set it to customer code for refresh in A/R invoice
    save the query and set it to Vendor code for refresh in A/P invoice
    regards
    sandip

  • How to create a transport request with query and only with its structure.

    HI guru,
                how to create a transport request with query and only with its structure.transport request should not  include any other query items like ( variables, conditions...etc)
    thanks in advance.
    venkata

    Hi,
    Goto RSA1 and then Transport Connection -> In SAP Transports select Object Types-> Query Elements -> Then select Query->Give Technical name of the query and then select for transfer. In the right side you can choose the components which you wanted to transport.
    Regards,
    anil

  • How to build a multiselect with (nested) and and or conditions

    Hi,
    I have to tables: persons and categories. I would like to build functionality to enter values for categories, with a combination of and- and or- conditions (nested) to select persons.
    Has anyone an example how to do this ?
    Any reaction will be appreciated.
    Leo

    Reporting is not limitted in the MP you can perform in the same way as you do reporting on the single IC or DSO.
    No its not like that like you can only select common fileds in both the info providers. you can also identify the fileds that are not common to both the info providers.
    For example, the report need both customer's accounting number and sales order number. But accounting number only in accounting cube while sales order number only in sales order cube. Then how can I meet the requirement?
    We have a constant selection option in the query designer while reporting on this fileds we will use this function.
    inorder to meet the above requirement please check the below link which gives you detailed information regarding your requirement.
    for more details chk the below link
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/70dcd7b5-6a3d-2d10-c984-e835e37071a2?quicklink=index&overridelayout=true
    Regards
    KP

  • Update a filed value with powershell script with ordery by and where condition

    Hi
    I have below powershell script to update list columns but  how i update a field value with ordery by a column and where condition
    below is the part of my script
    $list = $web.Lists[$listName]
    $items = $list.items
    $internal_counter = 1
    #Go through all items
    foreach($item in $items)
    if($item["CourtNO"] -eq $null)
    #if($item["CourtNo"] -eq '1')
    $item["CaseNo"] = $internal_counter
    #how to add a column ordery by Title
    # and where Title field value from 1 to 10
    $internal_counter++
    adil

    Hi,
    You mean that you only need to update all items with Title field value in range 1..10 and order by them before run the loop statement update?
    If so, use CAML query to get the items only match the condition.
    #Build Query
    $spQuery = New-Object Microsoft.SharePoint.SPQuery
    $query = '<Where><And><Gte><FieldRef Name="Title" /><Value Type="Text">0</Value></Gte><Lte><FieldRef Name="Title" /><Value Type="Text">10</Value></Lte></And></Where><OrderBy><FieldRef
    Name="Title"/></OrderBy>'
    $spQuery.Query = $query
    $spQuery.RowLimit = $list.ItemCount
    $items = $list.GetItems($spQuery)
    Hope this help!
    /Hai
    Visit my blog: My Blog | Visit my forum:
    SharePoint Community for Vietnamese |
    Bamboo Solution Corporation

  • Select Query and Recordset on same page

    I have been workig with Coldfusion for a while now.  Where I work there is a need for web pages to extract data from data sources.  I have been successful at doing this.  Typically I use a form that selects multiple criteria, which when submitted loads a target/action page that displays records that are filtered based on the SQL statement contained on that action page.  What I do is to conditionally check if criteria is passed using cfif.  And if a field parameter is indeed passed it becomes part of the cfquery.  This works out well - especially for reporting.
    But now I am seeing more and more a need to accomplish the same process - but on a single cfm page.  So the page I seek will have both the form (select) and the recordset results on the same page. 
    In this exercise I will be caching results od a query and having several queries to further refine what I seek (QOQ).  What I am seeking is the best practice to follow, I was thinking that using an iframe on the page would be and adequate solution whereby the query would pass the criteria and its form action would pass the variable(s) to the action page, which would be the source of the iframe.  But I am not certain that this is a best proctice.  Nor have I had great success at getting the pages to work in concert. 
    Any advice that you can lend would be appreciated. 

    I ideally start by reducing the 2-page functionality - of form page and action page - to just one. It goes like this:
    <cfset isValidationPassed = false>
    <cfif isDefined("form.someVar")>
    <!--- Do validation. Validated form implies isValidationPassed is true --->
    </cfif>
    <cfif isValidationPassed>
    <!--- Do action page stuff --->
    <cfelseif NOT isDefined("form.someVar") OR NOT isValidationPassed>
    <!--- Display the form. --->
    <!--- If form had been submitted, inform user which validation failed, and what to correct. Display the form. --->
    <cfoutput><form method="post" action="#CGI.SCRIPT_NAME#"></cfoutput>
    </form>
    </cfif>
    The idea is then to pile on the complexity, layer by layer.

  • HOW TO USE LOGICAL AND OR CONDITION TOGETHER

    Please do not post subject in ALL CAPITALS
    Hi All there,
    How to use logical and or condition together
    I wanted to use logical AND OR condition together in where clause of Select Query.
    eg where xyz and or abc
    Regards
    Sagar
    Edited by: Matt on Mar 17, 2009 1:05 PM
    Edited by: Matt on Mar 17, 2009 1:05 PM

    hi,
      You cannot use the logical and  or condition together at the same time in SQL statement. Sachin is correct while using the and and or in the same condition. You can get the data using or condition in SQL statement, and then use the delete statement of internal table using the end condition. please find the following code for the same.
    select *
      from dtab
    where cond1 eq 'A1'
         or cond2 eq 'A2'.
    if sy-subrc eq 0.
      delete itab where cond1 eq 'A1' and 'A2'.
    endif.
    regards,
    Veeresh

  • Working with a complex query and trying to get rid of duplicates

    I'm working with the following complex query, and I need to
    select vin, number, year, make, model, and state from
    2007 vehicles in certain models, vin types
    2006 vehicles in certain models, vin types
    Is there a more efficient way to write this than how I've been writing it?:
    select distinct vehicle.vin VIN, unit.STATION_ID STID, unit.EMBEDDED_AREA_CODE||unit.EMBEDDED_PREFIX||lpad(unit.EMBEDDED_RON,4,0)
    MIN, unit.AUTHENTICATION_ID AUTHCODE, vehicle.user_veh_desc, veh_model.VEH_MODEL_DESC MODEL, veh_model.VEH_MANUF_YEAR YEAR, acct_veh.STATE STATE
    from vehicle
    inner join veh_unit on vehicle.vehicle_sak=veh_unit.vehicle_sak
    inner join unit on veh_unit.unit_sak=unit.unit_sak
    inner join vdu_profile on vdu_profile.vehicle_sak=vehicle.vehicle_sak
    inner join vdu_profile_program on vdu_profile_program.VDU_PROFILE_SAK=vdu_profile.VDU_PROFILE_SAK
    inner join veh_model on vehicle.VEH_MODEL = veh_model.VEH_MODEL
    inner join acct_veh on acct_veh.VEHICLE_SAK = vehicle.VEHICLE_SAK
    and vehicle.user_veh_desc like ('%2007%')
    AND unit.unit_gen_id >= 36
    AND vdu_profile_program.VDU_PROGRAM_SAK = 3
    and vdu_profile_program.PREFERENCE_VALUE = 'Y'
    and acct_veh.STATE in ('MN','ND','IA')
    AND (veh_model.VEH_MODEL_DESC like ('%Vehicle2%')
    OR veh_model.VEH_MODEL_DESC like ('%Vehicle3%')
    OR veh_model.VEH_MODEL_DESC like ('%Vehicle5%')
    OR veh_model.VEH_MODEL_DESC like ('%Vehicle6%')
    OR veh_model.VEH_MODEL_DESC like ('%Vehicle7%')
    OR veh_model.VEH_MODEL_DESC like ('%Vehicle8%')
    OR veh_model.VEH_MODEL_DESC like ('%Vehicle9%'))
    and ACCT_VEH.ACCT_VEH_STATUS_ID = 'A'
    and (vehicle.vin like ('_______3_________')
    or vehicle.vin like ('_______W_________')
    or vehicle.vin like ('_______K_________')
    or vehicle.vin like ('_______0_________'))
    UNION
    select distinct vehicle.vin VIN, unit.STATION_ID STID, unit.EMBEDDED_AREA_CODE||unit.EMBEDDED_PREFIX||lpad(unit.EMBEDDED_RON,4,0)
    MIN, unit.AUTHENTICATION_ID AUTHCODE, vehicle.user_veh_desc, veh_model.VEH_MODEL_DESC MODEL, veh_model.VEH_MANUF_YEAR YEAR, acct_veh.STATE STATE
    from vehicle
    inner join veh_unit on vehicle.vehicle_sak=veh_unit.vehicle_sak
    inner join unit on veh_unit.unit_sak=unit.unit_sak
    inner join vdu_profile on vdu_profile.vehicle_sak=vehicle.vehicle_sak
    inner join vdu_profile_program on vdu_profile_program.VDU_PROFILE_SAK=vdu_profile.VDU_PROFILE_SAK
    inner join veh_model on vehicle.VEH_MODEL = veh_model.VEH_MODEL
    inner join acct_veh on acct_veh.VEHICLE_SAK = vehicle.VEHICLE_SAK
    and vehicle.user_veh_desc like ('%2006%')
    AND unit.unit_gen_id >= 36
    AND vdu_profile_program.VDU_PROGRAM_SAK = 3
    and vdu_profile_program.PREFERENCE_VALUE = 'Y'
    and acct_veh.STATE in ('MN','ND','IA')
    AND (veh_model.VEH_MODEL_DESC like ('%Vehicle1%')
    OR veh_model.VEH_MODEL_DESC like ('%Vehicle2%')
    OR veh_model.VEH_MODEL_DESC like ('%Vehicle3%')
    OR veh_model.VEH_MODEL_DESC like ('%Vehicle4%')
    OR veh_model.VEH_MODEL_DESC like ('%Vehicle5%')
    OR veh_model.VEH_MODEL_DESC like ('%Vehicle6%')
    OR veh_model.VEH_MODEL_DESC like ('%Vehicle7%'))
    and ACCT_VEH.ACCT_VEH_STATUS_ID = 'A'
    and (vehicle.vin like ('_______Z_________')
    or vehicle.vin like ('_______K_________'))

    I am not sure how many rows you have in the tables but I am assuming that there would be performance benefits in performing the query only once. You can combine similar coding and use an OR condition for the parts that are different. I left the 'K' vin comparison in both years for readability.
    I was not able to fully test my code but I believe that it will work as is. I hope it helps. If you are happier with the UNION you may want to investigate the WITH clause as you can query a subset of data twice, rather than the full data set.
    -- Common code 
    SELECT DISTINCT
       vehicle.vin,
       unit.station_id stid,
       unit.embedded_area_code || unit.embedded_prefix || LPAD (unit.embedded_ron, 4, 0) MIN,
       unit.authentication_id authcode,
       vehicle.user_veh_desc,
       veh_model.veh_model_desc model,
       veh_model.veh_manuf_year YEAR,
       acct_veh.state
    FROM vehicle
    INNER JOIN veh_unit           
       ON vehicle.vehicle_sak = veh_unit.vehicle_sak
    INNER JOIN unit               
       ON veh_unit.unit_sak = unit.unit_sak
    INNER JOIN vdu_profile        
       ON vdu_profile.vehicle_sak = vehicle.vehicle_sak
    INNER JOIN vdu_profile_program
       ON vdu_profile_program.vdu_profile_sak = vdu_profile.vdu_profile_sak
    INNER JOIN veh_model          
       ON vehicle.veh_model = veh_model.veh_model
    INNER JOIN acct_veh           
       ON acct_veh.vehicle_sak = vehicle.vehicle_sak     
    AND unit.unit_gen_id >= 36
    AND vdu_profile_program.vdu_program_sak = 3
    AND vdu_profile_program.preference_value = 'Y'
    AND acct_veh.state IN ('MN', 'ND', 'IA')
    AND acct_veh.acct_veh_status_id = 'A'
    AND
    -- Annual code
          (   -- 2006 conditions 
          AND vehicle.user_veh_desc LIKE ('%2007%')
          AND regexp_like(veh_model.veh_model_desc, 'Vehicle[2356789]')
          AND regexp_like(vehicle.vin, '_{7}[3WK0]_{9}')           
       OR
          (   -- 2007 conditions 
          AND vehicle.user_veh_desc LIKE ('%2006%')
          AND regexp_like(veh_model.veh_model_desc, 'Vehicle[1234567]')
          AND regexp_like(vehicle.vin, '_{7}[ZK]_{9}')
       ).

  • Tabs and display conditions

    Hey everyone.
    I was toying around with my Apex as I love to do, however, im a bit confused regarding tabs and display conditions.
    My scenario:
    I want a user, perhaps a public one in the future, to be able to reach page 1 of my application, where there might be for example a form or anything else fun, but I want to have a display condition on tab nr 2 to only be displayed for admin users.
    Fair enough, checked out the conditionstypes and thought the sql returns at least 1 row would be sutiable so I made myself a username table with name, usernames etc and one "admin" column that contains a Y or N flag.
    So I chosed Exists (SQL query returns at least one row)
    And in expression1 I entered "select username from users where username=:APP_USER and admin='Y'"
    However, this somehow seem to fail the display condition, and the tab disapears entirely. regardless if I use my appuser (which has uppercase in the table) or the built in "admin" user.
    I tried this SQL out in the query tool and it asked for the bind variable value and I entered my username and it displayed 1 row correctly. But somehow this doesn't seem to work for the tab.
    Am I thinking the wrong way here or what am I doing? :)
    Sincerely
    Johnny

    It is standard tab set, and I want the tab going to page 2 to be invisible for non admins for example, but I seem to make the admin tab disapear even thou I know my sql is correct, if I disable the display condition both tabs is visible again, so am I thinking reverse, or is it something else?
    Message was edited by:
    Mr plow

  • Dynamic query or column condition

    I have a report region with many columns (40+). All the columns need to be conditionally displayed depending on whether or not the corresponding column name is checked in some LOV-based (checkbox) item.
    I see 2 options
    1. Put a column condition on each column with a PL/SQL expression of
    instr(':'||:P1_COLUMNS||':',':COL1:')>0Pros: The database engine is seeing the same SQL statement every time so the shared pool is not cluttered.
    Cons: All the columns are fetched everytime and then discarded if the column condition fails. Inefficient?
    2. Change the report region to a "PL/SQL Function body returning SQL query" and dynamically build the SELECT statement to loop over the checkbox item and only include those columns in the query.
    The pros and cons are exactly reversed here!
    Any thoughts, comments appreciated.
    Thanks

    I haven't really worked on this recently, but I am leaning towards using column conditions and leaving the query the same (this would also be the appropriate choice for you since you have FKs and need to join to get the description. If the description is not one of the selected columns, it would not be rendered on the report)
    Query tuning is a separate issue, the query has to be optimized, that goes without saying.
    I am still mulling over this, haven't come to a conclusion yet.
    Thanks.

  • Running Query Based on Condition

    Hi
    I want to run different query based on a condition. I am not able to execute the following query. is this the right way to run different query based on condition?
    SELECT * FROM (
    CASE WHEN (SELECT COUNT (*) from data1 where ID = 1 AND stype = 'A') > 0 THEN select * from data where ID = 1 AND stype = 'A'
    WHEN (SELECT COUNT (*) from data1 where ID = 1 AND stype = 'B') > 0 THEN select * from data where ID = 1 AND stype = 'B'
    WHEN (SELECT COUNT (*) from data1 where ID = 1 AND stype = 'C') > 0 THEN select * from data where ID = 1 AND stype = 'C'
    END
    ) as a;
    Edited by: user6016744 on 21 Apr, 2011 12:40 AM

    This works for us; hope it helps.
    CREATE OR REPLACE FUNCTION SCHEMA.GET_STEP_COST (loan_number_in in VARCHAR2, step_code_in in VARCHAR2 default null, ws_in in VARCHAR2 default null )
    RETURN VARCHAR2 IS retval  VARCHAR2 (50);
    /*passing in loan number and step code you need the cost for, will return the cost*/
    BEGIN
        CASE ws_in --depending on workstation in is the table select
        WHEN 'F' THEN
            EXECUTE IMMEDIATE 'SELECT '|| step_code_in ||' FROM CLAIMS_FCL_STEPS WHERE LOAN_NUMBER = '|| loan_number_in ||'' INTO retval;
        WHEN 'R' THEN
           EXECUTE IMMEDIATE 'SELECT '|| step_code_in ||' FROM CLAIMS_RS_STEPS  WHERE LOAN_NUMBER = '|| loan_number_in ||'' INTO retval;
        WHEN 'L' THEN
           EXECUTE IMMEDIATE 'SELECT '|| step_code_in ||' FROM CLAIMS_LM_STEPS  WHERE LOAN_NUMBER = '|| loan_number_in ||'' INTO retval;   
        ELSE
            retval := 0;
        END CASE;
      RETURN retval;
    END GET_STEP_COST;
    /

Maybe you are looking for

  • How can I actually play iCloud/iTunes on my MacBook Pro?

    I use a MacBook Pro with a 2.53 GHz Intel Core 2 Duo, running Snow Leopard (10.6.8).  I haven't updated to Lion because I'd have to re-purchase ProTools in order to do that, and ProTools was the whole reason I upgraded to a MacBook Pro to begin with.

  • Upgrade from Windows 8.1 Preview to RTM destroyed MSSQL databases

    I am not really sure WHY this happened, but I am so upset right now. On my development machine, I installed the Windows 8.1 release from the Windows Store on a machine that had the Windows 8.1 preview installed. It's bad enough that much to my surpri

  • HT201263 iPhone stuck in recovery. Can't get it out!! WHY?

    Phone stuck in recovery. Cant get it out. Tried holding home and sleep button simutaneously. Restored phone. Still unable to get it out of recovery.

  • How to hide account photo in mail

    How to I get Mail to not show my account picture? I like my account picture, I just don't want it to print out or be seen in the upper right hand corner of my emails. How do I turn this off? I've looked and looked, but still can't figure it out. I st

  • ALV to Download file column contents ***

    Hi, I have the Sales unit field( VBAP-VRKME) shown in an ALV as a column. Though the unit displays in the ALV correctly, the download file from Application toolbar to unconverted format shows the contents of the column as *****.   The Sales unit fiel