Filter value with wildcards

Hello there
I have a table called phone_shop_tab
ID MODEL CHANNEL
001 NOKIAn95 3g
002 % gsm
003 nokian97 %
004 nokian97 gsm
005 % %
006 % 3g
i have to select all from phone_shop_Tab if i pass
MODEL= <value> and CHANNEL = <value>
Here % is any values
I should get the output with the follwing constraints
% denots any value passed . for example % in the MODEL column means that it is OK for any MODEL value passed to the query.
if i fliter with MODEL= 'NOKIAn97' and CHANNEL = 'gsm' it should select 4th row because it exacly matches the filer
if i fliter with MODEL= 'NOKIAn97' and CHANNEL = 'XXX' it should select 3th row because it matches model (nokian97) also channel (%) here XXX= %
if i fliter with MODEL= 'BAC' and CHANNEL = '3g' it should select 6th row because it matches model (%) also channel (3g) ,here BAC = %
if i fliter with MODEL= 'ABC' and CHANNEL = 'XYZ' which are both not in the table it should select 5th row because it matches model (%) also channel (%) because % mean any value
hope you all understand the output scinario
can anyone provide with an SQL statment for this.
thanks
prash

Hi,
This does what you requested:
SELECT     *
FROM     phone_shop_tab
WHERE     UPPER (:p_model)     LIKE UPPER (model)
AND     UPPER (:p_channel)     LIKE UPPER (channel)
;You said, for example:
if i fliter with MODEL= 'NOKIAn97' and CHANNEL = 'gsm' it should select 4th row because it exacly matches the filerIf :p_model='NOKIAn97' and :p_channel='gsm', this will indeed returrn the row where id=004. It will also return the rows where id IN (002, 005).
If you meant that it should only return the best match (however you define "best"), then use the analytic RANK (or perhaps ROW_NUMBER) fucntion to arrange the rows found in "best first" order, then pick the ones labeled 1.
For example:
WITH     all_matches     AS
     SELECT     p.*
     ,     RANK () OVER ( ORDER BY  CASE WHEN model   = '%' THEN 2 ELSE 1 END
                      ,      CASE WHEN channel = '%' THEN 2 ELSE 1 END
                    ) AS rnum
     FROM     phone_shop_tab     p
     WHERE     UPPER (:p_model)     LIKE UPPER (model)
     AND     UPPER (:p_channel)     LIKE UPPER (channel)
SELECT     *     -- or list all columns except rnum
FROM     all_matches
WHERE     rnum     = 1
;

