Duplicate Parameter Values in Report (SSAS as a Source)

I am creating a report using an SSAS Cube as the source. Within the report I'm displaying the following values:
Month
Year
District
City
Street
Total Requests
As part of this report, I'd like to provide a drop down parameter for users to select the "District" value. However, when I create the @District parameter, in the preview pane it shows duplicate values (i.e. valid values for District are 1-9, with
multiple cities assigned to each district. My drop down displays the value "1" several times, one per each city, and so on and so forth).
What I'd like to do is only display the distinct values of District in my parameter drop down. I've read through previous forum posts where it suggests creating a separate query to select the distinct values from the table, however the syntax for those posts
appears to be specific to database connections but not SSAS. (i.e. syntax given was Select DISTINCT column FROM table). This syntax doesn't appear to work with SSAS Cubes.
Could someone please offer some assistance on how I can extract the distinct values for District? Thank you in advance.

Hi Gaur,
Could you assist me with the syntax of the Distinct expression please? In the example given on technet, there is a set defined, however in my case I'm using the dimension attribute as my source. For instance, if my dimension is called "LOCATION" and my attribute
is "District", would it just be "Select DISTINCT [LOCATION].[DISTRICT] from [CUBE]?
Thanks again for your help!

Similar Messages

  • How to get parameter value from report in event of value-request?

    Hi everyone,
    The customer want to use particular F4 help on report, but some input value before press enter key are not used in event of "at selection-screen on value-request for xxx", How to get parameter value in this event?
    many thanks!
    Jack

    You probably want to look at function module DYNP_VALUES_READ to allow you to read the values of the other screen fields during the F4 event... below is a simple demo of this - when you press F4 the value from the p_field is read and returned in the p_desc field.
    Jonathan
    report zlocal_jc_sdn_f4_value_read.
    parameters:
      p_field(10)           type c obligatory,  "field with F4
      p_desc(40)            type c lower case.
    at selection-screen output.
      perform lock_p_desc_field.
    at selection-screen on value-request for p_field.
      perform f4_field.
    *&      Form  f4_field
    form f4_field.
    *" Quick demo custom pick list...
      data:
        l_desc             like p_desc,
        l_dyname           like d020s-prog,
        l_dynumb           like d020s-dnum,
        ls_dynpfields      like dynpread,
        lt_dynpfields      like dynpread occurs 10.
      l_dynumb = sy-dynnr.
      l_dyname = sy-repid.
    *" Read screen value of P_FIELD
      ls_dynpfields-fieldname  = 'P_FIELD'.
      append ls_dynpfields to lt_dynpfields.
      call function 'DYNP_VALUES_READ'
        exporting
          dyname     = l_dyname
          dynumb     = l_dynumb
        tables
          dynpfields = lt_dynpfields
        exceptions
          others     = 1.
      check sy-subrc is initial.
    *" See what user typed in P_FIELD:
      read table lt_dynpfields into ls_dynpfields
        with key fieldname = 'P_FIELD'.
    *" normally you would then build your own search list
    *" based on value of P_FIELD and call F4IF_INT_TABLE_VALUE_REQUEST
    *" but this is just a demo of writing back to the screen...
    *" so just put the value from p_field into P_DESC plus some text...
      concatenate 'This is a description for' ls_dynpfields-fieldvalue
        into l_desc separated by space.
    *" Pop a variable value back into screen
      clear: ls_dynpfields.
      ls_dynpfields-fieldname  = 'P_DESC'.
      ls_dynpfields-fieldvalue = l_desc.
      append ls_dynpfields to lt_dynpfields.
      call function 'DYNP_VALUES_UPDATE'
        exporting
          dyname     = l_dyname
          dynumb     = l_dynumb
        tables
          dynpfields = lt_dynpfields
        exceptions
          others     = 0.
    endform.                                                    "f4_field
    *&      Form  lock_p_desc_field
    form lock_p_desc_field.
    *" Make P_DESC into a display field
      loop at screen.
        if screen-name = 'P_DESC'.
          screen-input = '0'.
          modify screen.
          exit.
        endif.
      endloop.
    endform.                    "lock_p_desc_field

  • Retruning parameter/value from report to form - (Urgent)

    Hi ,
    I am calling a report (2.5) from a form using RUN_PRODUCT. I would like to know if there is any way to do the following.
    (a) Return a value from reports to calling form. For ex. I would like to know the last Item name (assuming the reports prints all items in inventory) printed. I am sending a from and to numbers of item id's (range) and I need to know the last item printed.
    (b). Check the success of report. For example, while printing the 5 items (the range that I passed) if there is any error in printing , this should be tracked either in the form or report. If this is not possible using run_product , If I need to use srw package, how to use it. Can I call the report as usual with run_product and in the after parameter trigger can, I call the report again and track error.
    Any help will be appreciated.
    Thanks

    Please repost your question in the reports forum

  • Print Multiple Parameter Value in Crystal Report 2008

    Hello and Hi
    i want to select multiple warehouse  in a pramater , i select and report working but parameter print only first parameter  value on report.how can print all selected values on report

    Hi
    I am assuming you select warehouses  WH1,WH2,WH3,.......
    You have to create a formula in Crystal
    It should look like this
    Join({?YourParamaterName},",")
    Place the formula on your report.
    The last Part of the formula is the "notation break"  between every parameter returned. In this case a >   ,   <
    Return would be WH1,WH2,WH3,.......
    Join({?YourParamaterName},"#")  would return  WH1#WH2#WH3#.......
    Hope you get the idea
    If this solution helps, please rate me.
    Regards
    Burger

  • Sub report linking definition based on result, not on parameter value

    Dear all,
    I have created a report with CR 2008 SP6. The parameters from the referring BI query are period and customer. After the user enter parameter values, the report provides then Customer and product information.
    I have add a sub report with additional information for product. I can transfer the parameter value (user input) for Customer to the sub report, but not for product, due to the fact that in the main report Product is not selected as parameter, but is a result set after the report is executed.
    Is there a way to define in the Sub report linking exactly these result values of Product as new parameter for the sub report.
    In the sub report linking definition I only see the possibility of defining the parameter as linking object, but not the report result set. See also the screenshot.
    Any idea would be great. Best regards,
    Stefanos from Munich/Germany

    Hi Stefanos,
    Where is the Subreport placed on the report?
    Do you have a prompt in the Subreport for 'product'?
    If yes, then here's open the 'Change Subreport Links' window > Move the Product field to the Pane on the right > From the drop down at the bottom left that says 'Subreport parameter field to use', choose the Product prompt.
    If you don't have a prompt for product in the Subreport, then just move the Product field to the Pane on the right > From the drop down at the bottom right that says 'Select data in Subreport based on field', choose the Product field from the drop-down.
    -Abhilash

  • Even with parameters, reports reading entire data source and then filtering

    I'm working with an Oracle database (read-only access) and Crystal Reports 2008.  I have created a report and added three parameters for which I have already done all necessary steps in the select expert.  But when I do a Print preview of the report, and after selecting the parameter values, the report tries to read all of the data source records before the parameters are utilized by the report.  In other words, if the data source has 100,000 records, the report will return (in the background) all 100,000 records and then filter among these returned records to present/display the data according to the provided parameter values.  Instead, I would like it to use the parameters first so that only those records that meet the parameter value criteria are read into the report from the "get go"...Since I only have read only access to the Oracle database, I cannot write a stored procedure either...(company policy)...Can parameters be used to read in only pertaining records instead of filtering already read in records in a given report?  Is there some syntax that can be entered into a Command type connection to do this?

    I've tried that but I'm now getting an error on line 6...
    Crystal Reports Error:
    Failed to retrieve data from the database.
    Details: HYooo:[Oracle][ODBC][Ora]ORA-00911: invalid character
    ORA-06512: at line 6
    [Database Vendor Code: 911 ]
    for the following syntax: (Not sure why...any help would be extremely appreciated!)
    DECLARE
    varCCN CHAR(7);
    varMASLOC char(3);
    varWO char(10);
    BEGIN
    EXECUTE IMMEDIATE '
    SELECT Trim(DB.D_WO.SERIAL) AS Serial,
    Trim(DB.WO.WO_NUM) AS WO,
    DB.WO.WO_LINE AS Line,
    DB.WO_HDR.WO_DESCRIPTION,
    DB.WO.ITEM,
    DB.WO.REVISION,
    CASE WHEN DB.WO.ITEM=' || '''\''' || 'THEN DB.WONSD.DESC_ ELSE DB.ITEM.DESCRIPTION END AS Item_Description,
    DB.WO.ORD_QTY,
    DB.WO.START_DATE,
    DB.WO.DUE_DATE,
    DB.WO_RTG.OPERATION,
    DB.D_OPERNM.D_OPER_NUM_SEQ,
    DB.WC.DESCRIPTION AS WC_Description,
    DB.WO.CCN,
    DB.WO.MAS_LOC,
    DB.D_WKINST.D_WORK_INSTRUCTION,
    DB.D_WORTG.NA_OPER,
    DB.D_WORTG.D_OPER_GROUP,
    DB.GLOVCLB.CONTENT,
    DB.D_WOHDR.D_J_MACHINE,
    DB.D_WOHDR.D_H_MACHINE,
    DB.D_WOHDR.D_STD_ASSEMBLY,
    DB.D_WOHDR.D_T_C_A_ASSEMBLY,
    DB.D_WOHDR.D_T_C_B_ASSEMBLY,
    DB.D_WOHDR.D_B_S_ASSEMBLY
    FROM DB.WO_HDR
    LEFT JOIN DB.WO
    ON DB.WO_HDR.CCN = DB.WO.CCN
    AND DB.WO_HDR.MAS_LOC = DB.WO.MAS_LOC
    AND DB.WO_HDR.WO_NUM = DB.WO.WO_NUM 
    LEFT JOIN DB.D_WO
    ON DB.WO.WO_LINE = DB.D_WO.WO_LINE
    AND DB.WO.WO_NUM = DB.D_WO.WO_NUM
    AND DB.WO.MAS_LOC = DB.D_WO.MAS_LOC
    AND DB.WO.CCN = DB.D_WO.CCN
    LEFT JOIN DB.WONSD
    ON DB.WO.WO_LINE = DB.WONSD.WO_LINE
    AND DB.WO.WO_NUM = DB.WONSD.WO_NUM
    AND DB.WO.MAS_LOC = DB.WONSD.MAS_LOC
    AND DB.WO.CCN = DB.WONSD.CCN
    LEFT JOIN DB.ITEM
    ON DB.WO.REVISION = DB.ITEM.REVISION
    AND DB.WO.ITEM = DB.ITEM.ITEM
    LEFT JOIN DB.WO_RTG
    ON DB.WO.WO_LINE = DB.WO_RTG.WO_LINE
    AND DB.WO.WO_NUM = DB.WO_RTG.WO_NUM
    AND DB.WO.MAS_LOC = DB.WO_RTG.MAS_LOC
    AND DB.WO.CCN = DB.WO_RTG.CCN
    LEFT JOIN DB.D_WORTG
    ON DB.WO_RTG.OPERATION = DB.D_WORTG.OPERATION
    AND DB.WO_RTG.WO_LINE = DB.D_WORTG.WO_LINE
    AND DB.WO_RTG.WO_NUM = DB.D_WORTG.WO_NUM
    AND DB.WO_RTG.MAS_LOC = DB.D_WORTG.MAS_LOC
    AND DB.WO_RTG.CCN = DB.D_WORTG.CCN
    LEFT JOIN DB.WC
    ON DB.WO_RTG.WC = DB.WC.WC
    AND DB.WO_RTG.CCN = DB.WC.CCN
    LEFT JOIN DB.D_OPERNM
    ON DB.WO_RTG.OPERATION = DB.D_OPERNM.OPERATION
    AND DB.WO_RTG.WO_LINE = DB.D_OPERNM.WO_LINE
    AND DB.WO_RTG.WO_NUM = DB.D_OPERNM.WO_NUM
    AND DB.WO_RTG.MAS_LOC = DB.D_OPERNM.MAS_LOC
    AND DB.WO_RTG.CCN = DB.D_OPERNM.CCN
    LEFT JOIN DB.D_WKINST
    ON DB.D_WORTG.D_WORK_INSTRUCTION = DB.D_WKINST.D_WORK_INSTRUCTION
    LEFT JOIN DB.WOLN_TXT
    ON DB.WO.WO_LINE = DB.WOLN_TXT.WO_LINE
    AND DB.WO.WO_NUM = DB.WOLN_TXT.WO_NUM
    AND DB.WO.MAS_LOC = DB.WOLN_TXT.MAS_LOC
    AND DB.WO.CCN = DB.WOLN_TXT.CCN
    LEFT JOIN DB.GLOVCLB
    ON DB.WOLN_TXT.OBJECT_ID = DB.GLOVCLB.OBJECT_ID
    LEFT JOIN DB.D_WOHDR
    ON DB.WO.CCN = DB.D_WOHDR.CCN
    AND DB.WO.MAS_LOC = DB.D_WOHDR.MAS_LOC
    AND DB.WO.WO_NUM = DB.D_WOHDR.WO_NUM
    WHERE DB.WO_HDR.CCN=' || varCCN || ';
    AND DB.WO_HDR.MAS_LOC=' || varMASLOC || ';
    AND TRIM(DB.WO_HDR.WO_NUM)=' || varWO || ';';
    END;
    Edited by: lirizarry on Nov 6, 2009 4:37 PM

  • SSRS Report date parameter values using SSAS Cube as datasource

    Hey Guys, 
    i m building an SSRS report using SSAS cube as the data source. The report contains shared data-sets which provide the required data. below is the set up.
    Sql server version : Sql server 2008R2
    Report builder 3.0 
    I have, Report A, powered by Dataset D, running on Cube C. The dataset has 3 parameters out of which one of them is a date parameter- P1. I have it set up such that on the report there is  another parameter - P2 which contains the type as Date ( to
    ensure the user is exposed to a date picker), the input from this, P2 is then manipulated to required format before fed into the dataset parameter P1 (hidden). I have two questions regarding this parameter.
    Currently, when the user pick's a date (P2) which has no values, the report errors out as it doesn't find that corresponding member on the cube. Can it be made such that if the member doesn't exists, a simple error message like "date not found"
    pops up as opposed to report failing?
    Secondly, can i manipulate the date picker (P2) exposed to the user such that the unavailable dates are grey'ed out on the date parameter (P2)? 
    Please let me know if there is any more info required on each of the questions.
    Thanks
    Srikanth

    Hello Katherine,
    below are the errors which pop up with the 'Constrained' function in place and without. The MDX query is what follows.
    Without: 
    An Error has occurred during report processing. (rsProcessingAborted). The Execution Failed for the shared data set “Dataset1”.(rsDataSetExecutionError). Query Execution failed for dataset ‘DataSet1’. (rsErrorExecutingCommand). The dimension ‘[10 Sep 2014]’
    was not found in the cube when the string, [10 Sep 2014], was parsed.
    With Constrained flag:
    An Error has occurred during report processing. (rsProcessingAborted). The Execution Failed for the shared data set “Dataset1”.(rsDataSetExecutionError). Query Execution failed for dataset ‘DataSet1’. (rsErrorExecutingCommand). Query(1,1476) The restrictions
    imposed by the CONSTRAINED flag in the STRTOSET function were violated.
    SELECT
    NON EMPTY
    [Measures].[A]
    ,[Measures].[B]
    ,[Measures].[C]
    ,[Measures].[D]
    ,[Measures].[E]
    } ON COLUMNS
    ,NON EMPTY
    [DimA].[LevelA].[LevelA].ALLMEMBERS*
    [DimB].[LevelB].[LevelB].ALLMEMBERS*
    [Date].[Date].[Date].ALLMEMBERS
    DIMENSION PROPERTIES
    MEMBER_CAPTION
    ,MEMBER_UNIQUE_NAME
    ON ROWS
    FROM
    SELECT
    StrToSet (@FilterA ,CONSTRAINED) ON COLUMNS
    FROM
    SELECT
    StrToSet(@Date, CONSTRAINED) ON COLUMNS
    FROM [Cube1]
    WHERE
    [DimC].[Level1].&[Member1]
    ,[DimC].[Level2].&[Member1]
    ,[DimC].[Level3].&[Member1]
    ,[DimC].[Level4].&[Member1]
    Thanks
    Srikanth

  • Parameter weirdness: Report not using user selected parameter value

    I am writing my first report and cannot for the life of me figure out how to deal with this issue.
    When I call a report and pass the parameters in, it appears that the user cannot then change the parameter values and run the report again even though the parameters are displayed. When user hits run report, the values revert to what was passed in by original
    call.
    Scenario
    Report B has Parameter Period : Month, Quarter, Year displayed in a drop down list.
    Report A calls Report B and passes it the parameter: Quarter.
    Report B loads. User now changes parameter to Year via the drop down parameter list and hits Run Report.
    Instead of loading the report with user selected value (Year), it reverts back to the parameter it was called with, Quarter.
    I have tried changing the refresh option on the parameter to always, but no joy.
    The only way that seems to work is to put textboxes on the report to change the parameter.
    How can I stop this behaviour, and use the users new selection. 
    This should be really straight forward, and its driving me nuts that its not allowing the user to change the parameters
    Any help would be much appreciated.
    Thanks Jon

    Hi Jon,
    Did you use SSRS 2012? Based on my test, the issue is occurred in SSRS 2012 Business Intelligence Development Studio (BIDS). When we deploy the report to report server, it will disappear.
    In this situation, we can add another duplicate parameter to work around this issue. Please add two parameters in the report, and then hide one of the parameter. We can pass the parameter value to the hide parameter. If we want to select other values, we
    can change the visible parameter values.
    Alternatively, I recommend you that submit this suggestion at
    https://connect.microsoft.com/SQLServer/. If the suggestion mentioned by customers for many times, the product team may consider to add the feature in the next SQL Server version. Your feedback is valuable for us to improve our products and increase the
    level of service provided.
    Regards,
    Alisa Tang
    Alisa Tang
    TechNet Community Support

  • Crystal Reports 9 and SQL Server 2005 default parameter values

    We're using Crystal Reports 9 and upgraded from SQL Server 2000 to SQL Server 2005.
    I'm noticing a very weird problem which I wonder if anyone else has experienced (and hopefully found a resolution for). It appears that in using Crystal with SQL Server 2005 stored procedures, if we have default parameter values in the stored procedures, the default parameter values get completely ignored if you pass in a NULL value from Crystal!
    For example, if you have a stored procedure that begins like this:
    ALTER          Procedure [dbo].[StoredProcedure]
    @Param1 VarChar(200) = '',
    @Param2 VarChar(200) = ''
    AS ...
    both @Param1 and @Param2 have a default value of an empty string, and therefore should become empty strings if nothing (NULL values) gets passed in for them.
    But, like I said, what I'm finding is that with Crystal calling the stored procedure with NULL @Param1 and @Param2 values, they never become empty strings, but rather remain as NULLs.
    This was never a problem with SQL 2000.
    Very perplexing. Anyone else every experience this?
    Thank you.

    Please ignore my earlier post -- answered my own question.
    NULL parameter values do not get replaced by default values in SQL -- that is normal behavior in both SQL 2000 and SQL 2005. Just goes to show, that no many how many years programming experience you have, you can still get tripped up sometimes : (

  • Report parameter value in RTF

    Hi ALL,
    I have a XML report having 3 parameter, i need to capture the value of those parameter in my RTF and based on that i need to do some validation.
    so how to get parameter value in RTF.
    Please help me on this.
    Thanks

    not clear what do you want
    first of all what's your architecture of your report?
    - parameters from ebs?
    - datatemplate?
    - package?
    >
    so how to get parameter value in RTF.
    >
    for datatemplate try
    <parameters>
    <parameter name="P_YOUR_PARAM" dataType = "number" defaultValue="0"></parameter>
    </parameters>
    <dataStructure>
    <element name="ITEM_PARAM"  dataType="varchar2" value="your_package.get_YOUR_PARAM"/>
    </dataStructure>in package "your_package"
    function get_YOUR_PARAM
    return P_YOUR_PARAM;
    end;i need to capture the value of those parameter in my RTF and based on that i need to do some validation.
    >
    validation in package or in rtf template?
    you can get all report parameters by package and use any complex logic for create result xml for template

  • Report based on parameter values

    Morning all,
    I have to create a report which includes Account Number, Account Name, Sales prices. There has to be two optional parameters, Account number (Static) and Product Description (Dynamic).
    I have setup the report with Account Number (Grouped), Account Name. The report works fine, when a user selects a particular account number, the report produces fine.
    Things I would like to do and know about:
    1: when it comes to sales price, it should reflect to what user has selected under Product Description parameter.
    for example if the user has selected Supra, Supra KNT, Rimless, Metal etc from the description parameter, the report should only show those selected prices according to the account number (showing descriptive field value).
    2: Additionally, if user chooses all of the options from the drop down menu (multiple selection dexcription parameter) then the report should show all the prices according to the description (showing the description field value).
    The problem in this case which I think would be is because the description values are quite alot, I mean more than 25 values and if a user selects multiple values, lets say all, how would Crystal adjust that into a report?
    Example of a report
    Parameters
    =============
    Account Number:
    Description: Supra, Supra KNT, Metal, Plastic, Rimless, Rimless KNT (multiple selection)
    Report Layout
    ============
    Account Number --- Account Name --- Supra - Supra KNT - Metal - Plastic - Rimless - Rimless KNT
    (Where Supra to Rimless KNT options are chosen by Descriptive parameter value - if not chosen then report will only show account number and account name).
    If however only Supra is selected then the report would look like this
    Report Layout
    ============
    Account Number --- Account Name --- Supra
    Any ideas how to achieve this kind of report? I have setup the report in a landscape so that we can fit as many description values as possible but I only managed to show 9, rest goes over the page.
    The report in the end has to be exported to excel so I don't mind if it goes over a page.
    Regards
    Jehanzeb

    Jehanzeb,
    You do want to use cross tabs...
    Have your database query produce a table with the following columns:
    Account Info (Number & Name)
    Product Description
    Sales
    e.g.,
    Select AcctNo + " - " + AcctName as AcctInfo,
       ProdDesc,
       sum(Sales) as Sales
    from SalesTable
    group by AcctNo, AcctName, ProdDesc
    Then use record selection to limit the data to the selected products.
    Yes, the layout of a cross tab is a bit strange, in that the design of the cross tab only shows one column for the data, but the table will expand with the underlying data.  If 4 products are selected, there will be 4 columns of sales numbers.  When setting up the cross tab, make the AcctInfo field the row header, and the ProdDesc field the column header, and the Sales field the table cell value.
    HTH,
    Carl

  • Retrieve All records and display in Report using CAML query in Report Builder if Parameter value is blank

    Hello Experts,
    i have created a report where i have one parameter field where user will pass parameter(e.g. EmpId). As per parameter record will fetched to report if no parameter is passed then it will display all records. I have done it by taking SqlServer Database as datasource.
    by using Following method
    Now i would like to do it by taking Sharepoint List as Datasource. For that what would be the CAML Query.
    Here is my existing CAML query.
    <RSSharePointList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <ListName>Employees</ListName>
      <ViewFields>
        <FieldRef Name="Title" />
        <FieldRef Name="FirstName" />
        <FieldRef Name="LastName" />
        <FieldRef Name="FullName" />
        <FieldRef Name="UserName" />
        <FieldRef Name="Company" />
      </ViewFields>
      <Query>
        <Where>  
    <Eq> 
        <FieldRef Name="Title" />
      <Value Type="Text">    
       <Parameter Name="EmployeeId"/>    
    </Value>
    </Eq>                  
        </Where>
      </Query>
    </RSSharePointList>
    The above code is working if i am passing an employeeId to Parameter. If nothing is passed, it is Not retrieving any record.
    Please suggest
    Thank you
    saroj
    saroj

    Your problem follows the well-established pattern of using an "All" parameter filter in SSRS. There are a few approaches depending on the size of your data. The easiest one is to return all data from CAML and then filter it within SSRS, the following thread
    provides some examples,
    http://stackoverflow.com/questions/18203317/show-all-records-some-records-based-on-parameter-value.
    Other options include passing all of the possible values within the CAML query when "All" is selected, using multiple Report Files to distinguish between both CAML queries, or to use multiple datasets with some logic to show/hide the correct one.
    Dimitri Ayrapetov (MCSE: SharePoint)

  • Printing parameter values in xml report, and displaying it in header of the

    Hi All,
    Can anybody give me an idea to print the parameter values in the xml report.
    My requirement is like, I have 10 parameters in report builder, I have generated the xml file and created the .rtf template and finally registerted in oracle apps. But now, the requirement is to print the parameter values in the report output.I don't see any xml tags in the xml output.
    Any suggestion will be appreciated.
    Thanks in advance.

    I think all the XML attributes can contain lexicals. If you bring up the property palette against the report object you can just set the following:
    XML Tag Attributes: myParameter="&<P_1>"
    where P_1 is your user parameter.

  • Crystal Report Viewer 11.5 Java SDK - How to set sub report parameter value

    Good day!
    I have a report with 3 sub-reports in the detail section. Main report has two parameters and each sub-report has one parameter in turn. We have our own JSP to receive parameter values from the user. I am using the following code to do the parameter value setting later into the report. Parameter value setting works for main report, but not for the sub-report.
    I get an Error, for the first sub-report, from the viewer saying:
    The parameter 'parametername' does not allow null values
    On this article: [article link|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bi/sap%28bd1lbizjptawmq==%29/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233313337333233323331%7D.do]
    It says to set the report name of the parameter field to the name of the sub report. On this aspect, assuming this tip/solution works, I would like to read the names of the sub-reports and their parameter names. I do not want to hard-code them into our application.
    Here is my current code:
    sdk.occa.report.data.Fields parameterFields = new Fields();
    I have a HashMap of <parameterName, parameterValue>
    Iterate through the map
    report.data.ParameterField aParameterField = new ParameterField();
    aParameterField.setReportName(""); //main report
    report.data.Values theValues = new Values();
    ParameterFieldDiscreteValue aParameterFieldDiscreteValue = new ParameterFieldDiscreteValue();
    aParameterFieldDiscreteValue.setValue (aValue);
    theValues.add(aParameterFieldDiscreteValue);
    aParameterField.setName(parameterName)
    aParameterField.setCurrentValues(theValues);
    parameterFields.add(aParameterField);
    viewer.setParameterFields(parameterFields);
    Please look at the line:
    aParameterField.setReportName(""); //main report
    Here's where I would like to say
    if (parameter is subreport's parameter) then setReportName(subreport name);
    Thx

    It was little difficult to navigate down the objects to find the sub reports and their parameters. I am attaching the code:
    May be there are other ways to do the same.
    public String getReportNameForParameter (String parameterName, ReportClientDocument reportClientDoc)
            String result = "";
            boolean found = false;
            try {
                SubreportController src = reportClientDoc.getSubreportController();
                DataDefController ddc = reportClientDoc.getDataDefController();
                IDataDefinition idd = ddc.getDataDefinition();
                Fields fs = idd.getParameterFields();
                Iterator fiter = fs.iterator();
                while (fiter.hasNext()) {
                    IField ifld = (IField) fiter.next();
                    if (parameterName.equals(ifld.getName())) {
                        found = true;
                    //System.out.println ("\t Field Name/Description/HeadingText: " + ifld.getName() + "/" + ifld.getDescription() + "/" + ifld.getHeadingText());
                if (!found) {
                    IStrings reportNames = src.getSubreportNames();
                    //System.out.println ("  Sub Reports If Any ...");
                    if (reportNames != null) {
                        Iterator iter = reportNames.iterator();
                        while (iter.hasNext()) {
                            String repName = (String) iter.next();
                            //System.out.println ("\t Sub Report Name " + repName);
                            ISubreportClientDocument srcd = src.getSubreport(repName);
                            ddc = srcd.getDataDefController();
                            idd = ddc.getDataDefinition();
                            fs = idd.getParameterFields();
                            fiter = fs.iterator();
                            while (fiter.hasNext()) {
                                IField ifld = (IField) fiter.next();
                                if (parameterName.equals(ifld.getName())) {
                                    result = repName;
                                    break;
                                //System.out.println ("\t\t Field Name/Description/HeadingText: " + ifld.getName() + "/" + ifld.getDescription() + "/" + ifld.getHeadingText());
            //System.out.println ("********************************************************** ");
            catch (Exception exc) {
                System.out.println ("Error/Exception while trying to find the report name for parameter [" + parameterName + "]");
                System.out.println ("*******************************************************************************************");
                exc.printStackTrace();
            return result;

  • Crystal Report Prompt For Enter Parameter Values

    Hi,
    I did a report with 2 subreports embeded in VS2005 using VB and it worked fine but when I ported the whole application to VS2008 the above problem occurs. Here are some codes:
        Private Sub btnPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPreview.Click
            Dim viewer As New frmReportPreview
            Dim rpt As New ReportDocument
            Try
                rpt.Load("C:\Report\crptMain.rpt")
                rpt.SetParameterValue("Code", Me.cbxCode.Text)
                rpt.SetParameterValue("Code", Me.cbxCode.Text, "crptSubReport1.rpt")
                rpt.SetParameterValue("Code", Me.cbxCode.Text, "crptSubReport2.rpt")
                viewer.report = rpt
                viewer.WindowState = FormWindowState.Maximized
                viewer.ShowDialog()
            Catch crptEx As CrystalDecisions.CrystalReports.Engine.EngineException
                MessageBox.Show(crptEx.Message, "Crystal Report Errors...")
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Crystal Report Errors...")
            End Try
        End Sub
    Private Sub frmReportPreview_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument
            Try
                Me.CrystalReportViewer.ReportSource = m_report
                Me.CrystalReportViewer.RefreshReport()
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Error...")
            End Try
        End Sub

    Subreport Parameters are contained within the Main Report's ParameterFieldDefinitions collection. Passing Subreport Parameter values directly to the Subreport will result in the values not being applied and the user being prompted at runtime to provide new values.
    Ludek

Maybe you are looking for

  • Success with iCloud!

    Hello, I've finally cracked the code with iCloud and word processing.  The answer, at least for now, is that the problem is not iCloud.  The problem is in Pages, which requires a manual update to iCloud.com at every session.  Now that I've changed to

  • Call to R/3 transaction from CRM CIC0 Action Box

    Hi All, I configured in CRM the action box to call MySAP (transaction VA01), I used the method BOR with the object BUS2032 and the method CREATEWITHDIA, but I need to configure the action box to pass data from the transaction CIC0 into the R/3 system

  • How to use BC adapter

    Dear Friends,    This is Shalini,                  My Requirement is Third party system is sending the Purchase Order in XML file they are using Business connectors. They are sending the PO to XI System , from XI  that PO's sending TO R/3 System Afte

  • Page protection Smartforms

    Hi, I need to set a page protection for the delivery adress. The adress text node is inside the main window and inside a table. How can I now activate the page protection? The checkbox for page protection on the top of the text node is disabled, so I

  • CC has Java Script Plug in issues... CS5 won't let me see all my NEF files... help.

    In CC I am trying Photoshop (I currently use CS5), and it says it doesn't have the java script plug in... am I supposed to magically pluck it out of thin air to get it? I'm not a computer programmer and I am finding CC to be a maddening experience. C