Multiple selection of parameter SQL error

Hi,
I am using BIP Enterprise stand alone, Release 10.1.3.2
I have a report with 2 parameters: salesperson and clientprospect with the 'multiple selection' and 'can select all' options turned on. My sql query is shown below.
When I run the report, here are the results with various parameter selection scenarios:
1-'all' select for both parameters = no results
2-any single value selected in both parameters = correct results
3-'all' select in one parameter and any single value selected in the other=no results
4-two or more values selected in either parameter=sql error ([Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Line 14: Incorrect syntax near ','.)
As the error message suggests, I looked at line 14, but there is no ',' on line 14.
Code
select     RCUST.customer_name as 'Customer Name',
     RCUST.customer_number as 'Customer No.',
     RCUST.branch_id as 'Branch ID',
     RCUST.salesperson as 'Salesperson ID',
Case tw_relshp_type     
WHEN 'C' THEN 'CLIENT'
WHEN 'P' THEN 'PROSPECT'
Else 'OTHER'
END AS 'Client Type'
from     dbo.TREL TREL,
     dbo.RCUST RCUST
where RCUST.customer_name=TREL.tw_relshp_name
and tw_relshp_type = :ClientProspect
and salesperson = :Salesperson
order by RCUST.branch_id ASC, RCUST.salesperson ASC, RCUST.customer_name ASC
I cannot figure why I am not getting the correct results in each of the above 4 scenarios.
I seem to be stuck. I have searched this forum by keyword 'parameter', but I did not find any solutions, hence my post. Any help would be greatly apreciated.
Thanks,
Haresh

Thanks to both of you for your prompt comments. I have tried the where...DECODE clause but I am getting the following message:
"[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]'DECODE' is not a recognized function name."
I will enter a SR in metalink. Maybe they can test and release a patch, as I suspect that this is a bug.
Haresh

Similar Messages

  • Multiple selection of parameter values (BIP 10.1.3.2)

    Hi there,
    I'm working with BI Publisher 10.1.3.2 and I'd like to use parameters allowing multiple selection. I've tried it with both data templates and SQL queries ... but I'm not getting it work ...
    I've established a simple "Show me department name and id"-example according to my parameter selection (you can select multiple values e.g. Administration, Marketing, Sales ... and the "All"-option is activated as well), based on the HR/OE schema.
    Here's just a quick note, where I tested the way the Publisher Engine copes with parameter selection in general
    5.6.2
    single selection => e.g. Administration
    multiple selection => e.g. Administration,Marketing
    All => *
    10.1.3.2
    single selection => e.g. Administration
    multiple selection => e.g. 'Administration','Marketing'
    All => null
    So, in 10.1.3.2 there's been an improvement concerning single quotes - in the case of multiple selection only. I do not know why there are no single quotes for a single selection, but it seems like that's the way it is ...
    Well, I've created a simple SQL query as follows:
    CASE 1 *
    select DEPARTMENT_ID as ID, DEPARTMENT_NAME as NAME
    from DEPARTMENTS
    where DEPARTMENT_NAME IN (:myParameter)
    => All does not work
    => Single Selection is working
    => Multiple Selection is working
    sample output in the case of selecting "Marketing" (single selection):
    <TESTINGIN>
    <myParameter>Marketing</myParameter>
    <LIST_DEPTS>
    <DEPTS>
    <_MYPARAMETER>Marketing</_MYPARAMETER>
    <ID>20</ID>
    <NAME>Marketing</NAME>
    </DEPTS>
    </LIST_DEPTS>
    </TESTINGIN>
    ... and I've tried the same select statement using a data template instead, and then I got another result: both, All and Multiple Selection, do not work (I'm getting back an empty element)
    sample (error) output in the case of selecting both "Marketing" and "Administration" (multiple selection):
    <TESTINGIN>
    <myParameter>'Administration','Marketing'</myParameter>
    <LIST_DEPTS></LIST_DEPTS>
    </TESTINGIN>
    In order to cover the "All"-case ... I manipulated my select statement as follows and used it as SQL query:
    CASE 2 *
    select DEPARTMENT_ID as ID, DEPARTMENT_NAME as NAME
    from DEPARTMENTS
    where DEPARTMENT_NAME IN (nvl(:myParameter, DEPARTMENT_NAME))
    => All is working now
    => Singe selection is working
    => Multiple selection is not working any more (ORA-00909: Ungültige Anzahl von Argumenten / illegal amount of arguments)
    ... using the same select statement within a data template, Multiple Selection is still not working (empty element)
    Last, I've tried another select statement, based on an entry of the xml publisher forum:
    CASE 3 *
    select DEPARTMENT_ID as ID, DEPARTMENT_NAME as NAME
    from DEPARTMENTS
    where DEPARTMENT_NAME IN (:myParameter) or :myParameter IS NULL
    => All is working
    => Singe selection is working
    => Multiple selection is not working (ORA-00920: Ungültiger relationaler Operator / illegal relational operator)
    So, I couldn't find a way that all three possibilities are working ... and using data templates, multiple selection never worked. If I hardcoded the where clause in the data template,
    e.g. where DEPARTMENT_NAME IN ('Administration','Marketing'), it worked fine (no matter, whether I place the sql statement within an CDATA section, or not).
    Can anyone tell me, what I'm doing wrong here?
    While testing my problem, I figured out that there's a difference of generated parameter output ... I just put the parameter in the select list, and depending on whether you use SQL query or data template, you'll get different results:
    SQL statement
    => for each parameter value an own parameter
    <_MYPARAMETER>Administration</_MYPARAMETER> in the case of single selection
    <_MYPARAMETER8093>Administration</_MYPARAMETER8093>
    <_MYPARAMETER8094>Marketing</_MYPARAMETER8094> in the case of multiple selection
    data Template
    => list of parameter values
    <_MYPARAMETER>Administration</_MYPARAMETER> in the case of single selection
    <_MYPARAMETER>'Administration','Marketing'</_MYPARAMETER> in the case of multiple selection
    Maybe that's the problem? I don't know, this difference how the Publisher Engine copes with parameters just attracted attention to me ...
    Alright, I hope it was not too confusing. I would appreciate any help, since here @ the customer's site we need to use data templates inclduing multiple selection in order to establish a context for VPD.
    The problems in summary:
    - how to write a select statement to include all three possibilites of parameter selection (single selection, multiple selection, All option)
    - multiple selection never worked using data templates
    Can someone help me here?

    hi,
    i think you have to use lexical parameters and a package, like this:
    <dataTemplate name="departments" dataSourceRef="hr@demo" defaultPackage="bip_departments">
    <parameters>
    <parameter name="p_location_id" include_in_output="false" datatype="float"/>
    </parameters>
    <dataTrigger name="beforeReport" source="bip_departments.beforeReportTrigger"/>
    <dataQuery>
    <sqlStatement name="Q1">
    <![CDATA[ select d.department_id, d.department_name, d.location_id
                      from departments d
                     &p_where_clause
                order by location_id, department_id]]>
    </sqlStatement>
    </dataQuery>
    <dataStructure>
    <group name="LOC" source="Q1">
    <element name="location_id" value="location_id"/>
    <group name="DEPT" source="Q1">
    <element name="department_id" value="department_id"/>
    <element name="department_name" value="department_name"/>
    </group>
    </group>
    </dataStructure>
    </dataTemplate>
    with package:
    create or replace package bip_departments
    as
    p_location_id long;
    p_where_clause long;
    function beforereporttrigger
    return boolean;
    end bip_departments;
    create or replace package body bip_departments
    as
    function beforereporttrigger
    return boolean
    is
    l_return boolean := true;
    begin
    if (p_location_id is not null)
    then
    p_where_clause := 'where (d.location_id in (' || replace (p_location_id, '''') || '))';
    else
    p_where_clause := 'where 1=1';
    end if;
    return (l_return);
    end beforereporttrigger;
    end bip_departments;

  • Setting current values in Multiple Select List in SQL Query based Report

    Hi,
    I have a report based on a sql query that contains a multiple select list. Unfortunately I cannot get the multiple select list to display the current values (p_value) correctly. I have created a page item, :p311_current_versions, that is set using a pre-header process and it returns a value with a colon delimited format e.g. '10.1.2.1.0:10.1.2.2.0'. Then this item is used in the sql query to set the current value (p_value) of the apex_item.select_list_from_query function. However when the table is displayed, instead of having two entries, 10.1.2.1.0 and 10.1.2.2.0 selected, it has an extra entry '10.1.2.1.0:10.1.2.2.0' selected.
    Here is my code:
    select distinct a.product, a.version from (
    select distinct
    apex_item.display_and_save(2,product)||apex_item.hidden(1,env_product_id) PRODUCT,
    APEX_ITEM.SELECT_LIST_FROM_QUERY(3,decode(product, 'HTTP Server' , :p311_current_versions, version), 'SELECT distinct version d, version r FROM ebs_tech_stack where
    product ='''||PRODUCT||'''',
    decode(PRODUCT, 'HTTP Server' ,'multiple="multiple" style="width:170px"','style="width:170px"'),
    'NO') as version
    from ebs_environment_tech_stack
    where environment_id = :p311_umgebung_id) a order by a.product
    If anyone can help me figure out how to set the current values correctly I'd be really grateful!!
    Thanks in advance,
    Jean

    Jean,
    I don't think this is possible using the apex_item package. The select_list_from_query function accepts only a single value for the second parameter.
    Scott

  • Scheduled Report - Bug with Multiple Selection LOV parameter

    Problem:
    I have a scheduled report with a parameter that has it's "Multiple Selection" checkbox checked. I schedule the report with multiple values selected. When I receive the report via email, the report ran as if I only selected one LOV value instead of multiple values.
    Facts:
    1) Enterprise version 10.1.3.2.1
    2) When you run the report manually with multiple values selected in the LOV, it runs great with the correct dataset.
    3) This scheduled report does not have a Data Template.
    James
    P.S. - I searched this forum for other treads on this issue. I didn't find any. Sorry if this is a duplicate.

    I have this same problem, too.
    When I select multiple parameters on the "View" screen for a given report, everything works fine.
    When I schedule it, however, only the last parameter I clicked on (regardless of whether a select a range or multiple individual values) is passed to the query. The other selections I make are ignored.
    What gives? Am I doing something wrong? Is this a bug? Is there a workaround?

  • Selected Query Parameter backend error

    Hi, experts,
         I am having some backend error whenever I add a parameter to the Selected Query Parameter to the ValueHelpQuery of an OVS.
         Can anybody please tell me why it is happening?
         Any help is needed and highly appreciated.
    Regards,
    May T.

    Hi, Horst,
    Thanks, I understand it.   
    I did not bind that N_AccountUUID with nothing else. Do I have to?
    I always add a new field to the SearchParameters and than I bind it in the Selected Query Parameters.
    I don't bind it with anything else.
    Is that a problem?
    I just bound it with my BO data field and it shows "The data field is bound to query parameter".
    Regards,
    May T.

  • Hide multiple selection of parameter related to Standard Report Category.

    Hi,
    I have created the report program with the logical database PNPCE , report category HRF_PNOC having PNPPERNR in the selection screen With Multiple selection. I want to hide the multiple selection button  for this PNPPERNR in the selection screen.
    For example: we hide the multiple selection button in report program with the no-extension. The syntax for no-extension is shown below 
    select-options : p_kunnr for kna1-kunnr no-extension.
    Can any one help me out of this?
    Thank You,
    Swetha.C
    Edited by: Swetha Chevuru on Oct 28, 2011 12:22 PM

    Hi,
    Please see the below blog for detailed description of the problem that i am facing now
    http://swethacblog.blogspot.com/2011/10/how-to-hide-multiple-selection-button.html#!/2011/10/how-to-hide-multiple-selection-button.html
    Thank You,
    Swetha.C

  • WD application-selection screen - Parameter passing error

    Hi,
    In my WD application selection screen I am using a parameter(COSP-VERSN)
    When i read this using read context i am getting an error saying "Could not find attribute KOKRS"
    In context I have created a node with COSP-VERSN. My Kokrs will be contstant everytime.
    For getting my version I need to pass KOKRS values.How can overcome this issue?
    Here is the read context for versn which I have created in context Create-> NODE Option
    DATA lo_nd_pversn TYPE REF TO if_wd_context_node.
          DATA lo_el_pversn TYPE REF TO if_wd_context_element.
          DATA ls_pversn TYPE wd_this->element_pversn.
    *     navigate from <CONTEXT> to <PVERSN> via lead selection
          lo_nd_pversn = wd_context->get_child_node( name = wd_this->wdctx_pversn ).
    *     get element via lead selection
          lo_el_pversn = lo_nd_pversn->get_element(  ).
    *     get all declared attributes
          lo_el_pversn->get_static_attributes(
            IMPORTING
              static_attributes = ls_pversn ).
    Rgds
    Vara

    Resolved myself by creating a custom Dropdownbykey.
    Rgds
    vara

  • Multiple Selections Disabled after validation

    Hi experts ,
    Couldsomebody please correct me on this :-
    I have a validation check for a select-option with NO Intervals.
    Any incorrect value in the Select option then an error message pops up . Now if there are multiple values in the Selct-option multiple selection then also the error popos up showing the wrong entires . But  when i try to change again i.e click on multiple selection then it doesnot allow the user to enter and correct those entries.
    Could you please let me know the best posible way to check teh above scenario ?
    Thanks
    Kylietisha

    Easy fix would be to remove the EL from the property. This makes the button accessible at all times.
    I guess the problem is that after the validation error you have to resubmit the data to make the commit button enable again. Try adding a button which doesn'T have an action or actionListener define on the page. After a validation error and the error is corrected click the new button and see if this enables the commit button again.
    Timo

  • Passing multiple select value from BI publisher to PL/SQL functions

    Hi - I have designed a report which pass parameters (Multi select) into a function to get the output result. When a single parameter value is passed to the function, report is being displayed. When multi select value is passed to the function it is returning the error `wrong number or types of arguments in call to 'F_PROCESS_WAVE_DATA'. When i checked the parameters passed to the function, i can see each multi select value is treated as different value and is assigned to different parameter in the function.
    Any help on passing the multi select parameter into function will be helpful.
    Regards,
    Vikram.

    All - Issue was resolved. I followed the following steps to resolve the issue
    1. Create a PL/SQL table type variable as VARCHAR2 in the database - Say as Larray
    2. Create PL/SQL type record and table for the record in database. Lrec, Ltable
    3. In BI report pass multiple select LOV variable as Larray(variable).
    4. In DB function, Parameter should be defined as LARRAY.
    5. Return PL/SQL table type Ltable from the function.
    Regards,
    Vikram.

  • Use a multiple selection parameter in the data model

    Hi
    i have created a parameter with the property multiple selection.
    This parameter i use in the Data Model where area,
    if i just mark one value the report works well if i mark more the one
    the report run into a error.
    WHERE PSNR IN :ma
    the xdo looks like
    <?xml version = '1.0' encoding = 'utf-8'?>
    <report version="1.1" xmlns="http://xmlns.oracle.com/oxp/xmlp" defaultDataSourceRef="tisoware">
    <title>BDE Nettozeit</title>
    <properties>
    <property name="showControls" value="true"/>
    <property name="online" value="true"/>
    <property name="parameterColumns" value="2"/>
    <property name="openLinkInNewWindow" value="true"/>
    </properties>
    <dataModel defaultDataSet="BDERUECK">
    <dataSet id="BDERUECK">
    <sql dataSourceRef="tisoware">
    <![CDATA[SELECT (SUBSTR(DATUM,1,6)) AS DATUM, SUM(NTTOZEIT) AS ZEIT,
    TRUNC(SUM(NTTOZEIT)/60) AS STUNDE
    FROM BDERUECK
    WHERE (DATUM  >= :datev) AND (DATUM <= :dateb) AND (KZDELETE = 'N') AND FIRMA = '1' AND ((PSNR IN :ma))
    GROUP BY (SUBSTR(DATUM,1,6))]]>
    </sql>
    <input id="datev" value="${datev}" dataType="xsd:string"/>
    <input id="dateb" value="${dateb}" dataType="xsd:string"/>
    <input id="ma" value="${ma}" dataType="xsd:string"/>
    </dataSet>
    </dataModel>
    <valueSets>
    <valueSet id="date">
    <sql dataSourceRef="tisoware">
    <![CDATA[SELECT DISTINCT DATUM
    FROM BDERUECK]]>
    </sql>
    </valueSet>
    <valueSet id="employee">
    <sql dataSourceRef="tisoware">
    <![CDATA[select      PERSTAMM.PSPERSNR as PSPERSNR,
          PERSTAMM.PSNR as PSNR
    from      TISOWARE.PERSTAMM PERSTAMM
    where    PERSTAMM.FIRMA = '1'
    order by PERSTAMM.PSPERSNR]]>
    </sql>
    </valueSet>
    </valueSets>
    <parameters>
    <parameter id="datev" defaultValue="20050103">
    <select label="Datum von : " valueSet="date" multiple="false" all="false" refreshParameters="false"/>
    </parameter>
    <parameter id="dateb" defaultValue="20060930">
    <select label="Datum bis : " valueSet="date" multiple="false" all="false"/>
    </parameter>
    <parameter id="ma" defaultValue="152">
    <select label="Mitarbeiter : " valueSet="employee" multiple="true" all="false"/>
    </parameter>
    </parameters>
    <templates default="BDE Nettozeit">
    <template label="BDE Nettozeit" type="rtf" url="BDE Nettozeit.rtf"/>
    </templates>
    </report>

    Alex,
    the missing thing in your example is the fact, that if only one value is selected, the parameter has exact this value like BOSTON. If you choose more than one value, the parameter includes the *'*, so that it looks like *'BOSTON','NEW YORK'*. So you need to check in the package, if there's a *,* in the parameter or not. If yes there's more than one value, if not it's only one value or it's null.
    So change your package to (you need to expand your variables)
    create or replace package bip_departments_2_parameters
    as
    p_dep_2_param varchar2(1000);
    p_loc_1_param varchar2(1000);
    p_where_clause varchar2(1000);
    function beforereporttrigger
    return boolean;
    end bip_departments_2_parameters;
    create or replace package body bip_departments_2_parameters
    as
    function beforereporttrigger
    return boolean
    is
    l_return boolean := true;
    begin
    p_where_clause := ' ';
    if p_dep_2_param is not null then
    if instr(p_dep_2_param,',')>0 then
    p_where_clause := 'WHERE DNAME in ('||p_dep_2_param||')';
    else
    p_where_clause := 'WHERE DNAME = '''||p_dep_2_param||'''';
    end if;
    if p_loc_1_param is not null then
    if instr(p_loc_1_param,',')>0 then
    p_where_clause := p_where_clause || ' AND LOC IN ('||p_loc_1_param||')';
    else
    p_where_clause := p_where_clause || ' AND LOC = '''||p_loc_1_param||'''';
    end if;
    end if;
    else
    if p_loc_1_param is not null then
    if instr(p_loc_1_param,',')>0 then
    p_where_clause := p_where_clause || 'WHERE LOC in ('||p_loc_1_param||')';
    else
    p_where_clause := p_where_clause || 'WHERE LOC = '''||p_loc_1_param||'''';
    end if;
    end if;
    end if;
    return (l_return);
    end beforereporttrigger;
    end bip_departments_2_parameters;
    I've written a similar example at http://www.oracle.com/global/de/community/bip/tipps/Dynamische_Queries/index.html ... but it's in german.
    Regards
    Rainer

  • Can I make the parameter supports multiple selection and editable at the same time?

    Hi, 
    I am building my report using SQL Server Report builder 3.0. All the parameters are added to the report
    by the builder. When the user access the report by browser, he can change the parameter value and click "view report" button to load the report from the database.
    For one of the parameter, I want to provide user the ability to select frequently used value as multiple
    selection, and meanwhile let them able to edit the value if the preloaded selection doesn't contain what he wants.
    Is it possible to archive this goal using report builder?
    Thanks!

    You cant have this functionality using standard report viewer. An approximate work around can be implemented as follows.
    Have two parameters one based on your current parameter values (dropdown) and another one without any available values set and default set to NULL (Set Allow Null value property and pass Null as default value). This parameter will appear as disabled textbox
    with NULL checkbox checked. 
    Now in your code behind which gives you first parameter's values Add one more value say <None Of Values> and set value as some default value (-1 if int or just a random string value).
    Now in the value for second parameter set a expression like below
    =IIF(Parameters!FirstParam.Value ="<Select None>","",Nothing)
    This will make sure second parameter gets activated when you select option <none> from first. Then you can type the value you want in it
    In query behind just make filter like below
    WHERE field = CASE WHEN @Param1 <> '<None>' THEN @Param1 ELSE @Param2 END
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • USING MULTIPLE SELECT VARIABLE IN A SQL STATEMENT

    In HTMLDB, the value of the parameter of a multiple select box is colon delimited(ie P6_Name = Smith:Jones:Burke). Is there an easy way to use this parameter in a SQL statement?
    Example
    Select *
    from names
    where
    Name=P6_Name
    Select *
    from names
    where
    Name IN ('Smith','Jones','Burke')
    Thank you

    Thank you for your response! I'm an idiot. It didn't make sense to me because your talking about a <i>multi-select</i> variable and I was thinking about a <i>select-list</i> variable. My problem is that I need to assign a list of values to one select list item.
    <br>
    For example:
    <br>
    SELECT * FROM EMPLOYEE
    WHERE EMPLOYEE_TYPE IN ( :SELECT_LIST_RETURN_VALUE );
    <br><br>
    With the select list as
    <br><br>
    Display value = All Types, Some Types, One Specific Type<br>
    Return Value = (Type1, type2, type3), (type1, type2), (type3)
    <br><br>
    I've just started in all of this so I'd imagine that I'm probably going about it wrong.

  • SQL Command code for multiple value string parameter

    Hi,
    I'm using crystal 2008 and there is a check box for multiple value  SQL Command  I need some help in writing the SQL Command code  for oracle (or sql server) for a multiple value STRING  parameter.
    Thanks in advance,
    Marilyn

    I could be wrong here, but I do not believe you can pass a multiple valued parameter to an SQL Command data source.  How I have gotten around this in the past is to put the "real" report into a subreport.  In the main report, create a formula field (basic syntax):
    formula = join({?parameter}, "|")
    Then, use this to pass the selected values to the subreport's parameter (call it {?sr-parm}).  The SQL Command in the subreport can then use that (MS SQL):
    select *
    from table
    where charindex(table.field, '{?sr-parm}') > 0
    HTH,
    Carl

  • Multiple Default Values in a Multi-Select LOV Parameter?

    Hi,
    I have a report in BI Publisher standalone version 10.1.3.4. The report has a list of values called org_lov. This lov is attached to a multi-selection p_org_code parameter from which it is desirable to also have multiple default values.
    For example, if org_lov has the following values:
    100
    101
    102
    103
    104
    105
    106
    I would like to have 3 default values and have 100, 101,105 as the defaults if the user doesn't specifically select anything from the LOV. So far my testing has only allowed a single default value.
    Here are my settings:
    Data type = string
    Multiple Selection = checked
    Can select All = checked (all values passed)
    On the Default Value field, I have tried the following:
    1. 100, 101,105
    2. [100, 101,105]
    3. '100', '101','105'
    4. (100, 101,105)
    5. ['100', '101','105']
    6. ('100', '101','105')
    I don't need these default values highlighted in the LOV, I just need it passed correctly to the query (a data template).
    Thank you in advance for any input.

    Hi,
    Sorry for the delayed reply. I tried what you suggested but the problem is that by having the "Multiple Selection" property of the parameter unchecked, the result is that it allows the user to only have a single value passed. The user wants the option to select multiple values AND also have the multiple default values.
    Thanks anyway.

  • How to set billing doc parameter for multiple selection ?????

    Hi all,
    Output for Billing
    VF31, SD70AV3A
    i would like to add ‘Multiple selection’ to the Billing Document parameter.  multiple Currently, it would only give data for one of the documents in the selection.
    According to me the billing parameter can be changed for multiple selection, need your suggestion for how to proceed with this..
    Thx in adv
    Megha

    VF31 <b>does</b> have multiple selection option for Billing document, at least in my world (4.7).

Maybe you are looking for