Passing multiple parameter to where condition

Hi all,
I want to pass multiple parameters to where condition.. it is as follows:
i'll pass only TODAY date to M_DATE_TO variable.
CURSOR C_COUNT(M_DATE_FROM  DATE, M_DATE_TO  DATE) IS
SELECT COUNT (*)
FROM table_name
WHERE   TRUNC(table_name.join_date) BETWEEN M_DATE_FROM AND M_DATE_TO;
begin
  SELECT TRUNC(LAST_DAY(ADD_MONTHS(:REP_VALUE_4,-1)))+1 INTO M_FIRST_DATE_MONTH FROM DUAL;
  SELECT TRUNC(:REP_VALUE_4, 'YEAR') INTO M_FIRST_DATE_YEAR FROM DUAL;
  SELECT TRUNC(ADD_MONTHS(:REP_VALUE_4,-12)) M_SAME_DATE_PYR FROM DUAL;
  SELECT TRUNC(LAST_DAY(ADD_MONTHS(:REP_VALUE_4,-13)))+1 INTO M_FIRST_DATE_MONTH_PYR FROM DUAL;
  SELECT ADD_MONTHS(TRUNC(:REP_VALUE_4,'YEAR'), -12) INTO M_FIRST_DAY_PYR FROM DUAL;
  M_DATE_FROM:=M_FIRST_DATE_MONTH;
  M_DATE_TO := TODAY;
  IF C_COUNT%ISOPEN THEN
  CLOSE C_COUNT;
  END IF;
  OPEN C_COUNT (M_DATE_FROM,M_DATE_TO);
  FETCH C_COUNT INTO M_COUNT_MTD;
  CLOSE C_COUNT;
  :cp_count_mtd:=m_count_mtd;
M_DATE_FROM:=M_FIRST_DATE_YEAR;
M_DATE_TO:= TODAY;
  IF C_COUNT%ISOPEN THEN
  CLOSE C_COUNT;
  END IF;
  OPEN C_COUNT (M_DATE_FROM,M_DATE_TO);
  FETCH C_COUNT INTO M_COUNT_YTD;
  CLOSE C_COUNT;
  :cp_count_ytd:=m_count_ytd;
M_DATE_FROM:=M_FIRST_DATE_MONTH_PYR;
M_DATE_TO:= M_FIRST_DAY_PYR;
  IF C_COUNT%ISOPEN THEN
  CLOSE C_COUNT;
  END IF;
OPEN C_COUNT (M_DATE_FROM,M_DATE_TO);
  FETCH C_COUNT INTO M_COUNT_MTD_PYR;
  CLOSE C_COUNT;
  :cp_count_ytd_pyr :=m_count_ytd;
Is there any easy way or other method, Please help me...Thanks in advance.
Regi

Thanks Roberto for reply.
Please find the screenprint as per your suggestion. Also I have mentioned the code in above question. We are using the stored procedure to write the value into a table , passed from front end. We are able to write the value passed from front end into a table. So it means that system is passing the value.
But when I try to bring same value into the data task flow , system is throwing a error. The description of error is also mentioned below.
Kindly advise.
Error Description in DM package:
Description = Executing the query "exec dbo.sp_ver_copy2 'Account'" failed with the following error: "An error occurred while extracting the result into a variable of type (DBTYPE_STR)". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