Similar Messages

  • Assigning a DataProvider filter value with JavaScript

    I have a "Fiscal Yr/Period" filter characteristic in my web application that I am assigning the value of the current month and year when the web application is loaded.  In other words, this filter is applied to the DataProvider when the application loads (code below):
    <object>
             <param name="OWNER" value="SAP_BW"/>
             <param name="CMD" value="SET_DATA_PROVIDER"/>
             <param name="NAME" value="C_LPR_Q018"/>
             <param name="QUERY" value="C_LPR_Q018"/>
             <param name="INFOCUBE" value="ZPP_C01"/>
             <param name='FILTER_IOBJNM' value='0FISCPER'/>
             <param name='FILTER_VALUE' value='H12004010'/>
             DATA_PROVIDER:             C_LPR_Q018
    </object>
    As you can see above, the value for the '0FISCPER' object is hardcoded and thus requires me to change this monthly.  I have written some JavaScript code to calculate the current mo. and yr. however I can't get my JavaScript variable that holds the value I need assigned to the FILTER VALUE.  Can I even assign a JavaScript variable as the filter value?  Is there another way?  Any help would be greatly appreciated.

    Hi Allen,
    if you want to change any param of an object, try the function SAPBWOpenURL, which should be sent against the object you want to change. Documentation is at :
    http://help.sap.com/saphelp_bw33/helpdata/en/f1/0a5a2ee09411d2acb90000e829fbfe/frameset.htm -> Business Explorer ->
    Web Application ... -> Befehl URLs
    Concat the date in JavaScript and call
    SAPBWOpenURL(SAP_BW_URL_Get()+'&item=...&FILTER_IOBJNM="0FISCPER"&FILTER_VALUE="TheDateYouWant"') (I hope I set the " and ' correctly, better you should check).
    For example you can insert :
    <HEAD>
    <script>
        function callTheTableWithTheDate()
            SAPBWOpenURL(like above);
    </script>
    </HEAD>
    <BODY onload="JavaScript:callTheTableWithTheDate()">
    It's only a hint, adjust it for your requirements. You can save the date in a cookie too and reuse it whenever you want. You know how to handle cookies ?
        Bye
        Ralf

  • Matching a filter value with mutiple fact columns

    Hello,
    I have been given following requirement to implement in OBIEE dashboard. There is a dimension table which stores Sales Rep IDs and their names. Fact table stores the Sales opportunities identified by these sales reps. Now they can work on the opportunity in any role...say as consultant or primary rep or some other role. Lets call it Role1, Role2 and Role3. The requirement is when user selects a Sales rep name in the filter; the dashboard should show all those opportunities on which he worked in any of the capacities i.e.Role1 or 2 or 3.
    My Fact table has following columns
    Role1_Sales_Rep_ID
    Role2_Sales_Rep_ID
    Role3_Sales_Rep_ID
    The Dimension has
    Sales_Rep_ID
    Sales_rep_Name
    I tries putting following condition ion physical layer join
    Dim.Sales_Rep_ID = fact.Role1_Sales_Rep_ID
    Or Dim.Sales_Rep_ID = fact.Role2_Sales_Rep_ID
    Or Dim.Sales_Rep_ID = fact.Role3_Sales_Rep_ID
    but the RPD gives an error saying that Dim.Sale_Rep_ID used more than once. Please help me solve this scenarion or please suggest any alternate solution.
    Thanks,
    Vivek.

    Hi vivek,
    but the RPD gives an error saying that Dim.Sale_Rep_ID used more than once. Please help me solve this scenarion or please suggest any alternate solution. Ya the joins should be established correctly to achieve your scenerio,i.e here oneto many joins sud be established for example
    take the three fact tables role1,role2,role3 and the dimension table first click the dimension table and join it to role1 so it becomes 1:N the same way again click dimension table and click the role2 and repeat the process then you can achieve what you want.
    Another simpler work around is take all the fact tables into single folder/table and the important columns for your requirment.Then now 1 fact and 1 dimension so its simple for you.
    Hope it helps you.
    Best Wishes,
    Kranthi.

  • WAD - Exclude more than one value with filter button

    Hi guys
    I have been working on a web template with a button to set a filter to exclude two values. E.g. I want to exclude both the values '28' and '30' from the dataprovider.
    What I have done is insert a button group item, create a button with the command SET_SELECTION_STATE_SIMPLE to exclude '28' as command 1 and SET_SELECTION_STATE_SIMPLE to exclude '30' as command 2. This does however not give me the correct result, as it only excludes '30' as set in command 2. So the conclusion must be that SET_SELECTION_STATE_SIMPLE can not be used, as it will only work with one value.
    So I went on and tried with SET_SELECTION_STATE which gives the possibility to choose more than one filter value. However it does not seem possible to exclude values with this command?
    Is it not possible to exclude two filter values with a button in a BI 7.x web template?
    BR
    Stefan.

    Dear Frank
    I did it as like as the following link lead me:
    http://www.oracle.com/technology/obe/obe11jdev/11/adfbc_new_features/adfbc.html
    The problem has been appeared when I attached the "Create" button and when press on it to create new record, then the "LOV" couldn't work correctly.
    Thanks for your reply

  • Changing Filter Values from Macro in BW 7.0

    Hello,
    in my Workbook I need to change Filter Values of some queries in runtime.
    The first thing I found was BEx API reference for BW 3.5, but I wasn't able to make these functions work. After all I found this code:
        Dim BEx As Object
        Set BEx = Application.Run("BExAnalyzer.xla!GetBEx")
        Dim dp As Object
        Set dp = BEx.DataProviders.Item(sDP)
        Dim dimension As Object
        Set dimension = dp.Request.Dimensions.Item("0CALDAY")
        Dim filters As Object
        Set filters = dimension.filters
        If Not BEx.ServerStateExists Then
        MsgBox " Please refresh before using this Makro"
        Exit Function
        End If
        Call filters.SetFilterValue(sFilter) 'this sets the filter value
    But using this code I wasn't able to set more than 1 filter value, because the function SetFilterValue removes all previous filters, but now I need to set more than 1 filters.
    I also tried to separate different filter values with comma, but this did not help.
    Also I will be glad if someone could give me a link on documentation about BEx objects in Excel.
    Thanks in advance,
    Pavel Baronov

    Hi.........
    Check this........
    http://www.netsaptech.com/SDN/demo/BIM301.pdf
    Regards,
    Debjani.......

  • With filter values iam not able to see out put of a  web report

    Hi,
    I had a web report. for the webreport,data provider is Query. My requirement is to change the description of calculated KF. I have changed the description of Calculated KF in Query and transported it to Quality system. But when i execute the Web Report directly in web browser the changes in the description of calculated KF are shown. But when i execute through some URL with some filter values in the web template iam unable to find the changes.
    Please help me on this.
    Thanks & Regards
    Bharathi

    Hi Ajay,
    i had a web template. For this web template query is the data provider. In my requirement i need to change the description of calculated key figure.
    Calculated key fig: OED Disconnect
    Change description of Calculated key figure from OED to IEG(IEG disconnect).
    I have changed the calculated KF desc from OED to IEG in development and transported to quality system. i can even find the changes in query also.When i execute the web template built on query directly through browser iam able to see the change in the description of calculated KF.
    But when i execute through some URL(http:// bwqa/sap/bw/pub?sap-language=EN&bsplanguage=EN&CMD=LDOC&TEMPLATE_ID=T_ECA_DTL_REPORT_BYUNIT&FILTER_IOBJNM_1=ZMREQCC&FILTER_VALUE_1=000001522&DATA_MODE=HYBRID) with some filters like  filter_iobjnm_1= ZMREQCC and data mode = hybrid iam unable to find the changes in the calculated kf description.
    But when i execute the url (http:// bwqa/sap/bw/pub?sap-language=EN&bsplanguage=EN&CMD=LDOC&TEMPLATE_ID=T_ECA_DTL_REPORT_BYUNIT) without filter values i can find the changes in the description of calculated KF.
    Kindly update me why the changes are not reflecting when i use filters.
    Thanks & Regards
    Bharathi

  • How to know if implementation with a filter value exist for a BAdI in code?

    Hi all,
    Scenario:
    I created a BAdI. There will be a button on the UI to call its implementation(s); while if there is no implementation with specified filter value, this button needs to be hidden. Thus I need to know if the implementation exist before calling it.
    Question:
    In the ABAP code, how to get whether implementation with specified filter value exists for a BAdI?
    If it's possible, please help provide code.
    Thanks and regards,
    Said

    Problem solved:
    data: r_badi type ref to YOUR_BADI,
              badi_impl_num type i.
      get badi r_badi
        filters
          flt_name = fit_val.
      badi_impl_num = cl_badi_query=>number_of_implementations( badi = r_badi ).
      if badi_impl_num > 0.
        "there are badi implementation(s)
      endif.

  • A filter value for Query is set with some value automatically

    Hello SAP sourcing Guru!
    I created a query which has several filters.
    Some of Filter's type is VLV.
    When I preview the query somehow the filter values are already set with some value even though I did not set the default value.
    For example, filter name is Region and there are four regions: Asia, NA, Europe, and SA.
    I want to select one of them from drop-down menu. But Asia was already selected when I clicked the preview button for the query. I want to see "Please Select" instead of Asia from drop-down menu. I did not select "Prefill value from cache" for the filter. I made the filter Optional only. I did not set Default Value either for the filter.
    Any clues?
    Thank you for your response in advance.

    Hi,
    In the Default value field of the filter prompts, you need to mention the Class Reference ID of the corresponding field. E.g., if you have Contract document phase as a filter, then in that if you want to display a blank or none value, then you should use null:2016.
    Similarly for vlv type, the system has a value 616. Hence if you want to display a None value insteead of Asia, use the following in the Default value field:
    0:616:null.
    The way to find the class reference ID is to goto the RG > Class Reference > Look for the field that you are attempting to default on.
    Hope this helps,
    Vikram

  • Export to Excel with Filter values

    I have implemented Prakash Darji's Exporting tips.
    http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/47fe4fef-0d01-0010-6f87-ed8ecb479123
    But it very important for us to only allow the user to only export the data which is available on the table currently, basically export to excel WITH filters and not everything which is in the infoprovider.
    does anyone have a way of achieveing this?
    i was thinking of maybe somehow passing filter values in the PCD url
    Something like this?  would this work.....
    pcd!3aportal_content!2fcom.sap.pct!2fplatform_add_ons!2fcom.sap.ip.bi!2fiViews!2fcom.sap.ip.bi.bex.QUERY=ZTESTQUERY&FILTER_IOBJNM=0CALDAY&FILTER_VALUE='01012009'&BI_COMMAND_1BI_COMMAND_TYPE=EXPORT&BI_COMMAND_1-EXPORT_FORMAT=XLS&BI_COMMAND_1-null=

    Hi Apeksha,
    you can achieve this requirement (unless I do not know the detailled requirement) perhaps by using this way of implementation:
    1. Create a new template which contains an info_field which does a data binding to the variable values or the characteristic you want to display. Set the visibility of the top container to "hidden". Add a empty data provider to this template. However be aware that the name for the (empty) data provider must match the name of the data provider within the original template you want to print.
    2. Open your original template and include the template you created in step 1 (Advanced: Web Templates and technical name of the web template created in step 2). Choose the appropriate location (above/below the analysis item).
    3. Check the settings of your export command: do not set a special web item to be printed.
    If you export the template within web the second template should be printed correctly displaying the variable settings chosen in step 2 for the info_field.
    Brgds,
    Marcel

  • Template having export to excel functionality with filter values in WAD

    Hi,
    I need to create a template which has export to excel functionality with all the filter values that the user has selected in the selection screen.
    export to excel can be done but how can be the output excel sheet contain only those values which we see in browser  when the report is executed with some filters.
    Regards,
    Apeksha

    Hi Apeksha,
    you can achieve this requirement (unless I do not know the detailled requirement) perhaps by using this way of implementation:
    1. Create a new template which contains an info_field which does a data binding to the variable values or the characteristic you want to display. Set the visibility of the top container to "hidden". Add a empty data provider to this template. However be aware that the name for the (empty) data provider must match the name of the data provider within the original template you want to print.
    2. Open your original template and include the template you created in step 1 (Advanced: Web Templates and technical name of the web template created in step 2). Choose the appropriate location (above/below the analysis item).
    3. Check the settings of your export command: do not set a special web item to be printed.
    If you export the template within web the second template should be printed correctly displaying the variable settings chosen in step 2 for the info_field.
    Brgds,
    Marcel

  • Two tables with different filter values base on a analysis

    Hi guys,
    let assume that I have a analysis with columns : group_id and sales.
    Based on it I would like to create two tables : table1 where group_id =1 and table2 where group_id = 2.
    Is OBIEE capable of doing it?
    Regards,
    Slavi

    Hi Slavi,
    You can do that in single analysis, but you need to have the group_id column two times.
    That is, bring group_id_1, group_id_2 (same column), sales
    Now in table 1,
    bring group_id_1, sales
    Then in selection steps for group_id_1 -> Select Members -> Action choose keep only -> choose the filter value 1
    This will filter the table 1 with group_id 1
    In table2 bring group_id_2, sales
    Then do the same step for group_id_2 with value 2.
    now in same report you have two reports with different filter.
    If you want you can keep the same column name for both group_id columns, I just kept group_id_1, group_id_2 for easy reference.

  • Test Wizard with databank value and wildcard

    Is it possible to use e.g. the table test with a databank value and wildcard in the Wizard?
    for example:
    <<username>>*
    or with regular expressions?

    Greetings Spike,
    Unfortunately the table test and the custom object test they both do not support concatenation of a data bank variable and something else (where something else could be another data bank variable, text or numbers).
    You can use the wildcard or the regular expression of a table test or a custom object test by defining the pattern to use in your data bank file.
    Example:
    A data bank file that contains the following information:
    --------------- Begin data bank file example -----
    OrderNumber
    L2007*
    K2006*
    ---------- End data bank file example -------------
    Notice that the wildcard was included in the value of each data bank record.
    In the table test the expression field should be "<<OrderNumber>>" (without the quotes) and the Test Type would be String and WildCard.
    The same thing can be done with the regular expression option.

  • ES_CRM_PARTNER_REDETERMIN* with the filter value *BUS2000223

    Hi,
    I have a requirement in which i have to create a Service Request and enter some particular Account ID for it through which any particular Account is assigned to the partner function "Account owner " automatically.
    Then again before saving the user changes the Account ID entered before to some other.As for this Partner Determination settings has been done in the spro.But now the partner function "Account Owner" is not changed accordingly.
    To make this happen i implented an Enahncement Spot ES_CRM_PARTNER_REDETERMIN with the filter value BUS2000223.
    But this implementation is not getting triggered, it triggers only once the first time when we try to create a Service request.And teh partner determination is not working.
    Please, suggest regarding the same.
    Cheers,
    Sharad

    Hello,
    partner re-determination is only available since crm 6.0.
    Please see the online documentation which explains this at:
    http://help.sap.com/saphelp_crm60/helpdata/en/d4/a8f6967c4b46b2bc2c20283a245199/frameset.htm
    Normally it works only for BUS - types which are maintained in table (these entries are also supported)
    COMS_PARTNER_DET:
    BUS2000108
    BUS2000111
    BUS2000230
    BUS2000231
    BUS2000311
    BUS2000312
    Hence at least you have to maintain the BUS2000223 in the table, but I am not sure if it will work.
    Regards
    Rene

  • Link to interactive report with filter values containing : or %

    Hi,
    I have an application written in PL/SQL. The application takes input from users, and then constructs a URL for an interactive report, concatenating the user input as filter values for the report. Sometimes, the input values contain characters such as the colon (:) or the percent sign (%). In these instances, APEX appears to ignore the rest of the URL beyond the first colon or percent sign in the filter values. For example, in the following URL, the first filter value is "Oracle Database 11g: Workshop I":
    http://abc.oracle.com/pls/apex/f?p=129:8::::8,CIR:IRC_TITLE,IR_PROJECT_STATUS:Oracle Database 11g: Workshop I,Completed
    The Interactive Report displayed for this URL shows all courses whose title contains "Oracle Database 11g" -- in other words, more records are displayed than should have been if the complete set of filters were applied in the query (i.e., TITLE = Oracle Database 11g: Workshop I, and PROJECTS_STATUS = Completed).
    How should I construct the URL so that the colons (:) and percent signs (%) which may be part of the filter values are treated correctly?
    Thanks,
    Jenny

    Thanks to Joel Kallman, here's the answer:
    The ‘f’ procedure has a parameter named p_sep. This is the separator used for the arguments in the ‘p’ parameter in the call to the ‘f’ procedure. The default value for this separator is ‘:’, obviously.
    If you have data values that contain the separator, then you can use a different character for your separator (you may need to manually specify the URL instead of using the declarative link attributes of a column in a report).
    Using the pipe symbol ‘|’, I was able to take:
    http://st-curr.us.oracle.com/pls/apex/f?p=129:8::::8,CIR:IRC_ROWFILTER:Database 11g: Administration Workshop I
    and change it to:
    http://st-curr.us.oracle.com/pls/apex/f?p=129|8||||8,CIR|IRC_ROWFILTER|Database 11g: Administration Workshop I&p_sep=|
    which now works.

  • Problem with Select Filter value.......

    HI all
    We have created a report on Sales cube,and Inserted the Report into work book.
    In the report we have 2 Commission codes 1.Customer,2.material.
       when we are trying to select filter values for customer Commission code,we are Gatting the Pop-up window but the system is Getting hanged, it is not showing any values also.
       We thought it is a Bex problem, but when tried other reports it is working fine.
       Suggest me any possible solution to resolve the issue
    Thanks in advance

    Little more improvement
      After deleting and re creating the indexes, the Filter values are comming but it is taking almost 10-12 min to display the values.

Maybe you are looking for

  • Excise modvat accounts not defined for EWPO

    Dear Experts, when I click on 'Balance Choose' tab in J1IIN, it is showing an error message "Excise modvat accounts not defined for EWPO transaction and 60 excise group.Message no. 8I402" though I have maintain 'Excise account assignment table'  in "

  • Help! Warranty void, I don't know what to do!?!?!

    So after a long time of dealing with issuses with my Macbook Pro, I finally decided enough was enough and to send it in for repairs under warranty. Problems with it were as follows: Heat: At 100 percent CPU useage for both cores my computer was reach

  • Small Business Server 2011 Essentials failed lock bios on LSI MegaRaid 9260 8i on Gateway GT350 F1

    I had SBS 2011 Essentials on my Gateway GT350 F1 server setup in LSI MegaRaid 9260 8i Raid 1. I bought 2 x 900gb sas drives to replace the 2 x 300gb i have. When i try to install SBS 2011 Essentials i get a error message saying failed bios lock this

  • No more wifi detection,

    After last software update yesterday, the ATV3 would block after language question and keep repeating that screen. Tried to manually upgrade with mini USB and iTunes but no change, it stayed in a loop with that question after boot. So I installed pre

  • Dynamic Captions

    Hello, I have a text field that I want to display a caption with some built in scripting. For the Caption of the field I want to display part of the text that displays as static text in a regular format, while populating the second part of the captio