Group by parameter value

Hi,
How can I group by a parameter value?
For instance, I have the following:
<?for-each-group:Opportunity[there is a filter here];./ResponsibleDepartment?>
This grouping works fine if I enter field values such as "ResponsibleDepartment" (as in the above exmaple), "Product", and "User". Each of these values refer to actual field names. I would like instead to use a parameter, but unable to use a parameter as in the following:
<?for-each-group:Opportunity[there is a filter here];./$ParamGroupBy?>
(the parameters that the user can choose are the actual field names).
This results in error. Can I not use a parameter in this way in a group?

Hey Sorry. Didnt test it.
If its going to be a xdoxslt variable then you can do it as
<?xdoxslt:set_variable($_XDOCTX,'grp', 'DEPT')?>
<?for-each-group:/ROOT/EMPLOYEE; ./*[name()=xdoxslt:get_variable($_XDOCTX,'grp')]?>
<?NAME?>
<?SALARY?>
<?end for-each-group?>
For the sample xml
<ROOT>
<EMPLOYEE>
<NAME>Name1</NAME>
<DEPT>Sales</DEPT>
<SALARY>1000</SALARY>
</EMPLOYEE>
<EMPLOYEE>
<NAME>Name2</NAME>
<DEPT>Development</DEPT>
<SALARY>1200</SALARY>
</EMPLOYEE>
</ROOT>
I am not sure how it can be done for xsl variables.
You can refer http://blogs.oracle.com/xmlpublisher/2006/05/dynamic_sorting_or_sort_by_par_1.html for more details on its usage.
The blog has usage details of xsl variables too in this context.

Similar Messages

  • 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

  • Ssrs 2008 r2 parameter values

    In a new ssrs 2008 r2 report, I need to display 2 of the parameter values in the heading of the report. One of the parameter values in the name and customer number. The second heading value is the city and state where the particular customer is located at.
    The customer table has the following values:
    a. cust_id int primary-id,
    b. customer_name varchar(50),
    c. cust_address1 varchar (50),
    d. cust_address2 varchar (50),
    e. cust_city_state varchar(40),
    f. cust_zip_providence varchar(30),
    g. cust_country varchar(30).
    Thus I need to place the  paramter values of customer_name and cust_city_state that are obtained from a dropdown list in the heading.
    when I try =first(customer_name) in the heading, the value is only good for the first customer name. After that, the wrong parameter value is displayed.
    Thus can you tell me and/or show me code of what I can do to place the parameter values
    of customer_name and cust_city_state in the heading of the report?

    Follow below steps,
    1. Create 3 Data set.
     DS1 = select * from customertable
     DS2 = select distinct customer_name from customertable
     DS3 = select distinct cust_id from customertable
    2. Add two parameter, customer name and customer number
     --------parameter 1
     - supply Name property for 1st parameter
     - datatype for the parameter is string
     - Available value property, Select dataset DS2, Select Field Value as "Customer_Name"
     --------parameter 2
     - supply Name property for 2st parameter
     - datatype for the parameter is string
     - Available value property, Select dataset DS3, Select Field Value as "Cust_id"
    3. Add a blank tablix/table.
     -- Select TableRow2 and right click to add new group i.e insert group.
     -- Group properties window will be openned,
     -- Select Group On Expression 1st.
     -- Select the parameter(Parameter1/customer name) by double clicking in the expression window
     -- Select Group On another Expression 2nd.
     -- Select the parameter(Parameter2/Cust Id) by double clicking in the expression window
     -- Now in the general tab you need to checked "Repeat Group Header"
     -- press ok to close the group properties window.
    4. Now from DS1 drag the field City and State in TableRow3 columns.
    5. Drag the Customer Name and Customer Id/Number in TableRow1.
    6. In case if First(Fields!CustomerName) appears then remove First function as simply "Fields!CustomerName". Similarly for Customer Number.
    7. Finally we need to set the filter condition of the table property. Open the table property by right clicking. On the "Filter" tab choose the expression as "Fields" items and double click "CustomerName" to add in the expression. Similarly add second
    field "CustomerNumber" in the expression. Check the operator "=" and choose the value as "Parameter" items respectively.
    Regards, RSingh

  • PHP 5/Oracle 9i: invalid or unknown NLS parameter value error - Windows XP

    Details:
    Apache/1.3.33 (Win32) PHP/5.0.2
    Windows XP Pro Service Pack 1
    Oracle 9i (located remotely on Sun Solaris)
    Errors:
    Warning: ocilogon() [function.ocilogon]: OCISessionBegin: ORA-12705: invalid or unknown NLS parameter value specified in c:\program files\apache group\Apache\htdocs\eng\class\class.oci8hook.php on line 154
    Warning: ocilogon() [function.ocilogon]: ociopen_server: ORA-12560: TNS:protocol adapter error in c:\program files\apache group\Apache\htdocs\eng\class\class.oci8hook.php on line 154
    Unable to connect to database
    Question:
    How do I set-up the NLS parameters on Windows XP to see a remoted Oracle 9i database?
    Summary:
    I do have Oracle client loaded on my Windows XP workstation, plus when I run phpinfo() on my local workstation, I do have Oracle support enhabled:
    oci8:
    OCI8 Support: enabled
    Revision: $Revision: 1.257 $
    Active Persistent Links: 0
    Active Links: -6
    Temporary Lob support: enabled
    Collections support: enabled
    Oracle:
    Oracle Support: enabled
    Any suggestions or help would be greatly appreciated. Thank you for reading this post.

    user12009184 wrote:
    can anyone help me to resolve the problem.=================================
    Patience, Grasshopper
    You posted this follow-up a mere 30 minutes after your previous post.
    This forum is not a chat line, and it is not paid support.
    No one is responsible for monitoring it and giving a quick response.
    Furthermore, it is a global forum. The person with the information you seek may very well live 20 time zones away from you and was going to bed just as you posted. He will not even see your post for several more hours.
    Your original post went up in the middle of the night for half the world.
    No one with the information you seek is deliberately withholding it until you sound sufficiently desperate.

  • 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;

  • Cannot Change Parameter Value in afterParameterFormTrigger

    I am unable to change parameter values in the afterParameterFormTrigger. All of the parameters are defined as global variables in the default package.
    What I am trying to do is this:
    In RDFs, I would have place holder or formula columns at the top level of the data model (outside of any query group), and the values of these would appear one time just within the root element of the XML data.
    I saw that, with data templates, the parameters appear one time within the root element, so I thought I could just populate these in the default package, but it does not seem to let me. Is this possible?
    If this is not possible, how can I do the equivalent of the place holder column (outside of any query in the RDF) that will output one value within the root element?
    Thanks,
    Kurz

    Please find the URL which causes issue .
    I am not able to invoke the dispatch action in struts.
    /11/09 15:36:03 EFLBuilder: [instance=152748_BUILDERKIT_777946304, id=115210371784,4] ERROR: AbstractResourceRenderer.renderBody - Resource
    "/seminarDetails.mcs;jsessionid=0ad16e5530d73bf00b218e744ea3b74adf8413a2ef58.e34RahmKa3mRay0Lc3aKbhiLbxaKe6fznA5Pp7ftolbGmkTy?Menu=customer&'amp;actionCmd=seminarDetails
    Regards
    Prem

  • Copying from an existing document to change parameter value

    Hello guru's,
    Is there any option to make change to the parameter values while creating a purchase requisition bycopying from an existing purchase requisition document.
    Full points for the useful sol

    Hello Michael,
    welcome to the Pages Discussions. The easiest way is, to show in both documents the thumbnail view (menu: "View/Show Thumbnail View"), select the page in the thumbnail view you want to copy and use the shortcut [command]+[C] or the menu item "Edit/Copy". Than make the document in which you want to paste the active one, click once into the thumbnail view and use the shortcut [command]+[V] or the menu item "Edit/Paste" to paste the copied page into the document.
    I truth you have copied and pasted a section. In your case the section contains only one page. You can identify sections by the yellow frame in the thumbnail view. All styles will be copied, too. But be aware, that same named styles will be overwritte in the styles drawer. In your pasted section, the styles will stay the same like they were before pasting. But you have to create new styles of this pasted page to have them in the styles drawer for later reuse.
    Only if you need to copy parts of single pages out of sections you have to select the content in groups of:
    1) The text in the main text area (you can see it in the middle between the header and the footer by showing the layout guides with the menu item "View/Show Layout") and the inline (move with text) objects in it.
    2) The Objects of the Master Page. Because if you paste them into a new page they will be fix positioned (free movable) objects.
    3) The fix positioned objects.
    If you need to copy an entire page out of a section, separate the page first by splitting it with the menu item "Insert/Section Break" from the rest of the section. Than do the copy and paste session I mentioned first in this post.

  • TIME Dimension - TIME_SPAN parameter value (constant or decrementing?)

    Hi all
    For the the 'TIME_SPAN' parameter value in dimension of type 'TIME', should the value be constant for all members in a particular level or should the value decrement over time as the period progresses.
    For example, for a TIME dimension having levels DAY > MONTH should the values for TIME_SPAN be:
    DAY, DAY_END_DATE, DAY_TIME_SPAN, MONTH, MONTH_END_DATE, MONTH_TIME_SPAN
    D01JAN2010, 01-01-2010, 1, M01_Y2010, 31-01-2010, 31
    D02JAN2010, 02-01-2010, 1, M02_Y2010, 31-01-2010, 31
    D03JAN2010, 03-01-2010, 1, M03_Y2010, 31-01-2010, 31
    and so on...
    or like below:
    D01JAN2010, 01-01-2010, 1, M01_Y2010, 31-01-2010, 31
    D02JAN2010, 02-01-2010, 1, M02_Y2010, 31-01-2010, 30
    D03JAN2010, 03-01-2010, 1, M03_Y2010, 31-01-2010, 29
    and so on...
    Any assistance will be appreciated.
    Cheers.

    Here's a script that might be helpful to you. It fills in aggregate values for date and times span when you have existing days with date data type. If you have time periods shorter than a day, you might check out this post.
    http://oracleolap.blogspot.com/2010/05/time-dimensions-with-hourly-time.html
    CREATE TABLE time_dim
    DAY_KEY DATE,
    DAY_TIME_SPAN NUMBER,
    MONTH_ID VARCHAR2(30),
    MONTH_END_DATE DATE,
    MONTH_TIME_SPAN NUMBER,
    QUARTER_ID VARCHAR2(30),
    QUARTER_END_DATE DATE,
    QUARTER_TIME_SPAN NUMBER,
    CALENDAR_YEAR_ID VARCHAR2(30),
    YEAR_END_DATE DATE,
    YEAR_TIME_SPAN NUMBER
    -- Add rows for days. E.g.,
    -- insert into time_dim (select distinct day_key from fact_view);
    --UPDATE time_dim
    --SET hour_time_span = round(1/24,5);
    -- Add month members.
    UPDATE time_dim SET month_id = TO_CHAR(day_key 'MON-YYYY');
    UPDATE time_dim a
    SET month_time_span =
    (SELECT ts
    FROM
    (SELECT DISTINCT month_id,
    SUM(day_time_span) AS ts
    FROM time_dim
    GROUP BY month_id
    ) b
    WHERE a.month_id = b.month_id
    UPDATE time_dim a
    SET month_end_date =
    (SELECT ed
    FROM
    (SELECT DISTINCT month_id,
    MAX(day_key) AS ed
    FROM time_dim
    GROUP BY month_id
    ) b
    WHERE a.month_id = b.month_id
    -- Add Quarter members.
    UPDATE time_dim SET quarter_id = TO_CHAR(day_key 'Q-YYYY');
    UPDATE time_dim a
    SET quarter_time_span =
    (SELECT ts
    FROM
    (SELECT DISTINCT quarter_id,
    SUM(day_time_span) AS ts
    FROM time_dim
    GROUP BY quarter_id
    ) b
    WHERE a.quarter_id = b.quarter_id
    UPDATE time_dim a
    SET quarter_end_date =
    (SELECT ed
    FROM
    (SELECT DISTINCT quarter_id,
    MAX(day_key) AS ed
    FROM time_dim
    GROUP BY quarter_id
    ) b
    WHERE a.quarter_id = b.quarter_id
    -- Add Year members.
    UPDATE time_dim SET month_id = TO_CHAR(day_key 'YYYY');
    UPDATE time_dim a
    SET year_time_span =
    (SELECT ts
    FROM
    (SELECT DISTINCT year_id,
    SUM(day_time_span) AS ts
    FROM time_dim
    GROUP BY year_id
    ) b
    WHERE a.year_id = b.year_id
    UPDATE time_dim a
    SET year_end_date =
    (SELECT ed
    FROM
    (SELECT DISTINCT year_id,
    MAX(day_key) AS ed
    FROM time_dim
    GROUP BY year_id
    ) b
    WHERE a.year_id = b.year_id
    ;

  • Unable to capture the parameter values from a PL/SQL procedure

    hi.
    i'm trying to capture the parameter values of a PL/SQL procedure by calling inside a anonymous block but i'm getting a "reference to uninitialized collection error" ORA-06531.
    Please help me regarding.
    i'm using following block for calling the procedure.
    declare
    err_cd varchar2(1000);
    err_txt VARCHAR2(5000);
    no_of_recs number;
    out_sign_tab search_sign_tab_type:=search_sign_tab_type(search_sign_type(NULL,NULL,NULL,NULL,NULL));
    cntr_var number:=0;
    begin
         rt843pq('DWS','3000552485',out_sign_tab,no_of_recs,err_cd,err_txt);
         dbms_output.put_line('The error is ' ||err_cd);
         dbms_output.put_line('The error is ' ||err_txt);
         dbms_output.put_line('The cntr is ' ||cntr_var);
         for incr in 1 .. OUT_SIGN_TAB.count
         loop
         cntr_var := cntr_var + 1 ;
    Dbms_output.put_line(OUT_SIGN_TAB(incr).ref_no||','||OUT_SIGN_TAB(incr).ciref_no||','||OUT_SIGN_TAB(incr).ac_no||','||OUT_SIGN_TAB(incr).txn_type||','||OUT_SIGN_TAB(incr).objid);
    end loop;
    end;
    Error is thrown on "for incr in 1 .. OUT_SIGN_TAB.count" this line
    Following is some related information.
    the 3rd parameter of the procedure is a out parameter. it is a type of a PL/SQL table (SEARCH_SIGN_TAB_TYPE) which is available in database as follows.
    TYPE "SEARCH_SIGN_TAB_TYPE" IS TABLE OF SEARCH_SIGN_TYPE
    TYPE "SEARCH_SIGN_TYPE" AS OBJECT
    (ref_no VARCHAR2(22),
    ciref_no VARCHAR2(352),
    ac_no VARCHAR2(22),
    txn_type VARCHAR2(301),
    objid VARCHAR2(1024))............

    We don't have your rt843pq procedure, but when commenting that line out, everything works:
    SQL> create TYPE "SEARCH_SIGN_TYPE" AS OBJECT
      2  (ref_no VARCHAR2(22),
      3  ciref_no VARCHAR2(352),
      4  ac_no VARCHAR2(22),
      5  txn_type VARCHAR2(301),
      6  objid VARCHAR2(1024))
      7  /
    Type is aangemaakt.
    SQL> create type "SEARCH_SIGN_TAB_TYPE" IS TABLE OF SEARCH_SIGN_TYPE
      2  /
    Type is aangemaakt.
    SQL> declare
      2    err_cd varchar2(1000);
      3    err_txt VARCHAR2(5000);
      4    no_of_recs number;
      5    out_sign_tab search_sign_tab_type:=search_sign_tab_type(search_sign_type(NULL,NULL,NULL,NULL,NULL));
      6    cntr_var number:=0;
      7  begin
      8    -- rt843pq('DWS','3000552485',out_sign_tab,no_of_recs,err_cd,err_txt);
      9    dbms_output.put_line('The error is ' ||err_cd);
    10    dbms_output.put_line('The error is ' ||err_txt);
    11    dbms_output.put_line('The cntr is ' ||cntr_var);
    12    for incr in 1 .. OUT_SIGN_TAB.count
    13    loop
    14      cntr_var := cntr_var + 1 ;
    15      Dbms_output.put_line(OUT_SIGN_TAB(incr).ref_no||','||OUT_SIGN_TAB(incr).ciref_no||','||OUT_SIGN_TAB(incr).ac_no||','||OUT_SIGN
    TAB(incr).txntype||','||OUT_SIGN_TAB(incr).objid);
    16    end loop;
    17  end;
    18  /
    The error is
    The error is
    The cntr is 0
    PL/SQL-procedure is geslaagd.Regards,
    Rob.

  • "Missing parameter values."  --  Export and Print only...

    I have a web application and I am using CrystalReportViewer.  I am passing several parameters to Crystal using: 
    report.SetParameterValue(field.Name, Session[field.Name]);
    I have session variables which will hold parameters needed to pass into the report.  The session variables are populated from controls on my webpage after an onclick event.  This even not only populates session, but also passes parameters to the report with the following code: 
    ReportDocument report = new ReportDocument();
    Session["MapPathName"] = "./Reporting/CaseStudy.rpt";
    report.FileName = Server.MapPath(Session["MapPathName"].ToString());
    ParameterFields fields = new CrystalDecisions.Shared.ParameterFields();
    fields = report.ParameterFields;
    foreach (ParameterField field in fields)
          report.SetParameterValue(field.Name, Session[field.Name]);
    CrystalReportViewer1.ReportSource = report;
    This works great for reporting and is very extensible.  However, when clicking on the "Print" or "Export" buttons on the toolbar I get "Missing parameter values."  I attempted to export manually in code using the .ExportToStream function but I still get the error, "Missing parameter values." 
    I received this error also in Refresh, Search, and Navigate functions.  This was corrected by calling a function that supplies the above code block to these functions.  However, I do not see any events for controlling the Print nor the Export events. 
    QUESTION: How can I print or export a report when passing parameters using CrystalReportViewer?  Thanks in advance!
    P.S. - Crystal Reports XI Release 2
    Edited by: KyleSavant on Jun 18, 2009 5:42 PM

    There are no Export or Print events accessible for the viewer
    Since it sounds like you are creating the reportdocument object in your click event, the settings on this object become out of scope on successive postbacks executed by other events.
    to get around this without major changes, you can place your "report" object in session in this event and retrieve it from session on successive postbacks.  This should solve your problems around navigation, printing and exporting.  What you will need to do is check if the session object exists (usually in page_load or page_initialze) and if so, retrieve it from session and bind it to the viewer's reportsource.  If the session object does not exist, then do nothing (ie you have not clicked your button yet that retrieves the parameter values from session and loads the report).  Also, in your click event you can check if the report session object exists and if so, remove it so that it can be re-created with your new parameter values (ie i'm assuming the only time you want to set parameter values is in this event).
    Dan

  • Unable to get parameter values from a remote database

    I am linking to a remote database view via a synonym in Oracle and trying to retrieve parameter values from it.  The username and password are the same for the local and remote database and I can run the SQL query using SQL plus against the database and values are returned.  However, when I try and run the same query in Crystal Reports (XI) I receive an Oracle error:
    "An attempt was made to connect or log in to a remote database using a connection description that could not be found.
    Action: 
    Specify an existing database link. Query the data dictionary to see all existing database links. See your operating system-specific Net8 documentation for valid connection descriptors. "
    How can it be that Crystal cannot run the query when it is valid in SQL plus?
    Any tips/info would be appreciated.
    many thanks
    Claire
    Oracle is version 10

    When running one of the reports in VS.Net this is the error I receive:
    "A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in crystaldecisions.crystalreports.engine.dll
    Additional information: Failed to retrieve data from the database.
    Details:  [Database Vendor Code: 2019 ]
    Failed to retrieve data from the database.
    Error in File C:\DOCUME1\CLAIRE1.REE\LOCALS~1\Temp\{0C6C6DD5-B958-4E10-A2AA-928C58E1B7CE}.rpt:
    Failed to retrieve data from the database.
    Details:  [Database Vendor Code: 2019 ]"
    When running the same report in Crystal Reports designer I receive this error message:
    "Prompting failed with the following error message: 'List of Values failure: fail to get values. [Cause of error: Failed to retrieve data from the database.  Details: [Database Vendor Code: 2019].  Failure to retrieve data from the database.  Error in File UNKNOWN.RPT.  Failure to retrieve data from the database.  Details: [Database Vendor Code: 2019]]'.
    Error source: prompt.dll Error code: 0x8004380D"
    So this one is also failing in the designer.
    All the parameters in the main report are static and the ones in the subreport are passed in from the main report.

  • Urgent help required - linked subreport keeps asking for parameter value

    Greetings,
    I have developed a report in the Crystal Reports bundled with Visual Studio 2005. The data is obtained from a stored procedure. One of the fields in the result set is named "Id".
    I have embedded a subreport in the details row of the main report. The subreport also gets its information from a stored procedure. This stored procedure has one parameter named "OpportunityId". This field is linked to the field named "Id" above. the subreport has been set to supress blank subreports.
    In the development environment and running the executable of the application on the development machine the report works perfectly. The subreport displays as it should and all is well.
    When I deploy the report onto user machines where they have the crystal runtime installed, the report keeps asking for a parameter value for the subreport.
    I cannot get this to stop happening.
    This report is urgently required. PLEASE could someone help me out here.
    I am at my wits end.
    I have attached a zipe file containing the following:
    - the two stored procedure
    - the rpt file
    - a sample report
    - a screen showing the report having just been generated
    Thanks in advance,
    Robert Lancaster

    <p>Hi Robert,</p><p>I see your report template and stored procedures. All seems to be ok. <br /></p><p>The most important is to assign the report parameters for all linked subreports (only one in your case).</p><p> </p><p>Try this (in C#, in VB.NET the code are very similary): </p><p>ReportDocument report = new ReportDocument(@"TopFortyReport.rpt");</p><p>AssignParameters(report, paramCollection);</p><p>// and now assign parameters to all linked subreports </p><p>foreach( CrystalDecisions.CrystalReports.Engine.Section section in report.ReportDefinition.Sections)</p><p>{</p><p>    foreach (CrystalDecisions.CrystalReports.Engine.ReportObject reportObject in section.ReportObjects)<br />    {</p><p>        if (reportObject.Kind == ReportObjectKind.SubreportObject) </p><p>        {</p><p>            SubreportObject subReport = (SubreportObject)reportObject;</p><p>            ReportDocument subDocument = subReport.OpenSubreport(subReport.SubreportName);                                               AssignParameters(subDocument, paramsCollection);</p><p>        }</p><p>} </p><p> </p><p>void AssignParameters(ReportDocument report, object[] paramsCollection)</p><p>{</p><p>    int nParams = paramsCollection.Length;</p><p>    for (int iParamIndex = 0; iParamIndex < nParams; iParamIndex++)</p><p>    {</p><p>        if (report.DataDefinition.ParameterFields[iParamIndex].IsLinked())</p><p>            continue;</p><p>        report.SetParameterValue(iParamIndex, paramsCollection[iParamIndex]);</p><p>    }</p><p>}</p><p> </p><p> </p>

  • 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 : (

  • T-sql 2012 accept null parameter values

    The following t-sql 2012 works fine in sql management studio. However when I place it in a .net 2010 web form application, I am told the sql does not work when the parameter values are null. Thus can you tell me what I can change in the sql below that will
    accept null as 3 possible input values?
    SELECT i.[lastName]
                ,i.[firstName] 
                ,i.[middleName]
                ,i.[suffix] 
                ,a.[userid]
                ,a.schoolnum 
                ,a.spa 
                ,a.mrref
                from [OPS].[dbo].[Identity] i 
                inner join  [OPS].[dbo].[Person] p on i.identityID = p.currentIdentityID 
                inner join [OPS].[dbo].[UserAccount] u on u.personID = p.personID 
                inner join [CampusOps].[dbo].[AtnLtrUsers] a on a.userid =u.username
                       where (i.[lastName] like  '%' + @lname  + '%' or i.[firstName] like'%' +
    @fname + '%'
                       or i.[middleName]  like'%' + @mname + '%')
    or (@fname is null and @lname is null and @mname is null)
            order by  i.[lastName], i.[firstName], i.[middleName]"

    You should create a stored procedure for this.
    create procedure GetNames
    (@lname varchar(max) = null, @fname varchar(max) = null, @mname varchar(max) = null)
    as
    begin
    SELECT i.[lastName]
    ,i.[firstName]
    ,i.[middleName]
    ,i.[suffix]
    ,a.[userid]
    ,a.schoolnum
    ,a.spa
    ,a.mrref
    from [OPS].[dbo].[Identity] i
    inner join [OPS].[dbo].[Person] p on i.identityID = p.currentIdentityID
    inner join [OPS].[dbo].[UserAccount] u on u.personID = p.personID
    inner join [CampusOps].[dbo].[AtnLtrUsers] a on a.userid =u.username
    where (i.[lastName] like '%' + @lname + '%' or @lname is null) and
    (i.[firstName] like'%' + @fname + '%' or @fname is null) and
    (i.[middleName] like'%' + @mname + '%' or @mname is null)
    order by i.[lastName], i.[firstName], i.[middleName]
    end
    Also keep in mind that NULL is different than an empty string but it should work exactly like a null anyway (unless your columns/fields are also NULLable).

  • 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

Maybe you are looking for