Crystal report SQL Command and using IN

Post Author: geozuh
CA Forum: Crystal Reports
Does any one know how to get a multiple value prompts to work in Crystal report SQL Commands? I have an extremely large database and do not want to pull back all the records to the report. I know I can do the filtering in the report, but due to the size of the database, I am restricked from doing do.
I would like to set the State as a multiple value parameter/prompt to be used in the SQL Command.
Ex.
Select CustID, FirstName, LastName
from Customer
where State in ('WI', 'IL', 'MN') --this would be turned into a parameter

Post Author: yangster
CA Forum: Crystal Reports
you are over thinking the problemsimply create a parameter within crystal for your state and change it to allow multiple valuesthen in the select expert put in state = ?stateif you do show sql query you will see that the values are pushed down to the sql level thus no performance hit vs putting the parameter directly in the command itself

Similar Messages

  • JRC bug: apostrophe in string parameter passed to Crystal Report with Command datasource to SQL Server

    Post Author: nl11087
    CA Forum: JAVA
    A single quote/apostrophe in string parameter passed to a Crystal Report with Command datasource connecting to a SQL Server database, using sqljdbc driver does not escape the special character correctly. When doing a preview in the Crystal Reports IDE it allows you to escape the input parameter as expected and work correctly, but through the JRC component it fails. For string parameters without special sql server characters I experience no problems at all. When replacing the Command with a direct table there is also no problem.
    Reproduction:
    1. create a database db1, create a table table1 with a String type column col1.
    2. Create new report Report1.rpt, create a connection to above, Add Command using 'SELECT col1, col2, col3 FROM table1 WHERE col1 = '{?Par1}' . Add a parameter field Par1 : String
    3. In your java stand alone application using JRC add the parameter Par1 with a value "Jon Doe's Value" containing a single apostrophe. Export to PDF. (I also tried MSWord and this failed too, similar behavior). Additionally, in another test try to replaceAll("'","''") to escape it, preventing the code to break, but now it does not retrieve the expected row anymore and you end up with an empty report.
    Exception StackTrace:
    com.crystaldecisions.reports.exportinterface.exceptions.ExportException: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.formatter.a.c.if(Unknown Source)
    at com.crystaldecisions.reports.formatter.a.c.a(Unknown Source)
    at com.businessobjects.reports.sdk.b.b.int(Unknown Source)
    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.x.a(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.q.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.dd.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source)
    Caused by: com.crystaldecisions.reports.formatter.formatter.c: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.formatter.formatter.objectformatter.bv.<init>(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.objectformatter.bv.if(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.e.l.<init>(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.e.p.<init>(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.e.p.a(Unknown Source)
    at com.crystaldecisions.reports.formatter.a.c.a(Unknown Source)
    ... 17 more
    Caused by: com.crystaldecisions.reports.dataengine.be: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.dataengine.n.else(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.nr(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.bn(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.bp(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.else(Unknown Source)
    at com.crystaldecisions.reports.dataengine.s.a(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.a(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.aa(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.<init>(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.<init>(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.<init>(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.a(Unknown Source)
    ... 23 more
    Caused by: com.crystaldecisions.reports.reportdefinition.datainterface.n: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.reportdefinition.datainterface.p.a(Unknown Source)
    ... 35 more
    Caused by: com.crystaldecisions.reports.queryengine.driverImpl.m: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.queryengine.driverImpl.o.eC(Unknown Source)
    at com.crystaldecisions.reports.queryengine.driverImpl.o.if(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ap.ea(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ap.h(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ap.dV(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ax.if(Unknown Source)
    at com.crystaldecisions.reports.queryengine.bc.if(Unknown Source)
    at com.crystaldecisions.reports.queryengine.bc.do(Unknown Source)
    at com.crystaldecisions.reports.queryengine.bc.do(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ae.cy(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ae.cz(Unknown Source)
    at com.crystaldecisions.reports.queryengine.b1.bc(Unknown Source)
    ... 36 more
    Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near 's'.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
    at com.microsoft.sqlserver.jdbc.IOBuffer.processPackets(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement$StatementExecutionRequest.executeStatement(Unknown Source)
    at com.microsoft.sqlserver.jdbc.CancelableRequest.execute(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeRequest(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(Unknown Source)
    ... 48 more
    - JRCAgent3 detected an exception: An error occured while exporting the report
    at com.businessobjects.reports.sdk.b.b.int(Unknown Source)
    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.x.a(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.q.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.dd.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source)

    Post Author: nl11087
    CA Forum: JAVA
    A single quote/apostrophe in string parameter passed to a Crystal Report with Command datasource connecting to a SQL Server database, using sqljdbc driver does not escape the special character correctly. When doing a preview in the Crystal Reports IDE it allows you to escape the input parameter as expected and work correctly, but through the JRC component it fails. For string parameters without special sql server characters I experience no problems at all. When replacing the Command with a direct table there is also no problem.
    Reproduction:
    1. create a database db1, create a table table1 with a String type column col1.
    2. Create new report Report1.rpt, create a connection to above, Add Command using 'SELECT col1, col2, col3 FROM table1 WHERE col1 = '{?Par1}' . Add a parameter field Par1 : String
    3. In your java stand alone application using JRC add the parameter Par1 with a value "Jon Doe's Value" containing a single apostrophe. Export to PDF. (I also tried MSWord and this failed too, similar behavior). Additionally, in another test try to replaceAll("'","''") to escape it, preventing the code to break, but now it does not retrieve the expected row anymore and you end up with an empty report.
    Exception StackTrace:
    com.crystaldecisions.reports.exportinterface.exceptions.ExportException: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.formatter.a.c.if(Unknown Source)
    at com.crystaldecisions.reports.formatter.a.c.a(Unknown Source)
    at com.businessobjects.reports.sdk.b.b.int(Unknown Source)
    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.x.a(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.q.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.dd.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source)
    Caused by: com.crystaldecisions.reports.formatter.formatter.c: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.formatter.formatter.objectformatter.bv.<init>(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.objectformatter.bv.if(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.e.l.<init>(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.e.p.<init>(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.e.p.a(Unknown Source)
    at com.crystaldecisions.reports.formatter.a.c.a(Unknown Source)
    ... 17 more
    Caused by: com.crystaldecisions.reports.dataengine.be: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.dataengine.n.else(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.nr(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.bn(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.bp(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.else(Unknown Source)
    at com.crystaldecisions.reports.dataengine.s.a(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.a(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.aa(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.<init>(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.<init>(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.<init>(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.a(Unknown Source)
    ... 23 more
    Caused by: com.crystaldecisions.reports.reportdefinition.datainterface.n: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.reportdefinition.datainterface.p.a(Unknown Source)
    ... 35 more
    Caused by: com.crystaldecisions.reports.queryengine.driverImpl.m: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.queryengine.driverImpl.o.eC(Unknown Source)
    at com.crystaldecisions.reports.queryengine.driverImpl.o.if(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ap.ea(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ap.h(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ap.dV(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ax.if(Unknown Source)
    at com.crystaldecisions.reports.queryengine.bc.if(Unknown Source)
    at com.crystaldecisions.reports.queryengine.bc.do(Unknown Source)
    at com.crystaldecisions.reports.queryengine.bc.do(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ae.cy(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ae.cz(Unknown Source)
    at com.crystaldecisions.reports.queryengine.b1.bc(Unknown Source)
    ... 36 more
    Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near 's'.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
    at com.microsoft.sqlserver.jdbc.IOBuffer.processPackets(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement$StatementExecutionRequest.executeStatement(Unknown Source)
    at com.microsoft.sqlserver.jdbc.CancelableRequest.execute(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeRequest(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(Unknown Source)
    ... 48 more
    - JRCAgent3 detected an exception: An error occured while exporting the report
    at com.businessobjects.reports.sdk.b.b.int(Unknown Source)
    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.x.a(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.q.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.dd.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source)

  • Using unlinked sql command and table in a subreport

    All,
    Does CR allow using an unlinked sql command and a table in the same subreport?  I am passing the CurrentCEUserName from the main report to the sql command in the subreport (via linked parameter).  The sql command then executes a query to pass the parameter to the database (example: select myfunction('{?myparam}' from dual).  I need this to run before subreport's table query is executed. 
    This all appears to work except that the parameter passed to the sql command isn't set when the command executes.  The value is always null when the sql command is executed.  If I add the parameter to the report output it shows the expected value. 
    Also, if I have a subreport that just has a single sql command the parameter is set correctly prior to executing the command.
    any help would be appreciated.
    thanks!

    If you are looking for Crystal to run the SQL Command, then the SQL it generates itself, I think the answer is no, it won't do that.  Crystal expects all of the data sources to be linked, I believe.  I'm not sure what you would expect to happen if they are not...  However, you can make your SQL Command something like (MS SQL; sorry, it's been too long since I've used Oracle...):
    declare @result varchar(100);
    set @result = ( select myfunction('{?myparam}') );
    select * from table;
    which would run the first select calling your function, basically throw away the result (or you can do with it as needed), then return the fields from your table.
    HTH,
    Carl

  • Performace Issue using Crystal Report For enterprise and BEx Queries

    Hi all;
        We are generating the following error stack when trying to build a report on top of a BEX query using Crystal Report for Enterprise :
        |7C4F8ECE44034DB897AD88D6F98B028B3|2011 12 12 17:24:21.277|+0100|>>|E| |crj|20380|  56|ModalContext    | |2|0|0|0|BIPSDK.InfoStore:query|CHVXRIL0047:20380:56.174:1|-|-|BIPSDK.InfoStore:query|CHVXRIL0047:20380:56.174:1|Cut2PbOe3UdzgckPBHn8spEab|||||||||com.crystaldecisions.sdk.occa.infostore.internal.InfoObjects||Assertion failed: Java plugin for CommonConnection is not loaded.
    java.lang.AssertionError
         at com.businessobjects.foundation.logging.log4j.Log4jLogger.assertTrue(Log4jLogger.java:52)
         at com.crystaldecisions.sdk.occa.infostore.internal.InfoObjects.newInfoObject(InfoObjects.java:576)
         at com.crystaldecisions.sdk.occa.infostore.internal.InfoObjects.continueUnpackHelper(InfoObjects.java:548)
         at com.crystaldecisions.sdk.occa.infostore.internal.InfoObjects.continueUnpack(InfoObjects.java:489)
         at com.crystaldecisions.sdk.occa.infostore.internal.InfoObjects.startUnpack(InfoObjects.java:464)
         at com.crystaldecisions.sdk.occa.infostore.internal.InternalInfoStore$XRL3WireStrategy.startUnpackTo(InternalInfoStore.java:1484)
         at com.crystaldecisions.sdk.occa.infostore.internal.InternalInfoStore$XRL3WireStrategy.startUnpackTo(InternalInfoStore.java:1464)
         at com.crystaldecisions.sdk.occa.infostore.internal.InternalInfoStore.unpackAll(InternalInfoStore.java:910)
         at com.crystaldecisions.sdk.occa.infostore.internal.InternalInfoStore.queryHelper(InternalInfoStore.java:944)
         at com.crystaldecisions.sdk.occa.infostore.internal.InternalInfoStore.queryHelper(InternalInfoStore.java:929)
         at com.crystaldecisions.sdk.occa.infostore.internal.InternalInfoStore.query_aroundBody24(InternalInfoStore.java:798)
         at com.crystaldecisions.sdk.occa.infostore.internal.InternalInfoStore.query(InternalInfoStore.java:1)
         at com.crystaldecisions.sdk.occa.infostore.internal.InfoStore.query_aroundBody20(InfoStore.java:175)
         at com.crystaldecisions.sdk.occa.infostore.internal.InfoStore.query_aroundBody21$advice(InfoStore.java:42)
         at com.crystaldecisions.sdk.occa.infostore.internal.InfoStore.query(InfoStore.java:1)
         at com.businessobjects.mds.securedconnection.cms.services.olap.OlapCmsSecuredConnectionService.getConnectionObject(OlapCmsSecuredConnectionService.java:125)
         at com.businessobjects.mds.securedconnection.cms.services.olap.OlapCmsSecuredConnectionService.getOlapSecuredConnection(OlapCmsSecuredConnectionService.java:191)
         at com.businessobjects.mds.securedconnection.loader.internal.SecuredConnectionLoaderImpl.getOlapConnectionFromSecuredConnection(SecuredConnectionLoaderImpl.java:83)
         at com.businessobjects.mds.securedconnection.loader.internal.SecuredConnectionLoaderImpl.getConnectionFromSecuredConnection(SecuredConnectionLoaderImpl.java:60)
         at com.businessobjects.dsl.services.workspace.impl.DirectOlapAccessDataProviderBuilder.loadSecuredConnection(DirectOlapAccessDataProviderBuilder.java:193)
         at com.businessobjects.dsl.services.workspace.impl.DirectOlapAccessDataProviderBuilder.loadSecuredConnection(DirectOlapAccessDataProviderBuilder.java:176)
         at com.businessobjects.dsl.services.workspace.impl.DirectOlapAccessDataProviderBuilder.provideUniverseFromCms(DirectOlapAccessDataProviderBuilder.java:63)
         at com.businessobjects.dsl.services.datasource.impl.AbstractUniverseProvider.provideUniverse(AbstractUniverseProvider.java:41)
         at com.businessobjects.dsl.services.workspace.impl.AbstractDataProviderBuilder.updateQuerySpecDataProvider(AbstractDataProviderBuilder.java:119)
         at com.businessobjects.dsl.services.workspace.impl.AbstractDataProviderBuilder.updateDataProvider(AbstractDataProviderBuilder.java:106)
         at com.businessobjects.dsl.services.workspace.impl.AbstractDataProviderBuilder.addDataProvider(AbstractDataProviderBuilder.java:49)
         at com.businessobjects.dsl.services.workspace.impl.WorkspaceServiceImpl.addDataProvider(WorkspaceServiceImpl.java:56)
         at com.businessobjects.dsl.services.workspace.impl.WorkspaceServiceImpl.addDataProvider(WorkspaceServiceImpl.java:45)
         at com.crystaldecisions.reports.dsl.shared.DSLTransientUniverseServiceProvider.createSessionServicesHelper(DSLTransientUniverseServiceProvider.java:72)
         at com.crystaldecisions.reports.dsl.shared.DSLServiceProvider.createSessionServices(DSLServiceProvider.java:428)
         at com.businessobjects.crystalreports.designer.qpintegration.DSLUtilities.getServiceProvider(DSLUtilities.java:279)
         at com.businessobjects.crystalreports.designer.qpintegration.InitializeDSLRunnable.run(InitializeDSLRunnable.java:82)
         at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
    Here seems to be that a plugin is not loaded : com.crystaldecisions.sdk.occa.infostore.internal.InfoObjects||Assertion failed: Java plugin for CommonConnection is not loaded.
    could this affect the performance of Crystal Reports for Enterprise and how could I fix this ?
    Best Regards
    Anis

    Venkat,
    Thanks for your response. Please note, however, the transaction RAD1 does not exist. Let me provide more details about the current settings of the InfoObject.
    The Characteristic is 'Item' (0CS_ITEM) and upon going to RSA1 >  Modeling > InfoObjects > Item (0CS_ITEM) > Right Click > Display > Business Explorer (tab) > Text Type is set to 'Long Text' and BEx description is set to 'Long description' already.
    When I run/execute the query with this Item characteristic, the results in BEx Analyzer is showing appropriate long text, however, Crystal Report for Enterprise shows short text only
    K
    Edited by: Kumar Pathak on Feb 3, 2012 6:18 PM

  • Restrictions for using sql commands and operators in loader control file

    Hi ,
    It suppose that there is a lot of restrictions and limitations when using sql commands and operators in the loader control files, same as it seems I cannot use (or) when with case statement, also it seems there is certain length for the case,
    So guys, what are the common limitations and restrictions to be avoided in the loader control file ?
    Your efforts are highly appreciated
    Ash

    Hi Ash,
    if you need to do more complicated logic its better to define the file to be loaded as an external table. You can then use any sql function you like against the external table rather than messing around with what you can and can;t do in a sqlldr control file.
    You can use the external_table option of sqldr to generate the definition.
    Regards,
    Harry
    http://dbaharrison.blogspot.com/

  • Dynamic SQL Command Queries Using Parameters

    Post Author: tdoman
    CA Forum: Data Connectivity and SQL
    I'm using Crystal Reports 11 and am trying to dynamically build part of the "Where" clause in the SQL command query to filter data on the server before the results are sent to the client. I'm doing this to decrease the load time of my reports by not having to send a large set of data to the client, then filter the results on the client side.
    I want to create a parameter list that is dynamically generated from a table in a database and allows you to select mutiple values from that list. For example: I have two tables. One employee table and one employee type table. The employee table lists all employees and their related employee types (full-time, part-time, and contractor). The employee type table lists the employee types that will dynamically be loaded into the parameters list.
    Employee Table
    ID    Name       TypeID
    1     Bob          2
    2     Steve        1
    3     John         3
    4     Bill            1
    Employee Type Table
    ID   Type
    1     Full-Time
    2     Part-Time
    3     Contractor
    Assuming the user selects u2018Full-Timeu2019 and u2018Contractoru2019 from the parameter list, the SQL command query I want to generate is as follows:
    SELECT *
    FROM emp, emp_type
    WHERE emp.ID = emp_type.ID and emp.TypeID in (u20181u2019, u20183u2019)
    I tried building the following SQL command query so it would dynamically replace {?EmpType} with the IDu2019s of the types the user selected but it doesnu2019t work. Any ideas how to fix this?
    SELECT *
    FROM emp, emp_type
    WHERE emp.ID = emp_type.ID and emp.TypeID in ({?EmpType})

    Post Author: tdoman
    CA Forum: Data Connectivity and SQL
    btw...I just realized I had a typo in my "where" clause of the previous example. It should have been like so:WHERE emp.TypeID = emp_type.ID and emp.TypeID in (u20181u2019, u20183u2019)  satish_nair31:
    Instead of passing the filter condition as parameter it would be fine if you pass it by ReportViewer.SelectionFormula Property.
    The selection formula property of report viewer control will dynamically append the where condition with the SQL value. You will pass the filter condition as per the syntax of language supported by crystal reports.I believe using the ReportViewer.SelectionFormula property you are referring to is only available if I'm loading the report through a VB application. If this is true, then this option will not work for me because I'm loading the report in a browser from the Crystal Report web server and currently don't have a VB application that can load the report. If I did, then I could dynamically build the SQL string using VB then pass it to the Crystal Report on the fly.But I'm trying to figure out if it's possible to do it without loading the report using VB. Please correct me if I'm wrong on these assumptions.

  • Crystal report/SQL SP/DTSRUN

    Post Author: slk35psu
    CA Forum: Other
    Hi.
    &#91;Crystal Reports version 11.5.9.1076&#93;
    &#91;SQL Server 2000&#93;
    I have a SQL Server stored procedure that runs perfectly
    when I execute it in the database but it does not work in Crystal Report.
    The stored procedure executes two SQL scripts: drop table
    indexes and truncate tables.  After that,
    it calls a DTS package to transfer data from an Oracle database to the SQL
    database.  After the DTS package call, it
    executes two more SQL scripts to put back the table indexes and updates table
    statistics.  I can run the stored
    procedure in the SQL database (on both my computer and on its server).  The problem occurs when the stored procedure
    is called in the Crystal Report.  In
    Crystal Report, the stored procedure runs the drop table indexes and truncate
    tables scripts and the DTS package.  It
    seems to me that Crystal
    thinks the job is done at the completion of the DTS package and reports a
    success status.  It fails to continue to
    run the table indexes creation script and the table statistics update
    script.  What causes this?
    To summarize, the steps in the SQL database stored procedure
    are:
    Truncate
         tablesDrop
         indexesRun
         DTS package to transfer data from Oracle DB to SQL DBCreate
         indexesUpdate
         statistics
    The stored procedure works find when executed in the SQL database.  When executed in the Crystal Report, it stops
    (and thinks) it is done at the end of the DTS package run (step 3).
    I have pasted my stored procedure code below for your
    review.  Sincerely, Susan Kolonay.
    create proc dbo.WH_DATA_LOAD
    as
    SET NOCOUNT ON
    DECLARE @rc int
    DECLARE @WH_UNAME varchar(30)
    SET @WH_UNAME = 'whu1'
    DECLARE @WH_PWD varchar(30)
    SET @WH_PWD = 'K*e689f(k'
    DECLARE @WH_DB_SERVER_NAME varchar(30)
    SET @WH_DB_SERVER_NAME = 'ddasAA.psu.edu'
    DECLARE @SCRIPTS_LOC varchar(50)
    SET @SCRIPTS_LOC = 'E:\Scripts\cnv\TEST\'
    DECLARE @DTS_PKG_NAME varchar(30)
    SET @DTS_PKG_NAME = 'whse_build_routine'
    DECLARE @TRUNCATE_TBL varchar(200)
    DECLARE @DROP_INDEXES varchar(200)
    DECLARE @DTS_PKG varchar(200)
    DECLARE @CREATE_INDEXES varchar(200)
    DECLARE @UPDATE_TBL_STATS varchar(200)
    /CHECKING TABLE/
    if not exists (select 1 from sysobjects where type='U' and
    name='WH_DATA_LOAD_STATS' and uid=1)
    BEGIN
      PRINT
    'WH_DATA_LOAD_STATS does not exist.'
      RETURN
    END
    /TRUNCATE TEMPORARY TABLE/
    truncate table WH_DATA_LOAD_STATS
    /TRUNCATE TABLES/
    insert into WH_DATA_LOAD_STATS (time_started, process)
    values (getdate(), 'truncate table')
    SET @TRUNCATE_TBL = 'isql -U '@WH_UNAME' -P '@WH_PWD' -n
    -i '@SCRIPTS_LOC'trunc_whse_tables.sql 2>&1'
    EXEC @rc = master.dbo.xp_cmdshell @TRUNCATE_TBL
    IF @rc <> 0
    BEGIN
      update
    WH_DATA_LOAD_STATS set time_ended=getdate(), status='failed' where
    process='truncate table'
    END
    ELSE
    BEGIN
      update
    WH_DATA_LOAD_STATS set time_ended=getdate(), status='success' where
    process='truncate table'
    END
    /DROP INDEXES/
    insert into WH_DATA_LOAD_STATS (time_started, process)
    values (getdate(), 'drop indexes')
    SET @DROP_INDEXES = 'isql -U '@WH_UNAME' -P '@WH_PWD' -n
    -i '@SCRIPTS_LOC'drop_whse_indexes.sql 2>&1'
    EXEC @rc = master.dbo.xp_cmdshell @DROP_INDEXES
    IF @rc <> 0
    BEGIN
      update
    WH_DATA_LOAD_STATS set time_ended=getdate(), status='failed' where
    process='drop indexes'
    END
    ELSE
    BEGIN
      update
    WH_DATA_LOAD_STATS set time_ended=getdate(), status='success' where
    process='drop indexes'
    END
    /DTS PKG/
    insert into WH_DATA_LOAD_STATS (time_started, process)
    values (getdate(), 'DTS pkg')
    SET @DTS_PKG = 'dtsrun /S '@WH_DB_SERVER_NAME' /U sa /P
    abcdefg123 /N '@DTS_PKG_NAME' 2>&1'
    EXEC @rc = master.dbo.xp_cmdshell @DTS_PKG
    IF @rc <> 0
    BEGIN
      update
    WH_DATA_LOAD_STATS set time_ended=getdate(), status='failed' where process='DTS
    pkg'
    END
    ELSE
    BEGIN
      update
    WH_DATA_LOAD_STATS set time_ended=getdate(), status='success' where
    process='DTS pkg'
    END
    /CREATE INDEXES/
    insert into WH_DATA_LOAD_STATS (time_started, process)
    values (getdate(), 'create indexes')
    SET @CREATE_INDEXES = 'isql -U '@WH_UNAME' -P '@WH_PWD'
    -n -i '@SCRIPTS_LOC'create_whse_indexes.sql 2>&1'
    EXEC @rc = master.dbo.xp_cmdshell @CREATE_INDEXES
    IF @rc <> 0
    BEGIN
      update WH_DATA_LOAD_STATS
    set time_ended=getdate(), status='failed' where process='create indexes'
    END
    ELSE
    BEGIN
      update
    WH_DATA_LOAD_STATS set time_ended=getdate(), status='success' where
    process='create indexes'
    END
    /UPDATE STATISTICS/
    insert into WH_DATA_LOAD_STATS (time_started, process)
    values (getdate(), 'update statistics')
    SET @UPDATE_TBL_STATS = 'isql -U '@WH_UNAME' -P
    '@WH_PWD' -n -i '@SCRIPTS_LOC'update_whse_stats.sql 2>&1'
    EXEC @rc = master.dbo.xp_cmdshell @UPDATE_TBL_STATS
    IF @rc <> 0
    BEGIN
      update
    WH_DATA_LOAD_STATS set time_ended=getdate(), status='failed' where
    process='update statistics'
    END
    ELSE
    BEGIN
      update
    WH_DATA_LOAD_STATS set time_ended=getdate(), status='success' where
    process='update statistics'
    END
    /*select upper(process)'('status')'char(10)
    char(9)'Started on '+convert(varchar(8), time_started, 114)
                  +' ended
    on '+convert(varchar(8), time_ended, 114)
                  '   DURATION:'convert(varchar,datediff(mi,
    time_started, time_ended))+' minutes.'
          AS "REPORT"
    from WH_DATA_LOAD_STATS
    /*select process
         , status
    convert(varchar(8), time_started, 114) as "START_TIME"
    convert(varchar(8), time_ended, 114) as "END_TIME"
    convert(varchar,datediff(mi, time_started, time_ended)) as
    "DURATION_in_MIN"
    from WH_DATA_LOAD_STATS
    /*select '('status') 'upper(process)'Started on
    'convert(varchar(8), time_started, 114)' ended on '+convert(varchar(8),
    time_ended, 114)+' 
    DURATION:'convert(varchar,datediff(mi, time_started, time_ended))'
    minutes.' AS "REPORT"
    from WH_DATA_LOAD_STATS
    RETURN
    go

    Post Author: yangster
    CA Forum: Crystal Reports
    you are over thinking the problemsimply create a parameter within crystal for your state and change it to allow multiple valuesthen in the select expert put in state = ?stateif you do show sql query you will see that the values are pushed down to the sql level thus no performance hit vs putting the parameter directly in the command itself

  • Connection error with Crystal Report XI, VB6 and Sybase ASE15

    Hello !
    I have an error #4002 when I want to launch a report in VB6 with the ActiveX Crystal Report Viewer.
    I use Sybase ASE 15 with an ODBC link and the reports run stored procedures.
    This error seems to be an authentification error, but I don't know what parameters are missing or wrong...
    - My reports works well in the report designer.
    - The reports connected to a text file or an ADO recordset work in VB6.
    - The Verify Database works in design mode in VB6.
    - The problem is the same with tables, stored procedures, SQL and with or without parameters...
    - I tried to connect the report to a DataEnvironnment but I get the same error.
    The problem appears when I use the Crystal Wizard to create a form automatically AND when I create objects directly in code like :
        Dim crapp As CRAXDRT.Application
        Dim oReport As CRAXDRT.Report
        Set crapp = New CRAXDRT.Application
        Set oReport = crapp.OpenReport("C:\myreport.rpt")
        CRViewer.ReportSource = oReport
        CRViewer.viewReport
    Please help !

    Hello,
    I don't see any database logon code in what you posted.  You need to log onto the database at runtime since Crystal Reports will never store passwords.
    You can download and review the [Connection Properties|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00635998-751e-2b10-9cba-f50ee1e4ef81] document for more information on how to log onto your database at runtime.  This document was written for CR9, but it's the same for CR10, CR XI (v11.0), and CR XI R2 (v11.5).
    I hope this helps.
    Sincerely,
    Dan Kelleher

  • If image file not exist in image path crystal report not open and give me exception error problem

    Hi guys my code below show pictures for all employees
    code is working but i have proplem
    if image not exist in path
    crystal report not open and give me exception error image file not exist in path
    although the employee no found in database but if image not exist in path when loop crystal report will not open
    how to ignore image files not exist in path and open report this is actually what i need
    my code below as following
    DataTable dt = new DataTable();
    string connString = "data source=192.168.1.105; initial catalog=hrdata;uid=sa; password=1234";
    using (SqlConnection con = new SqlConnection(connString))
    con.Open();
    SqlCommand cmd = new SqlCommand("ViewEmployeeNoRall", con);
    cmd.CommandType = CommandType.StoredProcedure;
    SqlDataAdapter da = new SqlDataAdapter();
    da.SelectCommand = cmd;
    da.Fill(dt);
    foreach (DataRow dr in dt.Rows)
    FileStream fs = null;
    fs = new FileStream("\\\\192.168.1.105\\Personal Pictures\\" + dr[0] + ".jpg", FileMode.Open);
    BinaryReader br = new BinaryReader(fs);
    byte[] imgbyte = new byte[fs.Length + 1];
    imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length)));
    dr["Image"] = imgbyte;
    fs.Dispose();
    ReportDocument objRpt = new Reports.CrystalReportData2();
    objRpt.SetDataSource(dt);
    crystalReportViewer1.ReportSource = objRpt;
    crystalReportViewer1.Refresh();
    and exception error as below

    First: I created a New Column ("Image") in a datatable of the dataset and change the DataType to System.Byte()
    Second : Drag And drop this image Filed Where I want.
    private void LoadReport()
    frmCheckWeigher rpt = new frmCheckWeigher();
    CryRe_DailyBatch report = new CryRe_DailyBatch();
    DataSet1TableAdapters.DataTable_DailyBatch1TableAdapter ta = new CheckWeigherReportViewer.DataSet1TableAdapters.DataTable_DailyBatch1TableAdapter();
    DataSet1.DataTable_DailyBatch1DataTable table = ta.GetData(clsLogs.strStartDate_rpt, clsLogs.strBatchno_Rpt, clsLogs.cmdeviceid); // Data from Database
    DataTable dt = GetImageRow(table, "Footer.Jpg");
    report.SetDataSource(dt);
    crv1.ReportSource = report;
    crv1.Refresh();
    By this Function I merge My Image data into dataTable
    private DataTable GetImageRow(DataTable dt, string ImageName)
    try
    FileStream fs;
    BinaryReader br;
    if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + ImageName))
    fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageName, FileMode.Open);
    else
    // if photo does not exist show the nophoto.jpg file
    fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageName, FileMode.Open);
    // initialise the binary reader from file streamobject
    br = new BinaryReader(fs);
    // define the byte array of filelength
    byte[] imgbyte = new byte[fs.Length + 1];
    // read the bytes from the binary reader
    imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length)));
    dt.Rows[0]["Image"] = imgbyte;
    br.Close();
    // close the binary reader
    fs.Close();
    // close the file stream
    catch (Exception ex)
    // error handling
    MessageBox.Show("Missing " + ImageName + "or nophoto.jpg in application folder");
    return dt;
    // Return Datatable After Image Row Insertion
    Mark as answer or vote as helpful if you find it useful | Ammar Zaied [MCP]

  • Crystal Reports in Command Line mode

    Where can i find a complete list of the different parameters i can use crystal reports in command line mode with?

    Command-line mode?
    Sincerely,
    Ted Ueda

  • Difference between Crystal Reports Server 2008 and Business Objects XI R2

    Can anyone please help me know the difference between Crystal Reports Server 2008 and Business Objects XI R2? Both the support guides says that it supports Office 2007. I have a problem in exporting the reports to Excel 2007 .I have downloaded the trial version of Crystal Reports Server 2008 but still unable to view my  complete reports in Excel 2007 through infoview because few of my report's colums are truncated and it still exports in Excel 2003.I have LiveOfficeXIR2_SP4 and Office 2007 installed. Is it so that i have to switch over to Business Objects XI R2 or any other to solve my problem instead of using Crystal Reports Server 2008 or is it the problem with the version of my Live office.Pls help me regarding this..
    Babita.

    Babita,
    request you to post the same in the BO forums for more relevant answers...
    Arun

  • Deploying Crystal Reports 2008 runtimes without using MSI/MSM

    Post Author: windentdev
    CA Forum: Deployment
    We are having multiple issues with using the MSI or the Merge module to deploy the 2008 runtimes.
    Specifically, one of the issues is that PrintControll.dll will not register and causes the runtime package to fail.
    How can we deploy these run times w/o using the MSI or merge module??
    We just upgraded from Crystal Reports 11.5 and this is becoming a burden to our project.  Are there any whitepapers on what is needed or any other instruction that may assist us in a sucessful deployment of these runtimes?

    Post Author: Justin Azevedo
    CA Forum: Deployment
    I eventually found the problem. I used depends to trace the printcontrol.dll and found that it requires msvcr71.dll to be installed in the system folder. This is a Visual C++ 7.1 (.net 2003) library. It looks like Business Objects forgot to put this into their runtime installer. That is why it works on some computers and not others. Some computers have this dll file installed as part of other software (including other crystal reports versions). I created a patch installer that basically drops this dll file into the system folder. Once that is done, then the runtime installs correctly.
    If you would like to recreate this problem, try installing the CR2008 runtime (MM, EXE, or compact) on a FRESH copy of Windows. It will error out everytime.
    If anyone reading this would like my patch, please send me an email.

  • Crystal Reports with BEx Query using Custom Exit Variable

    Hi,
    We have BW BEx Query using Customer User Exit variable to derive  the Fiscal Week for Last Year (called it VAR2) based on another user input variable Current Fiscal Week (called it VAR1).
    VAR2 is derived from VAR1 in CMOD via some codings and thus it DOES NOT have the "Variable is Ready for Input" flag ticked in the BEx. VAR1 is user input variable, so it has "Variable is Ready for Input" flag ticked in the BEx.
    When we create a Crystal Reports with the BEx Query using variable VAR2, and when we run it we got an error message saying "Failed to execute query; '[]<java.lang.UnsupportedOperationException: No Selection State Support!ZP_MI_LYPUBWEEK>'. Redesign your query or contact the data source maintainer to solve the problem".  (note: ZP_MI_LYPUBWEEK is VAR2 in this case).
    Could anyone please assist? Surely, CR supports BEx customer user exit variables like the above, right?. I also refer to the forum below as it seems to have a similar issue (except mine with an error message), but it does not provide a solution in it.
    Crystal Reports with BEx Query using Custom Exit Variable
    Thanks,
    Andy

    Hi Vibhav,
    We have the SAP Crystal Reports for Enterprise XI4.0 Version 14.0.0. Not sure if SP0 or other SP, got to check with Basis Team later.
    We tried that "mandatory" option and did not work either.
    Anyway, SAP has now come back again saying it is something they will fix it in next release/version. We got a phone call from them and a reply below to our OSS.
    23.08.2011 - 08:20:49 CET - Info for Customer by SAP  
    I have raised this issue on the Idea#s Place as an enhancement request
    on the below link:
    https://cw.sdn.sap.com/cw/ideas/5586
    This ER contains the information of including the customer exit
    variables in the report without checking the #input for ready# option.
    This ER can be considered for being implemented in the future
    versions. You can refer to SAP Note: 1515837 - How To: Enhancement
    Request Process - "Idea Place" for more information regarding the Idea
    Place.
    Cheers,
    Andy

  • Question about Crystal Reports 4.0 and "cross database joins"

    Hi everybody,
    in Crystal Reports 2008 we could use the cross database joining feature to put two or more BEx queries via MDX into one report and join them within Crystal Reports. We know that this might lead to performance problems but for some scenarios this was the only solution.
    Now with Crystal Reports for Enterprises 4.0 the whole connection to SAP systems will change. Will we have a chance to make one report agains two or more BEx queries any other way than using subforms. The latter will not fit our needs.
    Thank you very much!
    Thorsten

    Hi,
    Crystal Reports 4.0 is in RampUp right now. In case you are interested in the details I would suggest you join the RampUp.
    regards
    Ingo Hilgefort

  • Crystal Reports ActiveX Design and RT Library

    I have developed an application using eDeveloper and the CRACDDRT.DLL using COM Interface.
    Hos can I distribute the dll to a customer computer so that when I run my program it will find the registered COM Object

    Hello, Motty;
    What program and version are you using to create your application?
    What version of Crystal Reports Developer are you using?
    What references do you have for Crystal Reports in your application? CRAXDRT.dll or CRAXDDRT.dll and the CRViewer.dll?
    Does the application run as you expect on your Development system?
    Once I am more certain of what you are using, I can direct you to the correct deployent information.
    Elaine

Maybe you are looking for

  • Can I run 2 wireless networks on the same single internet connection?

    I wanted to be able to use only my WRT350N to be able to broadcast "N" out into the yard but because it does not broadcast as far as the WRT54G I will have to settle on plan B. I want to set up two wireless networks using my WRT54G V1 with a WSB24 an

  • RETURN PROCESS IN EXCISE

    Step 1  In->QT->OR>vl01n->vf01-->vf02->j1iin---- > What is the return process Can u plz explain return process and credit memo process in HOW WILL WE CREATE EXCISE IN CREDIT MEMO.............. 2.Re  Cr..---- What next…> murli.

  • What's the best WMV to MOV Video Converter?

    Hi, What's the best .WMV to .MOV Video Converter? I'm trying to edit imported .WMV files in iMovie HD but iMovie HD doesn't seem to recognize .WMV files. Any help would be greately appreciated, Thank you.

  • SAP Conversion Agent

    Hi, I have browsed the net for quite some time to get some idea about EDI message handling in XI using the SAP Conversion Agent (CA). I have understood what is CA all about. but i still have few questions unanswered. 1. How flexible or complex it is

  • Ora-00933 sql not properly ended.

    Dear members, I have the following query in Report Builder 10g, select a, b, c from table1 where a=12 &p_whr_fy &p_whr_supp &p_whr_bt &p_whr_mat_spec &p_whr_lc_num &p_whr_cotton &P_WHR_LOC_ID union all select a, b, c from table2 where a=12 &p_whr_fy