CR XI SQLQueryString

Post Author: mudEyes
CA Forum: General
Apologies for the General post but I haven't had any response from the Database and Connectivety forum.
I need to get the SQLQueryString from a report at runtime in VB6. the syntax I'm using to do this is-
variable = crxReport.SQLQueryString
This returns the SQLQueryString but not until it has executed the query on the database(SQLServer 2005) drastically slowing down my application, even though I can see the string in the locals window.
Does anyone know how I get the SQLQueryString without hitting the database?

Hi Daniel,
To get appropriate assistance on this issue please post your question on Business Objects SDK application Development forums.
Thanks,
Sumit Kanhe

Similar Messages

  • What happened to CRAXDRT.Report.SQLQueryString?

    Hi,
    I'm moving some code up from vb6, and the old ActiveX Reports Viewer.  The code used "CRAXDRT.Report.SQLQueryString".  This property contained the SQL query fired by the report.
    In the new .Net version, I am unable to locate a property that gives me the SQL that the report used
    My question:
    In the .Net Crystal Report assemblies, how can I obtain the SQL Query fired by the report?
    Thanks,
    Scott Pearce

    Hi Scott,
    Here's the code to get it:
                GroupPath gp = new GroupPath();
                string tmp = String.Empty;
                rptClientDoc.RowsetController.GetSQLStatement(gp, out tmp);
                MessageBox.Show(tmp, "Data Source Set and SQL Statement", MessageBoxButtons.OK, MessageBoxIcon.Information);
    You CAN NOT apply changes to the SQL CR generates any more though on reports based on connection to the tables. You can however edit the SQL on reports based on Command Objects.
    If you have a report that uses 1 or 2 tables then here's the code to convert it to a Command Object. If you have more tables then you'll have to do it manually:
            private void TableToCommand_Click(object sender, EventArgs e)
                CrystalDecisions.CrystalReports.Engine.ReportDocument rpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
                ISCDReportClientDocument rcd;
                rcd = rptClientDoc;
                rptClientDoc.DatabaseController.LogonEx("Dwilliams1 - VAN-W-13-DWILLI", "xtreme", "sa", "pw");
                CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo oldConninfo;
                CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo newConnInfo = new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();
                CrystalDecisions.ReportAppServer.DataDefModel.Table oldTbl;
                CrystalDecisions.ReportAppServer.DataDefModel.CommandTable newTbl = new CommandTable();
                oldTbl = (CrystalDecisions.ReportAppServer.DataDefModel.Table)rcd.Database.Tables[0];
                oldConninfo = oldTbl.ConnectionInfo.Clone(true);
                GroupPath gp = new GroupPath();
                gp.FromString("");
                string sql = String.Empty;
                rptClientDoc.RowsetController.GetSQLStatement(gp, out sql);
                PropertyBag QEProps = new PropertyBag();
                PropertyBag logonProps = new PropertyBag();
                //Set the attributes for the logonPropsBag
                logonProps.Add("Database", "xtreme");
                logonProps.Add("DSN", "Dwilliams1 - VAN-W-13-DWILLI");
                logonProps.Add("UseDSNProperties", "False");
                //Set the attributes
                QEProps.Add("Database DLL", "crdb_odbc.dll");
                QEProps.Add("QE_DatabaseName", "xtreme");
                QEProps.Add("QE_DatabaseType", "ODBC (RDO)");
                //Add the QE_LogonProperties we set in the logonProps Object
                QEProps.Add("QE_LogonProperties", logonProps);
                QEProps.Add("QE_ServerDescription", "Dwilliams1 - VAN-W-13-DWILLI");
                QEProps.Add("QE_SQLDB", "True");
                QEProps.Add("SSO Enabled", "False");
                newConnInfo.Attributes = QEProps;
                newConnInfo.UserName = "sa";
                newConnInfo.Password = "pw";
                newConnInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;
                newTbl.ConnectionInfo = newConnInfo;
                newTbl.CommandText = sql;
                newTbl.Name = "Command";
                    rcd.DatabaseController.SetTableLocationEx(oldTbl,newTbl);
                    oldTbl =(CrystalDecisions.ReportAppServer.DataDefModel.Table) rcd.Database.Tables[0].Clone(true);
                    rcd.DatabaseController.SetTableLocationEx(oldTbl, newTbl);
                // save the report to a new folder
                //rcd.SaveAs(rcd.DisplayName, "c:
    Updated
    ", 0);
    Look in the samples on altering the SQL of a command or use the same code above to do so.
    Thank you
    Don

  • How can I modify the SQLQueryString at runtime? (VB6 Application, CR XI)

    I have created a report in Crystal Reports XI which uses a stored procedure to retrieve data. The report was created using our test database (AS/400 DB2) as its datasource. In our Visual Basic 6 application we want to be able to run against the production database. In the code a CRAXDRT.Report object is instantiated and the .rpt file is specified in the OpenReport command. I can see that the SQLQueryString property is {CALL "TESTSERV"."ABCLIB"."RPT_ONE_SP"}, where TESTSERV is the test machine, ABCLIB is the library (Default Collection property value in the connection properties which can be modified) and "RPT_ONE_SP" is the stored procedure name. If a change to the SQLQueryString is attempted an error is raised. Even if all connection properties are changed the stored procedure call still defers to what is specified in the call (from the .rpt file). Is there a workaround for this situation?

    Hi Daniel,
    You can't change the info directly in the SQL you have to use the .Location method. This will update the SQL and re-direct from your original server to the new server.
    Please read the info in the link Dan attached to is first reply. It will show you how to do this and it does work.
    Once you set all the logon info then use the .Verify method or Testconnectivity API to confirm it's going to the new Server. Then export the report to RPT format to confirm the new logon info is saved.
    Changing to SQL Server (OLE DB) at Runtime
    'Declare a Connection Info Object
    Dim ConnectionInfo As CRAXDRT.ConnectionProperties
    'Set the Connection Info to Connection Properties of u2018the table object
    Set ConnectionInfo = Report.Database.Tables(1).ConnectionProperties
    'Set the DLL name
    Report.Database.Tables(1).DLLName = u201Ccrdb_ado.dllu201D
    'Clear the ConnectionProperties collection
    ConnectionInfo.DeleteAll
    'Add the OLE DB Provider
    ConnectionInfo.Add u201CProvideru201D, u201CSQLOLEDBu201D
    'Add the physical server name
    ConnectionInfo.Add u201CData Sourceu201D, u201CServer nameu201D
    'Add the database name
    ConnectionInfo.Add u201CInitial Catalogu201D, u201CDatabase nameu201D
    'Add the user name
    ConnectionInfo.Add u201CUser IDu201D, u201CUser nameu201D
    'Add the password
    ConnectionInfo.Add u201CPasswordu201D, u201CPasswordu201D
    'Set the fully qualified table name if different from u2018the original data source
    Report.Database.Tables(1).Location = u201Cdatabase.owner.tablenameu201D
    Thank you
    Don

  • SqlQueryString truncating

    Post Author: pross
    CA Forum: Data Connectivity and SQL
    This is a strange one, all of a sudden (well of course this starts happening at the tale end of deployment) I am getting this string truncating, which is causing a "the matching ' is missing " error to be written to the SqlQueryString variable
    I am using VB6 and CR8.5  (don't give me grief over this -- we are going to upgrade as soon as these changes are complete)
    When calling the report, it is pulling up my CR .rpt file, however only taking a portion of my query
    Example:
    Query from CR:
    SELECT
        case_file."cf_month", case_file."cf_officer_service_income", case_file."cf_enlisted_service_income", case_file."cf_enlisted_billed", case_file."cf_officer_billed", case_file."cf_enlisted_collected", case_file."cf_officer_collected", case_file."cf_collection_voucher", case_file."cf_editing_comments",
        activity."activity_id", activity."disbursement_appropriation_id", activity."act_fy", activity."act_uic", activity."act_source_code", activity."act_description", activity."act_dsb_auth_acc_act", activity."act_dsb_prop_acc_act", activity."act_acc_class_rpt_no", activity."act_strength_type", activity."act_approved_by",
        authorizations."aut_annual_authorized", authorizations."aut_annual_enl_authorized", authorizations."aut_annual_off_authorized", authorizations."aut_order_number", authorizations."aut_authorization_date", authorizations."aut_comments"
    FROM
        { oj ("Mpnrs"."dbo"."case_file" case_file INNER JOIN "Mpnrs"."dbo"."authorization" authorizations ON
            case_file."activity_id" = authorizations."activity_id")
         INNER JOIN "Mpnrs"."dbo"."activity" activity ON
            case_file."activity_id" = activity."activity_id"}
    ORDER BY
        activity."activity_id" ASC,
        case_file."cf_month" ASC
    String picked up:
    "SELECT
        case_file."cf_month", case_file."cf_officer_service_income", case_file."cf_enlisted_service_income", case_file."cf_enlisted_billed", case_file."cf_officer_billed", case_file."cf_enlisted_collected", case_file."cf_officer_collected", case_fil"
    Anyone else seen this phenomenon?

    SimpleDateFormatter

  • Cannot get  SQLQueryString from crystal report if no database connection..

    Hi,
    I am using craxdrt.dll to create a crystal report object.
    I want to get the SQLQueryString used in crystalreport even if i dont have databse connection or even database on my local computer.
    How can I do this?
    Is there any other way to do this without connecting to database?
    I just want to  read its SQLQueryString Property.
    Please Help me.
    I am in need of it.

    The Clear answer is NO, as I said, only way to get the SQL is to connect to a DB of some type.
    As a work around you can get the SQL if you have a dummy database to connect to. But you do need to know what type the report was designed off of or you take the chance of getting incorrect SQL. We can help you a bit here. Using the RDC you can get 2 DB types:
    crSQLDatabase or crStandardDatabase, first one is if the report was designed off a SQL database like
    MS SQL Server or Oracle etc and the second one is if it's based on a PC type like Access or Dbase. Although if it is PC based there may not be any SQL to get unless the PC DB supports SQL queries. If they don't then no SQL can be returned.
    Is there a specific reason why you need to get the SQL?
    Thank you
    Don

  • Report Deisgn Component error

    Hello,
    I have an application running crystal reports XI using the Report Design component and the ActiveX viewer to display the report, everything works great on a virtual machine, now I am moving everything to a different machine and is not working and worse is not reporting an error.
    Here is what's going on, application object is created ok, and the report object is apparently ok, but when I try to access some properties like SQLqueryString my application crash.
    Code:
    Set session("oApp") = Server.CreateObject("CrystalRuntime.Application.11")
    reportname = Request.QueryString("reportName")
    If Not IsObject (session("oApp"))
      Then Call LogOntoAppRptServer()
    End If
    Set Session(oRptName) = session("oApp").OpenReport("C:\REPORTS\" & reportname, 1)
    Session(oRptName).MorePrintEngineErrorMessages = False
    Session(oRptName).EnableParameterPrompting = False
    'Session(oRptName).DiscardSavedData
    Set mainReportTableCollection = Session(oRptName).Database.Tables
    For Num = 1 To mainReportTableCollection.Count  'TestConnectivity returns true
      If mainReportTableCollection.Item(Num).TestConnectivity = False
        Then mainReportTableCollection.Item(Num).SetLogOnInfo "skylightserver.dsn", , _
                                                              CStr(usr), CStr(pwd) End If
    'Application freezes if I try to access some properties
    Call Session(oRptName).ReadRecords
    'Application aborts right here without error
    Questions:
    -Could it be happening because I am using the same license on both systems?
    -Could it be a problem because virtual machine is on my network Domain and the second is in a Workgroup?
    -What else could it be?
    Thanks,
    Rafael Velez
    Edited by: Rafael Velez C on Apr 1, 2009 3:30 PM

    Moving thread as this is RDC in a ASP
    Ludek

  • How to change Crystal Reports XI database name at run time from ASP code using ADO

    Dear All,
    I need advises regarding to my problem below
    I have two database in same SQL 2005 SERVER for TEST01 and LIVE01 Environtment, and I've created more than 100 reports with Crystal Reports 11 and call it from ASP classic page.
    The problem is how can I change a database from TEST01 to LIVE01 at the run time from ASP code as I already using TEST01 database on Crystal Reports and I do not want to set a new database location inside crystal for each reports
    Thanks and wait for your reply soon.
    Below is my code, which has no effect to crystal reports although I've change the database from TEST01 to LIVE01:
    <%
    Dim oADOConnection, oRptTable, oADORecordset, sql
    Dim struser, strpwd, strdriver, dblocation, dbname, strConnect
    struser = "sa"
    strpwd = ""     
    strdriver = "{SQL SERVER}" 
    dblocation = "SQL200501"     
    dbname = "LIVE01"    ' Changed from TEST01 to LIVE01
    strConnect = "User Id=" & strUser & ";"
    strConnect = strConnect & "PWD=" & strPwd & ";"
    strConnect = strConnect & "DRIVER=" & StrDriver & ";"
    strConnect = strConnect & "SERVER=" & DBLocation & ";"
    strConnect = strConnect & "DATABASE=" & dbName
    sql="Select * from Employee"
    Set session("oApp") = Server.CreateObject("CrystalRuntime.Application.11")
    Set session("oRpt") = session("oApp").OpenReport("C:\REPORTS\RPT01.RPT", 1) 'USING TEST01 DATABASE
    session("oRpt").MorePrintEngineErrorMessages = False
    session("oRpt").EnableParameterPrompting = False
    session("oRpt").DiscardSavedData
    Set oADOConnection = Server.CreateObject("ADODB.Connection")
    oADOConnection.Open (strConnect)
    Set oADORecordset = Server.CreateObject("ADODB.Recordset")
    Set oRptTable = session("oRpt").Database.Tables.Item(1)
    oRptTable.SetDataSource oADORecordset, 3
    session("oRpt").SQLQueryString = CStr(sql)
    session("oRpt").ReadRecords
    %>

    Did you ever find a solution to this problem?  I have the same problem when moving reports from development to Test to Production environments.  If the DBName is not the same the report ignores the name provided at runtime.

  • Migrating from Crystal Reports 9 to 2008 Issue

    Hello,
    We have quite a few reports in our product that were built of of tables in a database.  One report in question has fields from two tables. We used to load the report in VB6, and set the SQLQueryString property on the report equal to a select statement to select specific rows for the report.
    We are trying to change these reports to use DataSets.  The idea is to populate a dataset with all the data the report needs, and set that as the data source.  No matter what I do, i cannot seem to get data to show up in the report.  I've tried creating a dataset with two tables, named identically to the tables we were using out of the database, and then filling the dataset with ALL the records from both tables.  Then I tried creating a dataset with one table, with columns from both tables, neither seem to work.
    After creating the dataset, we are using the Set datasource location in Crystal, and updating it to use the Dataset we created.  I've verified the dataset has rows, and everything seems like it -should- work fine, but no data is populated.
    I did notice that when changing the datasource location to the dataset, the Tables retained their old names with the name of the table in the dataset in parenthesis.  I thought about merging all the fields from both tables into just one table from the dataset, but could not find an easy way to do this without having to completely redesign the report.
    Any suggestions would be greatly appreciated. Thanks!

    Moved your post to the .NET SDK forum.
    Ah, that will be a problem, CR no longer allows editing the SQL statement so those old reports are going to cause problems.
    First also, you did not say but you can't use the RDC or OCX or CR 2008 in .NET 2010
    Go to this page and download the CR for VS 2010 installer: http://www.sdn.sap.com/irj/boc/crystalreports-dotnet
    Bottom of the page: http://downloads.businessobjects.com/akdlm/cr4vs2010/CRforVS_13_0_1.exe gets CR installed into VS 2010.
    Then you can use RAS which is the replacement for the OCX and RDC.
    Then if you need .NET samples see this page to get you going:
    http://wiki.sdn.sap.com/wiki/display/BOBJ/NETRASSDK+Samples#NETRASSDKSamples-Exporting%2FPrinting
    A couple of ways to possibly fix those legacy reports.
    General over view is to:
    1. Rebuild your reports from scratch and use your XML files as the data source
    2. Rebuild your reports and use the DataSet as your report source ( BIG warning here, DS's are limited to the amount of data so better to use XML as the source )
    3. Hit the Database directly and use Record Selection API's to add your filters to the data
    4. Use database Command which allows you to enter SQL directly and edit it in code.
    All methods are likely going to have problems due to you altering the SQL manually.
    The replacement for edited SQL in legacy reports is to use a Command Object, you see this in the database wizard.
    I have code that will convert a report based on 1 or 2 tables and convert it to a Command Object as the data source but this may not work for you depending on what the report started with.... More tables and it won't work.
    Not going to suggest DS's as they will cause problem for the end user when they start using your app to archive the database.
    For XML, use the below code to get your data into a DS and then save the DS as a XML file with the Schema.
    Once connected to your data sources use this code to export/save the DS to XML format:
    // this writes to the data and schema to a file
                ds.WriteXml("c:
    sc.xml", XmlWriteMode.WriteSchema);
    // this sets the report data source to the DS or XML file
                rpt.SetDataSource(ds);
    Once you have it save in XML format you can now create your reports of the XML file, Set Location likely won't work for you.
    You can then not use DS's in your app and simply dump the database fields you are using into the XML. Once this is done simply updating the XML file will refresh the data in the report.
    For using Command Objects
    You can get the SQL from your old reports and then set the SQL of your Command using RAS. I've never tried this with edited Legacy Reports but should work as long as you don't use or try to update the Legacy report in code.
    Once you do manually re-create the legacy reports or possibly using the Table -> Command code you can then modify the SQL to follow your original report progression in your legacy app.
    Let me know which route you want to go and I'll paste in the code to get you started...
    Thank you
    Don

  • Report is generating very slowly

    Hi all, my crystal report is generating very very slowly my report is having many sub reports inside it as well,
    see the time difference in the following lines that comes out while generating the report from my Application, please comment how can i solve this
    03/26/2014 06:03:47 PM ... Process({User I/F} Priority: 4, user interface)
    a RDCReport is getting OLE property "SQLQueryString" with arguments: ()
    03/26/2014 06:07:38 PM ... Process({User I/F} Priority: 4, user interface)
    Get OLE Property "SQLQueryString" returned: SELECT "TABLE"."COLUMNS" .................... long long query here
    No functions or cursors have applied in crystal report but still it is taking too long to generate

    hi Muhammad,
    what happens if you run the report in the report designer, i.e. crw32?
    i would suggest looking at your subreports as running a lot of details level subs in a report is going to be slow. if you've got subs on the details level, one query will be run per subreport on each record, which will eat up a lot of processing.
    sometimes subreports can be eliminated as well...for example, if your subreport contains the same tables as your main report, you can get rid of a subreport and substitute it for a cross-tab if you're only showing data in tabular format.
    try suppressing all of your subreports as well, and then un-suppress them one at a time, refreshing the report each time a subreport is unsuppressed. perhaps there is one particular subreport that is a problem.
    if you only find that your subreport is slow in your application, please post a new discussion to the crystal reports for visual studio forum.
    -jamie

  • Error messages in console related to iDVD

    OSX 10.7.2 / iLife11 ( iDVD 7.1.2 installed)
    This is the kind of message I can see in my console :  (multiple...)
    Nov 17 09:34:59 MacErwin com.apple.mdworker.i386.0[507]: SQL error: column MovieURL is not unique
    Nov 17 09:34:59 MacErwin com.apple.mdworker.i386.0[507]: sqlQueryString = INSERT INTO Movies (MovieURL) VALUES ('/Users/yves/Library/Application Support/iDVD/Installed Themes/iDVD 5/0006_Travel.theme/Contents/Resources/Travel_Loop_Compass_NTSC.mov');
    any clue or feedback ?

    Just guessing here, but look at this page,
    http://msdn.microsoft.com/en-us/library/dd877045%28v=exchg.140%29.aspx
    Does anything there "ring any bells" on anything you might have been doing recently? Of course I don't think any of that would have any relationship with the apple Mail app.

  • Logon failed. Detail [Database Vendor Code: 1005]

    The application make use of ODBC to connect to Oracle database
    The way the reports are produced in the current VB application is by using the following line of codes
    cryQueryReport.Connect = ObjAdoConnection.sADOconnectstr
    cryQueryReport..SQLQuery =  sSQL & sSortString
    along the way the application also passes String value to the formular fields defined in the reports by making use of the following line of code
    cryQueryReport.Formulas(iFormulanumber) = "TITLE_1 = '" & mrsReportItems("TITLE_1") & "'"
    Now the codes have been modified to the following to accommodate the upgrade
    If Report2 Then
        'open the report
          Set MyReport = CrystalReport2
      Else
          Set MyReport = CrystalReport1
      End If
    'Crystal Report2 includes fields from 9 different tables
    'Crystal Report1 includes fields from 10 different tables
    For i = 1 To MyReport.Database.Tables.Count
      With MyReport.Database.Tables(i)
            Set ConnectionInfo = .ConnectionProperties
            .DllName = "crdb_odbc.dll"
            ConnectionInfo.DeleteAll
            ConnectionInfo.Add "DSN", "DSN Name"
            ConnectionInfo.Add "User Id", "User ID"
            ConnectionInfo.Add "Password", "Password"
      End With
    Next i
    MyReport.SQLQueryString = sSQL & sSortString
    For intCounter = 1 To MyReport.FormulaFields.Count
        If MyReport.FormulaFields(intCounter).FormulaFieldName = "TITLE_1" Then
            MyReport.FormulaFields(intCounter).Text = mrsReportItems("TITLE_1")
        End If
    Next intCounter
    CrystalActiveXReportViewer1.ReportSource = MyReport
    CrystalActiveXReportViewer1.ViewReport
    The error message pops up that says Run-time Error '2147189176 (80047e48)'   Logon failed. Detail [Database Vendor Code: 1005]
    when Ok is clicked, another error message says Run-time Error '214191854 (800473d2)':  The remaining text does not appear to be part of the formula.
    Could anyone tell me what is wrong with the way the Logon information is coded?
    Thank you for your time

    This post is being handled through an open support incident with the Developer Support team.
    It appears to be an issue upgrading from an earlier version of Crystal Reports using the old crystl32.ocx to the RDC SDK in Visual Basic 6.0.
    Elaine
    Edited by: Elaine Dove on Jul 6, 2009 2:47 PM

  • Converting a Crystal 4.6 report to Crystal XI using Visual Basic 6.0

    I followed instructions for migrating from the OCX to the RDC.....
    and the Crystal viewer will open but it's not passing my sql query to the crystal report,
    so it ends up loading every single record in the database. I tried adding code to
    actually open the db, but that didn't seem to work.
    Your help is greatly appreciated!
    Set rsCrystal = New ADODB.Recordset
    rsCrystal.Open Csql, gdb, adOpenStatic, adLockReadOnly
    Form 1
    'Declare the application object used to open the rpt file.
    Dim CrystalApp As New CRAXDDRT.Application
    'Declare the report object
    Public CrystalReport As CRAXDDRT.report
    Form_Load
    Reportname = Path + Filename
    Set CrystalReport = CrystalApp.OpenReport(Reportname, 0)
    end sub
    Private Sub Command1_click
    ' Call form2 to preview the report
    Form2.show
    end sub
    Form 2
    Private sub Form_load
    CRViewer1.Reportsource = Form1.CrystalReport
    CRViewer1.ViewReport
    end sub
    Nancy

    What I needed to do is set the viewer's reportsource to the sqlquerystring
    from the Crystal Report object.
    In the print module of form1 (where you select if view or print):
    CRReport.SQLQueryString = "Select....from....where"
    In the load module of form2 (viewer):
    CRViewer.ReportSource = frmPrint.CRReport

  • Very Slow Run Time Performance OpenEdge (Progress)

    Hello everyone,
    I am working with Crystal Reports XI R2. Also we have developed an export application based on OpenEdge 10.1B (Progress 4GL).
    Problem: The export of any Crystal Reports file to PDF format takes (via application in Progress) takes 5 times or more time than when I just export that report via Crystal Reports XI. There is an ODBC connection via OpenEdge 10.1B to DWH SQL92.
    I have monitored the performance. It seems when the Crysta Reports try to communicate to the query or dataset, it takes longer time. In some situation  the temp file is already filled out in Win Temporary directory, and then it waits so long to populate the data within CR and finally exports to PDF.
    What is wrong? Please HELP!!!!!!

    A part of codes:
    if not gLog_Batch
    then do:
      if iiRelatienummer = 0
      and icActie = "VervExporteren"
      then do: /* Vanuit menu-item bij relatie nooit via batch */
        find TAB_MEDEW where TAB_MEDEW.ID_NAAM = gUSER_ID
                         and TAB_MEDEW.NR_BEDR = gNR_BEDR no-lock no-error.
        /* {assrc/a5batkon.i} */
      end.
      else do: /* menu-optie bij relatie of menu-optie bekijken vanuit browser
                  altijd direct bekijken in acrobat, dus application PDF */
        chExportOptions:DestinationType = 5.     /* Application */
        chExportOptions:FormatType      = 31.    /* PDF */
        chExportOptions:ApplicationFileName = session:temp-directory + CRYSTAL_REPORT.NAAM + ".pdf".
        chReport:SQLQueryString no-error. /* work-around, parameter scherm opstarten en dan leave */
        if error-status:num-messages > 0
        then do: /* cancel gedrukt */
          if not GetError() matches "Door de gebruiker geannuleerd"
          and not GetError() matches "user cancelled"
          then
            /* 880:Fout bij exporteren, %1 */
            run MeldingNrOK(880,GetError(),"error").
          run ReleaseCH.
          return.
        end.
        chReport:EnableParameterPrompting = false.
      end.
      if vACHTERGROND
      then do: /* Parameters opvragen en opslaan */
        repeat:
          update
            iFormatType
            cDiskFilename
            with frame fBatchVariabelen.
          if cDiskFilename = ""
          then do:
            /* 326:Bestandsnaam is verplicht. */
            run MeldingNrOk(326,"","error").
            next.
          end.
          leave.
        end. /* repeat */
        if key-function(lastkey) = "end-error"
        then do:
          run ReleaseCH.
          return.
        end.
        chReport:SQLQueryString no-error. /* work-around, parameter scherm opstarten en dan leave */
        /* chReport:GetNextRows(0,1) no-error. eerste werkende work-around */
        if error-status:num-messages > 0
        then do: /* cancel gedrukt */
          if not GetError() matches "Door de gebruiker geannuleerd"
          and not GetError() matches "user cancelled"
          then
            /* 880:Fout bij exporteren, %1 */
            run MeldingNrOK(880,GetError(),"error").
          run ReleaseCH.
          return.
        end.
        assign vCHAR        = string(iiIdCrystalReport) + "^" +
                              string(iFormatType) + "^" +      /* PDF, Excel of ... */
                              cDiskFileName + "^" +
                              "|"
               vPROGRAMNAME = "crystalbatch.p"
               vTYPE        = "IN^IN^CH^|"
               vLENGTE      = "11^2^120^|"
               vLABELS      = "IdCrystalReport^Uitvoertype^Uitvoerbestand^|"
               vBATCH       = ?.
        run asobj/a53203.p.
        if key-function(lastkey) = "end-error"
        then do:
          run ReleaseCH.
          return.
        end.
        find BATCH_SEL where recid(BATCH_SEL) = vBATCH no-lock no-error.
        do iTeller1 = 1 to chParamDefs:count:
          assign chParam = chParamDefs:Item(iTeller1).
          assign cNaam = trim(substring(chParam:name,3),"~}").
          if can-do("gUSER_ID,gNR_BEDR,gNR_ADMIN",cNaam)
          then do: /* deze zijn/worden al gedaan */
            next.
          end.
          else do:
            do iTeller2 = 1 to chParam:NumberOfCurrentValues trans:
              create BATCH_ITEMS.
              assign BATCH_ITEMS.NR_KENMERK   = iKenmerk
                     BATCH_ITEMS.NR_VOLG      = BATCH_SEL.NR_VOLG
                     BATCH_ITEMS.SELEKTIES[1] = string(chParam:GetNthCurrentValue(iTeller2))
                     BATCH_ITEMS.LABELS[1]    = cNaam
                     iKenmerk                 = iKenmerk + 1.
              assign iValueType = chParam:ValueType.
              case iValueType:
                when 7 /* Number */
                then
                  assign BATCH_ITEMS.TYPE[1] = "IN".
                when 8 /* Currency */
                then
                  assign BATCH_ITEMS.TYPE[1] = "DE".
                otherwise
                  assign BATCH_ITEMS.TYPE[1] = "CH".
              end case. /* Parameter:ValueType = data-type */
            end.
          end.
        end. /* iTeller1 */
        run ReleaseCH.
        return.
      end. /* if vACHTERGROND */
      chReport:export(icActie = "VervExporteren") no-error.
      if error-status:num-messages > 0
      then do:
        if not GetError() matches "Door de gebruiker geannuleerd"
        and not GetError() matches "user cancelled"
        then
          /* 880:Fout bij exporteren, %1 */
          run MeldingNrOK(880,GetError(),"error").
        run ReleaseCH.
        return.
      end.
    end. /* if not gLog_Batch */
    else do: /* batch-mode dus Parameters vullen vanuit BATCH_ITEMS */
      chExportOptions:DestinationType = 1.                /* diskfile */
      chExportOptions:FormatType      = iFormatType.      /* PDF, Excel etc */
      chExportOptions:DiskFileName    = cDiskFileName.
      case iFormatType:
        when 38 /* Excel standaard opties */
        then do:
          chExportOptions:ExcelAreaGroupNumber        = 0.
          chExportOptions:ExcelPageBreaks             = no.
          chExportOptions:ExcelUseConstantColumnWidth = no.
          chExportOptions:ExcelUseWorksheetFunctions  = yes.
        end. /* 38 Excel */
        when 40 /* csv standaard opties */
        then do:
          chExportOptions:CharFieldDelimiter = ";".
          chExportOptions:CharStringDelimiter = "~"".
        end. /* 40 csv */
      end case.
      do iTeller1 = 1 to chParamDefs:count:
        assign chParam = chParamDefs:Item(iTeller1).
        chParam:ClearCurrentValueAndRange().
        assign cNaam = trim(substring(chParam:name,3),"~}").
        if cNaam = "gUSER_ID"
        then do:
          chParam:ClearCurrentValueAndRange().
          chParam:SetCurrentValue(gUSER_ID).
          next.
        end.
        else if cNaam = "gNR_ADMIN"
        then do:
          chParam:ClearCurrentValueAndRange().
          chParam:SetCurrentValue(gNR_ADMIN).
          next.
        end.
        else if cNaam = "gNR_BEDR"
        then do:
          chParam:ClearCurrentValueAndRange().
          chParam:SetCurrentValue(gNR_BEDR).
          next.
        end.
        if not can-find(first BATCH_ITEMS where BATCH_ITEMS.NR_VOLG   = BATCH_SEL.NR_VOLG
                                            and BATCH_ITEMS.LABELS[1] = cNaam)
        then do:
          /* 881:De parameter '%1' is niet te vullen. */
          run MeldingNrOK(881,cNaam,"error").
          run ReleaseCH.
          return.
        end.
        assign iMultiple = 0.
        for each BATCH_ITEMS where BATCH_ITEMS.NR_VOLG   = BATCH_SEL.NR_VOLG
                               and BATCH_ITEMS.LABELS[1] = cNaam no-lock:
          assign iMultiple = iMultiple + 1.
          if iMultiple > 1
          and not chParam:EnableMultipleValues
          then do:
            /* 882:De enkelvoudige parameter '%1' kreeg meerdere waarden aangeboden. */
            run MeldingNrOK(882,cNaam,"error").
            run ReleaseCH.
            return.
          end.
          assign iValueType = chParam:ValueType.
          case iValueType:
            when 7 /* Number */
            then
              chParam:AddCurrentValue(int(BATCH_ITEMS.SELEKTIES[1])) no-error.
            when 8 /* Currency */
            then
              chParam:AddCurrentValue(dec(BATCH_ITEMS.SELEKTIES[1])) no-error.
            when 9 /* Logical */
            then
              chParam:AddCurrentValue(BATCH_ITEMS.SELEKTIES[1] = "yes") no-error.
            when 10 /* Date */
            then
              chParam:AddCurrentValue(date(BATCH_ITEMS.SELEKTIES[1])) no-error.
            when 11 /* Time */
            or when 12 /* Character */
            or when 16 /* DateTime */
            then
              chParam:AddCurrentValue(BATCH_ITEMS.SELEKTIES[1]) no-error.
          end case. /* Parameter:ValueType = data-type */
        end. /* alle waarden van deze parameter, each tParams of chParam */
      end. /* alle parameters van het report, do iTeller1 = 1 to chParamDefs:count */
      chReport:EnableParameterPrompting = false.
      chReport:DisplayProgressDialog = false.
      chReport:export(false) no-error. /* false, geen user-prompt */
      if error-status:num-messages > 0
      then
        put unformatted "Fout bij exporteren," skip
          GetError() skip.
      assign vST_BATCH = (error-status:num-messages = 0).

  • Migrating Crystal 8.5 to Crystal Server 2008

    Hi,
    We have classic ASP application that uses Crystal 8.5 reports. We are migrating the application to .Net and want to use CR 2008 as we are planning deploying it on 64bit machine. In original (classic ASP) code, we were changing SQL for the report thru' code. Basically, we were adding sorting and whereby clause depending on filters selected by user.
    i.e.
    session("oRpt").SQLQueryString = sSQL
    How to do the same in asp.net for crystal 2008? Does crystal 2008 expose such property?

    Crystal 8.5 reports have a VERY different internal structure than those written in Crystal 9 and above.  This includes the fact that in 8.5 and below you could directly modify the SQL that Crystal generated but in 9 and above you can't.  Instead, Crystal now gives you the option of using one or more "Commands" in place of selecting and joining tables in the report and letting Crystal generate the SQL.
    So, you really have two issues here:
    1.  You're going to have to upgrade your reports.  From experience, if you have made ANY manual tweaks to the SQL, you probably will have to recreate them from scratch!  They will not work correctly if you just open them in a newer version of Crystal and save them.  When we tried this, it looked like the tables and joins were all set up correctly in the Database Explorer, but the SQL generated by Crystal didn't have any joins in it.
    2. If you're just modifying the selection criteria, table names (possibly for use of temp tables), database connections, etc. then you'll want to use the ReportDocument object model when generating/viewing reports.  However, if you need to modify the SQL as a whole, you'll have to use the Report Application Server (RAS) interface as that is the only way you'll have access to the actual command.
    -Dell

  • SQL Expressions & RAS

    I use several RAS-methods to change database-names at runtime (cf. CrystalDecisions.ReportAppServer.DataDefModel.Table, DatabaseController.SetTableLocationEx()...).
    The following SQL Expression contains a Sub-Select:
    (SELECT TOP 1 DBField1
      FROM "database1"."dbo"."table1" T1
       INNER JOIN "database1"."dbo"."table2" T2 ON T1.DBField3 = T2.DBField3
      WHERE T2.DBField2 = MainReportDB.DBField2
      ORDER BY DBField1)
    How is it possible to change the databasenames of SQL Expressions at runtime?
    I'm using CR 2008 SP3 and VS 2008.
    Tx,
    Patrick

    Hi Patrick,
    It may work but at any time it may stop working.
    C# code:
    static void testSetSQLCommandTable_CRPE(CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc)
        //CrystalDecisions.CrystalReports.Engine.ReportDocument rpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
        ISCDReportClientDocument rcd;
        rcd = rptDoc.ReportClientDocument;
        //DatabaseController dbCtrl = rptDoc.DatabaseController;
        String newTableName = "Command_jli";
        CrystalDecisions.Shared.ConnectionInfo connectionInfo = new CrystalDecisions.Shared.ConnectionInfo();
        DbConnectionAttributes dbconn = new DbConnectionAttributes();
        NameValuePairs2 propertyBag = new NameValuePairs2();
        propertyBag.Set("QE_DatabaseDLL", "crdb_odbc.dll");
        propertyBag.Set("QE_Servertype", "ODBC (RDO)");
        propertyBag.Set("QE_ConnectionString", "DSNName;;UseDSNProperties=0");
        propertyBag.Set("QE_Servername", "ServerName");
        dbconn.Collection = propertyBag;
        connectionInfo.Attributes = dbconn;
        connectionInfo.UserID = "sa";
        connectionInfo.Password = "pw";
        connectionInfo.ServerName = "DSNName";
        String sqlQueryString = " SELECT * FROM customer";
        //            XTREME"."Orders Detail" "Orders_Detail" INNER JOIN "XTREME"."Orders" "Orders" ON "Orders_Detail"."Order ID"="Orders"."Order ID"
        rptDoc.SetSQLCommandTable(connectionInfo, newTableName, sqlQueryString);
    Don

Maybe you are looking for

  • Strange!  Loops sound bizarre in Loop Browser - but not the original CD

    Hi, Just bought Jazz Essentials from Beta Monkey Music... Apple Loops from a Third Party. I put in the CD - and dragged all the folders at once into the Apple Loops Browser. Took awhile to copy... All the loops sound like they are going through a gat

  • How can I turn off autocorrect in Word 2013?

    I've read many messages related to this question, with various suggestions, but none of them work.  I find no tools/menu link by which I can find autocorrect options.  Left or right-clicking on "proofing" yields no means by which to access autocorrec

  • 802.1x and ACS

    when implementig a 802.1x with a cisco ACS is necesary to work with certificates or it can just work with username and password?

  • Some Schedule jobs are not running in Oracle 10g

    i have total of 8 Schedules jobs in Oracle 10g test database which were not in sync with prod database . So i re-created all of them again and then enbled them . but some 4 of them didnt ran on their NEXT_RUN_DATE . Showing NULL on LAST_START_DATE an

  • ADF business event mechanism

    Hi, I have been reading about ADF business events and it seems to me that the current mechanism (11g) only supports raising events at EO level on DB commit (create/update/delete), AND the service that subscribed to the event will be triggered asynchr