Similar Messages

  • How to Pass multiple parameter into single store procedure

    How to Pass multiple parameter into single store procedure
    like a one to many relationship.
    it is possible then reply me immediatly

    you mean like this .....
    CREATE OR REPLACE procedure display_me(in_param in varchar2,in_default in varchar2 := 'Default') is
    BEGIN
    DBMS_OUTPUT.put_line ('Values is .....'||in_param || '....'||in_default);
    END display_me;
    CREATE OR REPLACE procedure display_me_2 as
    cnt integer :=0;
    BEGIN
    For c1_rec In (SELECT empno,deptno FROM test_emp) Loop
         display_me(in_param => c1_rec.empno);
         cnt := cnt+1;
         end loop;
         DBMS_OUTPUT.put_line('Total record count is ....'||cnt);
    END display_me_2;
    SQL > exec display_me_2
    Values is .....9999....Default
    Values is .....4567....Default
    Values is .....2345....Default
    Values is .....7369....Default
    Values is .....7499....Default
    Values is .....7521....Default
    Values is .....7566....Default
    Values is .....7654....Default
    Values is .....7698....Default
    Values is .....7782....Default
    Values is .....7788....Default
    Values is .....7839....Default
    Values is .....7844....Default
    Values is .....7876....Default
    Values is .....7900....Default
    Values is .....7902....Default
    Values is .....7934....Default
    Values is .....1234....Default
    Total record count is ....18

  • How can i pass input date parameter in where condition in exec_sql.parse

    EXEC_SQL.PARSE(source_connid, source_cursor,'SELECT substr(empid,3,6) ,
    attdate ,
    to_char(intime1,''HH24MI'') ,
    nvl(to_char(outtime2,''HH24MI''),nvl(to_char(intime2,''hh24mi''),nvl(to_char(outtime1,''hh24mi''),null))) ,
    ''G'' ,
    null ,
    null ,
    55
    FROM ' || source_table||'
    WHERE attdate = '||:control_main.input_dt);
    when i gave this input_dt the output is zero.
    without this where condition i am getting records.
    its urgent,please help me in this.
    Edited by: saru on Jan 12, 2009 2:06 AM
    Edited by: saru on Jan 12, 2009 2:53 AM

    I guess you have a problem with your formats...
    try this:
    [...]WHERE attdate = to_date('''||to_char(:control_main.input_dt,'dd.mm.yyyy')||''', ''dd.mm.yyyy'')[...]regards

  • How to Pass Multiple Parameter to Discoverer Custom Folder Created in Admin

    Hi,
    I have done as describe in doc id (metalink) note 304192.1 and it's ok.
    Now, my scope is to use the parameter declared in SETPARAMS not with the "=" condition but with "IN CLAUSE" (multipe values).
    for example (SQL Inspector):
    SELECT i106116 as E106116,i106117 as E106117,SUM(i106118) as E106118_SUM
    FROM ( SELECT DS_COMMESSA AS i106116, DS_SCENARIO AS i106117, DS_VALUE AS i106118 FROM (select ds_commessa, ds_scenario, DS_VALUE
    from dw_ods.ods_mbo_commessa
    where DS_TIPO_COSTO='COSTI MEDI'
    and ds_label='DIR'
    and cd_scenario in (1,2)
    and ds_commessa IN DW_ODS.SETPARAM.GET_PARAM1
    union all
    select 'Totale' as ds_commessa, ds_scenario, sum(DS_VALUE)
    from dw_ods.ods_mbo_commessa
    where DS_TIPO_COSTO='COSTI MEDI'
    and ds_label='DIR'
    and cd_scenario in (1)
    and ds_commessa IN DW_ODS.SETPARAM.GET_PARAM1
    group by ds_scenario
    ) CUO106102 ) o106102
    WHERE (1 IN (DW_ODS.SETPARAM.SET_PARAM1(:"Commessa")))
    GROUP BY i106116, i106117;
    where the parameter "commessa" is used with "IN" operator.
    Also tried to modifiy the SET_PARAM1 and GET_PARAM1 in order to use a "table of varchar2" ... but with no succes.
    Help please

    Rod,
    for the first "problem" I find the solution on metalink (note 304192.1) and works fine (also combining SET and GET together)... otherwise I don't know how use this "workaround"...
    for the multiple values on a single parameter (for example: Month='Jan,'Feb') I have tried to understand how DISCO pass these values to the SET function (I suppose like an array of varchar2) but don't work. After the first values (Jan) the reports stop... The problem in not how stored the values but understan how DISCO "pass/manage" these values (Jan,Feb)... Can u help me?
    my actual SETPARAMS package body is (like metalink):
    CREATE OR REPLACE PACKAGE BODY SETPARAM AS
    FUNCTION SET_PARAM1(P1 IN VARCHAR2) RETURN NUMBER IS
    BEGIN
    param1 := P1;
    return 1;
    END;
    FUNCTION GET_PARAM1 RETURN VARCHAR2 AS
    BEGIN
    return param1;
    END;
    FUNCTION SET_PARAM_MBO(p_anno IN VARCHAR2) RETURN NUMBER IS
    BEGIN
    anno := p_anno;
    return 1;
    END;
    FUNCTION GET_PARAM_MBO RETURN VARCHAR2 AS
    BEGIN
    return anno;
    END;
    END SETPARAM;
    ----------------------------------------------------------------------

  • Passing multiple parameter values to a detail report.  How?

    Help!
    I have a Summary report and a Detail report.
    Summary report has a parameter that may have multiple values (ie returning an array).
    I need to pass these values to the Detail report.
    Anybody has managed to do it?
    Thanks in advance...
    Inga

    Thank you for your reply Sunil...
    The problem is as follows:
    I have a report portlet that has a parameter with multiple values. Ie I would have two status values passed into this Summary report that shows, say total sum for those statuses. I have a link from this report to a detail report, and i need to pass both of these values into the detail report.
    I have tried adding a parameter (p_status_param) in the SQL query that would be a part of link by building it in "PL/SQL after header section" and doing the parameter replace.
    SQL query:
    select
    '<a href="./RTS.RPT_OPEN_CALLS_BY_ASSIGNEE_01.SHOW?p_arg_names=p_assigned_user_id&p_arg_values='||cr.assigned_user_id||''||:p_status_param||'''><font class=portletText1>'||s.user_name||'</font></a>' full_name,
      cr.assigned_user_id,
      count(*) total_calls
    from 
      trts_call_request cr,
      trts_security s
    where
      cr.assigned_user_id = s.user_id
      and cr.current_status_id in :p_status
      and cr.assigned_user_id in :p_assigned_user_id)
    group by
      s.user_name,
      assigned_user_id
    PL/SQL:
    declare
        v_return    varchar2(32767) := '';
    begin
        for i in 1..l_arg_names.count loop
            if l_arg_names(i) = p_reference_path||'.p_status' then
                v_return := v_return || '&p_arg_names=p_status&p_arg_values='||l_arg_values(i);
            end if;
        end loop;
         myats30.wwv_name_value.replace_value(l_arg_names, l_arg_values, 'p_status_param',myats30.wwv_standard_util.string_to_table2(v_return) );
    htp.p(v_return);
    end;
    However, when you run the report, this is what you get (see what the parameter has been replaced with):
    ORA-00907: missing right parenthesis (WWV-11230)
    Failed to parse as RTS - select '<a href=./RTS.RPT_OPEN_CALLS_BY_ASSIGNEE_01.SHOW?p_arg_names=p_assigned_user_id&p_arg_values='||cr.assigned_user_id||''|| ( :zz21, :zz22, :zz23 ) _param||''"><font class=portletText1>'||s.user_name||'</font></a>' full_name, cr.assigned_user_id, count(*) total_calls from trts_call_request cr, trts_security s where cr.assigned_user_id = s.user_id and cr.current_status_id in ( :zz21, :zz22, :zz23 ) and cr.assigned_user_id in :p_assigned_user_id) group by s.user_name, assigned_user_id order by ASSIGNED_USER_ID ASC (WWV-08300)
    Any ideas how I could build this link programatically???
    Thank you...

  • What value we need to pass as parameter in where clause in select query

    Hi ALL,
    I have written following query, it was executing fine and returning me all the rows with search criteria.
    SELECT *
    FROM
    PRTY_RQST PR
    JOIN BUSN_APPLC BIAP ON BIAP.BUSN_APPLC_ID = PR.BUSN_APPLC_ID
    JOIN INTN_STATS INSTS ON INSTS.INTN_STATS_ID = PR.INTN_STATS_ID
    JOIN INTN_PROCES_TYP INTPTY ON INTPTY.INTN_PROCES_TYP_ID = PR.INTN_PROCES_TYP_ID
    LEFT JOIN RQST_TYP RQSTYP ON RQSTYP.RQST_TYP_ID = PR.RQST_TYP_ID
    JOIN ADDTN_RQST_INFO ADTINF ON PR.PRTY_RQST_ID = ADTINF.PRTY_RQST_ID
    JOIN ADDTN_INFO_KEY_TYP ADDKEY ON ADTINF.ADDTN_INFO_KEY_TYP_ID = ADDKEY.ADDTN_INFO_KEY_TYP_ID
    JOIN PRTY_KEY PRTKEY ON PR.PRTY_RQST_ID = PRTKEY.PRTY_RQST_ID
    JOIN PRTY_KEY_TYP PRKYTP ON PRTKEY.PRTY_KEY_TYP_ID = PRKYTP.PRTY_KEY_TYP_ID
    WHERE (BIAP.BUSN_APPLC_NM = 'bpel')
    AND (INTPTY.INTN_PROCES_TYP_NM = 'FulfillmentOrder')
    AND (PR.UPDT_BY = 'update3')
    AND (INSTS.INTN_STATS_NM = 'Submitted')
    AND (PR.CHLD_RQST_IND = 'N')
    AND (PR.TRACK_RQST_IND = 'Y')
    AND (RQSTYP.RQST_TYP_NM = 'PensionPortfolioRebalance')
    AND (RQSTYP.RQST_CLASS_NM = 'Composite')
    AND (PRKYTP.PRTY_KEY_TYP_NM = 'NPIN')
    AND (PRTKEY.PRTY_TYP_VAL = '101101' )
    AND (ADDKEY.ADDTN_INFO_KEY_TYP_NM = 'PlanNumber')
    AND (ADTINF.ADDTN_RQST_TYP_VALUE = 'TBMBUpdated');
    My question here is i don't want pass the value for BIAP.BUSN_APPLC_NM, still want to get the values for remaing conditions. what value i need to pass here.
    I tried Null it giving me no rows. can some one help me on this.
    Thank you in advance.
    Vijay

    933325 wrote:
    thank you,
    since it is search criteria. I have to use OR instead of AND. this resolved my problem.
    SELECT *
    FROM
    PRTY_RQST PR
    JOIN BUSN_APPLC BIAP ON BIAP.BUSN_APPLC_ID = PR.BUSN_APPLC_ID
    JOIN INTN_STATS INSTS ON INSTS.INTN_STATS_ID = PR.INTN_STATS_ID
    JOIN INTN_PROCES_TYP INTPTY ON INTPTY.INTN_PROCES_TYP_ID = PR.INTN_PROCES_TYP_ID
    LEFT JOIN RQST_TYP RQSTYP ON RQSTYP.RQST_TYP_ID = PR.RQST_TYP_ID
    JOIN ADDTN_RQST_INFO ADTINF ON PR.PRTY_RQST_ID = ADTINF.PRTY_RQST_ID
    JOIN ADDTN_INFO_KEY_TYP ADDKEY ON ADTINF.ADDTN_INFO_KEY_TYP_ID = ADDKEY.ADDTN_INFO_KEY_TYP_ID
    JOIN PRTY_KEY PRTKEY ON PR.PRTY_RQST_ID = PRTKEY.PRTY_RQST_ID
    JOIN PRTY_KEY_TYP PRKYTP ON PRTKEY.PRTY_KEY_TYP_ID = PRKYTP.PRTY_KEY_TYP_ID
    WHERE (BIAP.BUSN_APPLC_NM = null )
    OR (INTPTY.INTN_PROCES_TYP_NM = 'FulfillmentOrder')
    OR (PR.UPDT_BY = 'update3')
    OR (INSTS.INTN_STATS_NM = 'Submitted')
    OR (PR.CHLD_RQST_IND = 'N')
    OR (PR.TRACK_RQST_IND = 'Y')
    OR (RQSTYP.RQST_TYP_NM = 'PensionPortfolioRebalance')
    OR (RQSTYP.RQST_CLASS_NM = 'Composite')
    OR (PRKYTP.PRTY_KEY_TYP_NM = 'NPIN')
    OR (PRTKEY.PRTY_TYP_VAL = '101101' )
    OR (ADDKEY.ADDTN_INFO_KEY_TYP_NM = 'PlanNumber')
    OR (ADTINF.ADDTN_RQST_TYP_VALUE = 'TBMBUpdated');
    AND (ADTINF.ADDTN_RQST_TYP_VAL_DT ='06-JUN-12 04.18.56.000000000 PM')
    AND (ADTINF.ADDTN_RQST_TYP_VAL_NUM ='123123') ;
    once again thank you all.But that's a completely different query than what was in the original post

  • Multiple rows in WHERE condition

    Hi all,
      I am having 2 column in XL sheet with more than 10000 column.
    like
    Location       DocNo
      India             1
     US                  1
    i need to get more details based on Locaation and Docno
    select Location,Docno,Customer,CustomerId
    where location='India' and Docno=1
    How can i do it for 10000 rows,manually i cant give. If i give Where  location code in('all location') and docno in('All docno')
    it will give cartesian result right..
    How to do it pls .
    Thanks - SelvaKumarSubramaniam.Please MARK AS ANSWER, if my answer is useful to U.

    I am not only having locationcode as India,have 100 different location also.
    Thanks - SelvaKumarSubramaniam.Please MARK AS ANSWER, if my answer is useful to U.
    I really doubt, I understood your question...
    You can do as below:
    Select * from  Tablename  where locationcode in('India','US') and CustomerNo in (256,984,854)
    Or if you want all data just select without any filter.
    Select * from  Tablename  

  • Passing multiple parameter to SSIS package via data manager

    Hi
    We are trying to pass parameters from data manager to SSIS package. We are trying to give option of selecting members from Dimension using SelectInput while modifying script.
    But we are not able to catch the values in SSIS package.
    Code in Data manager package:
    (ON)
    (SELECTINPUT,%VER%,,"Select Account",%ACCOUNT_DIM%)
    (Execute sp_ver_copy,SqlStatementSource,exec dbo.sp_ver_copy2 '%VER%')
    We also tried with writing GLOBAL(VER,%VER%) instead of -- (Execute sp_ver_copy,SqlStatementSource,exec dbo.sp_ver_copy2 '%VER%')
    But that also dosent work.
    We need to use the parameters passed, in SQL code that we have written in OLE DB source, under data flow task.
    Any help is appreciated.
    Thanks in advance

    Thanks Roberto for reply.
    Please find the screenprint as per your suggestion. Also I have mentioned the code in above question. We are using the stored procedure to write the value into a table , passed from front end. We are able to write the value passed from front end into a table. So it means that system is passing the value.
    But when I try to bring same value into the data task flow , system is throwing a error. The description of error is also mentioned below.
    Kindly advise.
    Error Description in DM package:
    Description = Executing the query "exec dbo.sp_ver_copy2 'Account'" failed with the following error: "An error occurred while extracting the result into a variable of type (DBTYPE_STR)". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

  • How can i pass multiple values by a single variable to EXECUTE IMMEDIATE

    Hi All,
    I want to pass multiple values for where condition for execute immediate. Something Like this:-
    bold
    Declare
    v_cond varchar(1000);
    Begin
    v_cond := '''INR','USD'''; --(OPTION 1)
    v_cond := 'INR,USD'; --(OPTION 2)
    EXECUTE IMMEDIATE 'Delete from table where colm in (:v_cond)' using v_cond;
    END;
    bold
    I am using this into a procedure
    Now option 1 gives an error ie a syntax error (; expected or something like that)(I am sorry, i can't tell the exact error here as i am not in the office right now)
    and option 2 makes the procedure execute but obviously doesn't delete the records, as it takes the whole as one.
    Please Help
    Regards
    Neeraj Bansal

    See the links containing examples under
    *7. List of values in an IN clause?*
    SQL and PL/SQL FAQ
    from the SQL and PL/SQL FAQ.

  • Passing the column name on Where condition based on input parameter

    Hi,
    I am using Oracle10g. Following are my table schema.
    Table Name : Codes
    Columns( ID, Level0, Level1,Level2)
    View Name : SampleView
    I have a scenario : A parameter will be passed to my view from C# application. I need to cut the last 4 places of the parameter and need to check 4 conditions as follows :
    1. IF last 4 places of parameter contains the value as "AMPD" then pass level0 column on where condition.
    Sample code : A123XPAMPD
    Expeted Result: Select * from Codes where Level0 ='A123XPAMPD'
    2. IF last 4 places of parameter contains the value as "Alpha numeric" then pass level1 column on where condition.
    Sample code : A123XPAA00
    Expeted Result: Select * from Codes where Level1 ='A123XPAA00'
    3. IF last 4 places of parameter contains the value as 0000 then pass level1 column on where condition.
    Sample code : A123XP0000
    Expeted Result: Select * from Codes where Level1 ='A123XP0000'
    4. IF last 4 places of parameter contains the value as (cannot be all 0's) and cannot contain "Alphabets" then pass level2 column on where condition.
    Sample code : A123XP1001
    Expeted Result: Select * from Codes where Level2 ='A123XP1001'
    Could any one please help me on writing this logic inside the view.
    Thanks in advance.

    Do you want to make sure that at least one alphabet and one number is there?
    select case
         when regexp_like('1111','^[a-zA-Z]+$') -"This says - Only alphabets, not even space
              THEN 'Alphabets'
         when regexp_like('1111','^[a-zA-Z0-9]*$') --"This says - Only alpha-numeric, not even space
          and regexp_like('1111','[a-zA-Z]') --"To make sure atleast one alphabet is there
          and regexp_like('1111','[0-9]') --"To make sure atleast one number is there
              THEN 'AlphaNumeric'
           else 'NULL' --"This is a string. Not actual NULL
          end
    from dual;
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How can I pass multiple condition in where clause with the join table?

    Hi:
    I need to collect several inputs at run time, and query the record according to the input.
    How can I pass multiple conditions in where clause with the join table?
    Thanks in advance for any help.
    Regards,
    TD

    If you are using SQL-Plus or Reports you can use lexical parameters like:
    SELECT * FROM emp &condition;
    When you run the query it will ask for value of condition and you can enter what every you want. Here is a really fun query:
    SELECT &columns FROM &tables &condition;
    But if you are using Forms. Then you have to change the condition by SET_BLOCK_PROPERTY.
    Best of luck!

  • Multiple where conditions in one parameter

    Hi,
    Is it possible to have more than one where condition in one parameter?
    For example, my WHERE_CLAUSE parameter holds the value "where id='12345' and name='john smith'"
    when i run the report, I get a [052008_033528064][][EXCEPTION] java.lang.NullPointerException at oracle.apps.xdo.dataengine.DataTemplateParser.getObjectVlaue(Unknown
    Source) Thus the sql statement did not execute.
    But if I change the WHERE_CLAUSE to "where id='12345'" or "where name='john smith'" it works fine.
    My observation is that if there are two where conditions, BI publisher wont allow it. Am I correct?
    But the report has to be open to the possibility of having more than one where clause condition. Is there a work around for this?
    Thanks,
    Shanak

    nope your mistaken. bip will handle multiple joins.
    1. make sure the where_clause parameter is defined in your package.
    2. make sure use & syntax
    3. make sure your sql is not malformed. This is probably the issue.
    4. also, read my article on bind variables. the practice of coding the actual value in a where clause should be avoided at all costs. Causes the query execution plan to be reparsed each time that particular query is executed.
    http://bipublisher.blogspot.com/2007/10/bi-publisher-what-lexical-understanding.html
    Ike Wiggins
    http://bipublisher.blogspot.com/

  • CASE Statement in Where Condition with Multi Valued parameter in SSRS

    Hi All,
    I am little confused while using CASE statement in Where condition in SSRS. Below is my scenario:
    SELECT
    Logic here
    WHERE
    Date IN (@Date)AND
    (CASE
    WHEN NAME LIKE 'ABC%' THEN 'GROUP1'
    WHEN ID IN ('123456', '823423','74233784') THEN 'GROUP2'
    WHEN ABC_ID IS NULL THEN 'GROUP3'
    ELSE 'GROUP4'
    END ) IN (@GROUP)
    So above query uses WHERE condition with CASE statement from @GROUP parameter. I want to pass this parameter as multi- valued parameter and hence I have used CASE statement IN (@GROUP).
    For @Date one dataset will pass the available and default values and
    for @GROUP parameters, another dataset will pass the available and default values.
    But this is not working as expected. Please suggest me where I am making mistake in the query.
    Maruthu | http://sharepoint-works.blogspot.com

    Hi Maruthu,
    According to your description, I create a sample report in my local environment. It works as I expected. In your scenario, if the selected values from the Date parameter contains some of the Date field values, the selected values from the GROUP parameter
    contains some of GROUPS (‘GROUP1’,’GROUP2’,’GROUP3’,’GROUP4’) and the corresponding when statement is executed , then the dataset returns the corresponding values.
    In order to trouble shoot this issue, could you tell us what results are you get and what’s your desired results? If possible, you can post the sample data with sample dataset, then we can make further analysis and help you out.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Any way to pass Multiple Values for a single Label in the Parameter?

    I have a Report that Contains 2 Parameters, @Customer & @Area. When trying to set up the Available Values for @Area, I'm having issues using multiple values for one Label, i.e. = "4006" Or "4610"
    One of the Filters in the Report is an Operation number, which is the [OPERATION] field, which is setup as a filter on the Tablix referencing the @Area parameter. 
    PROBLEM: I cannot retrieve any data when trying to use the ‘Or’ Operator here. If I simply put “4006” or “4610” I retrieve data, but when trying to combine it returns no data.
    Example, I need to allow a user to select ‘Chassis Incoming’, which would include data from Operations 4006 & 4610.
    QUESTION:
    Any way to pass Multiple Values for a single Label in the Parameter?
    I realize the typical solution may be to use ‘Multi-Value’ selection, but in this case we want the User to select the Area and the multiple values for Filtering will be automatically determined for them. Otherwise, they are subject to not getting
    it correct.
    I have tried several different ways, such as =”4006” Or “4610”, =(“4006”, “4610”), = In(“4006”, “4610”), etc….
    Note: We are using Report Builder 3.0

    Based on my experience, there's no way to 'intercept' the query that gets passed back to SQL Server, so a Split wouldn't work.
    Try creating either a function or stored procedure using the code below (compliments to
    http://www.dotnetspider.com/resources/4680-Parse-comma-separated-string-SQL.aspx) to parse the string: 
    CREATE FUNCTION dbo.Parse(@Array VARCHAR(1000), @Separator VARCHAR(10))
    RETURNS @ResultTable TABLE (ParseValue VARCHAR(100))AS
    BEGIN
    DECLARE @SeparatorPosition INT
    DECLARE @ArrayValue VARCHAR(1000)
    SET @Array = @Array + @Separator
    WHILE PATINDEX('%' + @Separator + '%' , @Array) <> 0
    BEGIN
    SELECT @SeparatorPosition = PATINDEX('%' + @Separator + '%', @Array)
    SELECT @ArrayValue = LEFT(@Array, @SeparatorPosition - 1)
    INSERT @ResultTable VALUES (CAST(@ArrayValue AS VARCHAR))
    SELECT @Array = STUFF(@Array, 1, @SeparatorPosition, '')
    END
    RETURN
    END
    Once created you can do things like this:
    SELECT * FROM Parse('John,Bill,David,Thomas', ',')
    SELECT * FROM (SELECT 'John' AS TestName union select 'David' AS TestName) AS Main
    WHERE TestName IN (SELECT ParseValue FROM dbo.Parse('John,Bill,David,Thomas', ','))
    This is what your SQL query would probably look like:
    SELECT OperationID, OperationName FROM dbo.Operations
    WHERE AreaID IN (SELECT ParseValue FROM dbo.Parse(@Area, ','))
    You may need to fiddle around with the Separator depending on whether SQL Server inserts a space between the comma and next value.

  • Passing multiple values to the QUERY BDOC parameter?

    hi All,
    Below is my Query BDOC Anchor Before Query Execute even handler... I'm trying to pass multiple values to the         bq.Z_PartnerFunction query parameter... i.e. 
    PARTNER_FCT in( '00000012','ZDIVMGR','ZAREADR')
    is it possible without creating new Query Bdoc ?
    ====================================
    Private Sub aempchoicewinTCWSearchTAnchor_beforeQueryExecute(ByRef bq As BusinessQuery, ByRef cancel As Boolean)
    If Not bq Is Nothing Then
            If sWcDummy = "Yes" Then
                    bq.WcDummy = sWcDummy
            End If
            bq.Z_PartnerFunction = "00000012"
            If ctrlZ_Territory.Value <> "" Then
                 bq.PRNB_TerrID = "*" & ctrlZ_Territory.Value
            End If
    End If
    End Sub
    ================================
    Thanks in advance
    Hetal

    Hi,
    it looks that you already enhanced the query BDoc because you have a new query parameter bq.Z_PartnerFunction, right?
    To which BDoc parameter is this BQ parameter mapped? And how looks the related where clause?
    For a single filter normally a "=" operator is used. Therefore your example with "in" won't work.
    If these three partner functions are fixed then you might hardcoded them directly in the where clause (supposed the BDoc is not used somewhere else where you don't want to have this filter).
    Or you might add 3 new BDoc parameters, add 3 new where clauses using a disjunction for them (and using an embracing bracket). In this case always all these 3 BQ parameters need to be filled (or all stay empty) to avoid a SQL syntax error.
    Regards,
    Wolfhard

Maybe you are looking for

  • Posting invoices in F-43 where items have different VAT codes

    Hi, I am not sure whether I am in the correct forum so just boot me into the correct one if I guessed incorrectly. I have to start by saying I have almost no FI knowledge and it seems no-one in the business has enough FI applications knowledge. I am

  • Cncltion of partial line items in the MBST is notopening the linkeddel line

    Hi, We are posting the GR with 503 mvt type with ref to delivery.  In this process when some of the line items have to be returned, we are posting MBST against those line items. To cancel / reverse the same in delivery using VL09, system (does not re

  • Lenovo Thinkpad T410 got errors with Fingerprint sensor device! So frustrating!

    I have just bought a new Lenovo Thinkpad T410 2518-FAA from one of main agencies of Lenovo in my country. The new-buy laptop was said to be totally new, i.e. it was not a re-furbished, and I actually checked for manything to confirm the real status o

  • CANNOT SYNC HELP

    I am trying to sync to my outlook 2007 and it is not working. I am really frustrated - what is the point if you can not sync the data? I have office 2007, and windows XP sp3. I need this to work please help.

  • Where is backup located ?

    Anyone know where a Mac stores the iPhone backup? I'd like to back it up to a cd if I happen to have to restore my Mac on a future date. Also, where does a Mac store the restore iPhone program it downloads when restoring the iPhone for the very first