Using Sql Functions in Crystal Reports

Can SQL table-valued functions be used in Crystal Reports?  The only options I see in the Database Expert are Tables, Views, and Stored Procedures.

Hi Dan,
Are you referring to user-defined SQL functions? If yes, then these are not accessible in Crystal Reports.
You would need to create a stored procedure which calls the function and does the processing and use this procedure in CR.
- Abhilash

Similar Messages

  • How to use oracle functions in Crystal Reports XI using Oracle Server

    Hi all,
    Is it possible  to use oracle functions in Crystal Reports XI using Oracle Server as Data Source.
    If i try to use a procedure,i am getting error with message "Invalid Arguement Provided".
    Functions are not visible objects like tables,views and stored procedures.
    The  jdbs driver i m using is oracle.jdbc.driver.OracleDriver.

    I think it is not possible to add functions in crystal directly for any database. You need to use those functions in a stored procedure and add that storedprocedure as a datasource.
    [https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233353335333833323333%7D.do]
    regards,
    Raghavendra

  • How to use email function in crystal report ?

    Post Author: kudo
    CA Forum: .NET
    Hi I'm a novice by touching .net not more than 2 months. Can somebody guide me how to use email function provided in crystal report components?(Better put a sample code so that I can understand well.)  ps: I'm using VS2005 VB.net.Thanks.

    Post Author: mewdied
    CA Forum: .NET
    'EXPORT to EMAIL        ''' Code for exporting the report to Mapi (.Net Windows application)        ''' *For a Web application you must export to disk as a PDF file first.
            crReportDocument.Load(Application.StartupPath + "\World Sales Report.rpt")        crMicrosoftMailDestinationOptions = New MicrosoftMailDestinationOptions        With crMicrosoftMailDestinationOptions            .MailCCList = "[email protected]"            .MailToList = "[email protected]"            .MailSubject = "Attached exported report"            .UserName = "admin"            .Password = "password"        End With
            crExportOptions = crReportDocument.ExportOptions        With crExportOptions            .DestinationOptions = crMicrosoftMailDestinationOptions            .ExportDestinationType = ExportDestinationType.MicrosoftMail            .ExportFormatType = ExportFormatType.PortableDocFormat        End With
            'Add some error handling        Try            crReportDocument.Export()            MsgBox("Report exported successfully.")        Catch err As Exception            MessageBox.Show(err.ToString())        End Try
    Hope this helps

  • Using a SQL user-defined function in Crystal Reports XI

    Post Author: JoannKarp
    CA Forum: Formula
    Is it possible to use a user defined function in SQL and use this in multiple Crystal reports?
    JoannKarp

    SELECT COALESCE(ufn_GetAddressByBusinessEntityIDandAddressTypeID(table1.BusinessEntityID,712),ufn_GetAddressByBusinessEntityIDandAddressTypeID(table1.BusinessEntityID,712)) AS Zipcode
      FROM table1
    Nope. This is two function calls. coalesce(a, b, c, ...) is just syntatic sugar for
       CASE WHEN a IS NOT NULL THEN a
            WHEN b IS NOT NULL THEN b
            WHEN c IS NOT NULL THEN c
       END
    But if you use isnull it's a different matter. (But isnull() permits two arguments.)
    Erland Sommarskog, SQL Server MVP, [email protected]

  • How to use Pl/Sql function in Discoverer report

    Hi Everybody,
    Would you be able to provide a workflow/guidance how to use sql function in Discoverer right from creating the function using PLSQL Developer.
    (I am new to Oracle environment... prev. worked as analyst with Microsoft Access... took PL/Sql class in school a few years ago)
    We are using Discoverer Desktop.
    a) Just emailed dba for permission to create pl/sql function.
    b) Recently got Discoverer Administrator installed on my pc.
    can you pls add to the list:
    c)....
    d)....
    etc.?
    tx for your help, sandra

    Hi Kranthi,
    Thx for your warm words....
    The links you provided are great! Thx soooo much!
    Thanks to you and the rest of forum members, am able to use what you've all taught me
    with other Discoverer reports.... so i was able to do more on my own....
    About a month ago, I got access to Discoverer Admin, and was able to paste SQL to create a custom folder.
    Then i joined the custom folder to an existing baseline folder.
    I have found that sometimes when I use calc within a calc when the calcs use analytic functions, that Discoverer
    just displays null in the column. I thought that maybe instead I could create my own function as a work-around.
    I wrote IT for permissions to create views, functions etc. Hopefully, they'll approve and can move toward learning
    pl/sql functions for Discoverer.
    tx again, sandra

  • See sql query from crystal report without crystal report

    see sql query from crystal report without crystal report 

    Hi,
    Depends on datasource type but you could have a look at ODBC trace or if you have access to the SQL Server you could use profiler to monitor the session.
    Regards,
    Craig
    And this will only be of use if you know which Server/Insstance/Database the Report is connecting to...
    Please click "Mark As Answer" if my post helped. Tony C.

  • Use SQL function to get the original order number using the invoice number

    Hi All,
    wondering is someone can help me with this challenge I am having?  Often I need to return the original order numbers that created the resulting invoce.  This is a relatively simple seriese of joins in a query but I am wanting to simplify it using a SQL function that can be referenced each time easily from with in the SELECT statement.  the code i currently have is:
    Use SQL function to get the original order number using the invoice number
    CREATE FUNCTION dbo.fnOrdersThatMakeInvoice(@InvNum int)
    RETURNS nvarchar(200)
    AS
    BEGIN
    DECLARE @OrderList nvarchar(200)
    SET @OrderList = ''
    SELECT @OrderList = @OrderList + (cast(T6.DocNum AS nvarchar(10)) + ' ')
    FROM  OINV AS T1 INNER JOIN
          INV1 AS T2 ON T1.DocEntry = T2.DocEntry INNER JOIN
          DLN1 AS T4 ON T2.BaseEntry = T4.DocEntry AND T2.BaseLine = T4.LineNum INNER JOIN
          RDR1 AS T5 ON T4.BaseEntry = T5.DocEntry AND T4.BaseLine = T5.LineNum INNER JOIN
          ORDR AS T6 ON T5.DocEntry = T6.DocEntry
    WHERE T1.DocNum = @InvNum
    RETURN @OrderList 
    END
    it is run by the following query:
    Select T1.DocNum, dbo.fnOrdersThatMakeInvoice(T1.DocNum)
    From OINV T1
    Where T1.DocNum = 'your invoice number here'
    The issue is that this returns the order number for all of the lines in the invoice.  Only want to see the summary of the order numbers.  ie if 3 orders were used to make a 20 line inovice I only want to see the 3 order numbers retuned in the field.
    If this was a simple reporting SELECT query I would use SELECT DISTINCT.  But I can't do that.
    Any ideas?
    Thanks,
    Mike

    Thanks Gordon,
    I am trying to get away from the massive table access list everytime I write a query where I need to access the original order number of the invoice.  However, I have managed to solve my own problem with a GROUP BY statement!
    Others may be interested so, the code is this:
    CREATE FUNCTION dbo.fnOrdersThatMakeInvoice(@InvNum int)
    RETURNS nvarchar(200)
    AS
    BEGIN
    DECLARE @OrderList nvarchar(200)
    SET @OrderList = ''
    SELECT @OrderList = @OrderList + (cast(T6.DocNum AS nvarchar(10)) + ' ')
    FROM  OINV AS T1 INNER JOIN
          INV1 AS T2 ON T1.DocEntry = T2.DocEntry INNER JOIN
          DLN1 AS T4 ON T2.BaseEntry = T4.DocEntry AND T2.BaseLine = T4.LineNum INNER JOIN
          RDR1 AS T5 ON T4.BaseEntry = T5.DocEntry AND T4.BaseLine = T5.LineNum INNER JOIN
          ORDR AS T6 ON T5.DocEntry = T6.DocEntry
    WHERE T1.DocNum = @InvNum
    GROUP BY T6.DocNum
    RETURN @OrderList 
    END
    and to call it use this:
    Select T1.DocNum, dbo.fnOrdersThatMakeInvoice(T1.DocNum)
    From OINV T1
    Where T1.DocNum = 'your invoice number'

  • Passing parameter into SQL statement in Crystal Reports

    Hi all,
    I would like to call Crystal Reports in JSP. I can handle it well now. But I hope to let user input their selection criteria before printing out the report. I know how to get the parameter value in JSP, but I really dunno how to pass these parameter values into the SQL statement in Crystal Report. Actually, is it possible to do so?
    If anyone has idea, please tell me. Thx Thx!
    Regards,
    Betty

    Dear Sir,
    I want to use Crystal Report as a web base using JSP. But, I am getting how to call .rpt file in .jsp file & passing of parameter.
    If you have any idea, please reply as early as possible
    Thanking U.
    My userid = [email protected]
    Regds
    Pankaj..

  • How to enable show SQL Query in Crystal report tool

    Hi,
    How can we enable the show SQL Query under Database tab in crystal report...
    We have a requirement to modify the SQL query in Crystal reports.
    Thanks,
    Gana

    Gana,
    CR has an "Add Command" feature that will allow you to use hand-coded SQL as your data source.
    Look at Defining an SQL Command in CR's online help (F1).
    If a command was used in the original report creation, it's a simple matter to go in and edit that SQL.
    If the report was not originally built w/ a Command you may find it difficult to switch over. In most cases it easier to start over from scratch, creating a new, blank report, that uses the command.
    Jason

  • How to implement the Oracle Group by function in Crystal reports?

    Hi all,
    In SQL, for example we have a group function like:
    select  district,state, country, continent, sum(no.of people) from world.
    Now, How to implement this group function in crystal reports? Please advise.
    Thanks in advance..
    Regards,
    sriram

    Hi Vinay,
    Thanks for the prompt reply.
    In one of our report, we are supposed to perform group by for 14 columns to get sum of 3 columns and there by displaying 17 columns in the report.
    When we tried in crystal reports to implement this oracle group by functionality:
    1. We created 14 groups from the Insert->Group option.
    2. By performing this, we got 14 group sections vertically(one inside the other).
    3. Then we created the sum(15th column),sum(16th column), sum(17th column)  by Insert->Summary option.
    4. We suppresed all the group sections except for the last group.
    5. Then, dragged all the groups to the last group section along with the summary fields.
    This is how, we tried to acheive the oracle group by function in Crystal reports.
    Please advise, whether our approach is right. If not, please suggest the appropriate approach with a bit detailed explanation.
    Thanks,
    Sriram.

  • Modify SQL query in Crystal Reports 2013

    Bonjour,
    Je voulais savoir s'il était possible de modifier la requête SQL dans Crystal Reports 2013, car les bases de données de notre application pour bibliothèque utilise un format de date particulier qu'il nous faut corriger directement dans la requête SQL.
    Merci pour vos informations.
    Cordialement
    Claude Marcilly
    Cannes - France
    Hello,
    I wanted to know if it was possible to modify the SQL query in Crystal Reports 2013. Databases of our application library indeed use a particular date format that we need to fix directly into the SQL query.
    Thank you for your information.
    Best regards
    Claude Marcilly
    Cannes - France

    Hi Claude,
    If you are creating reports using tables then go in Database menu and click on show SQL query, this will show the SQL generated by crystal reports.  Now go in database expert and expend your connection and double click on Add Command and past the query which was generated by Crystal and try to modify the date format and click OK.
    Now you need to redesign your reports based on Add command.
    or
    If your reports datasource is Add command you can directly go in add command and change it.
    -Sastry

  • EDITING SQL SCRIPT IN CRYSTAL REPORTS

    I just installed Version 12 and am trying to edit SQL scripts in Crystal Reports that were created in Version 8.  When opening the Database tab on the Main Menu, the Query Panel is greyed out and not accessible.  I can view the SQL Query but cannot edit it.  If someone can advise me what to do I would be very appreciative.
    Edited by: Frank Romano on Mar 18, 2009 4:17 PM

    Hi Frank,
    Here is the SAP Note that says that you cannot edit SQL from Crystal 9 and later
    Symptom
    In Crystal Reports (CR) 8.5 and earlier, it is possible to edit the SQL statement in the 'Show SQL Query' dialog box. Doing so allows the report designer to modify the SQL statement that CR generates. Starting with Crystal Reports version 9, users are no longer able to modify the SQL in the 'Show SQL Query' window.
    How can you control the SQL statement that Crystal Reports sends to the database?
    Resolution
    To control the SQL statement that Crystal Reports 9 and later uses, use the 'Add Command' feature to create a Command Object. The 'Add Command' feature replaces the ability to edit SQL statements in the 'Show SQL Query' dialog box. Use this dialog box to write your own SQL command (query) which will be represented in Crystal Reports as a Table object.
    More Information
    Additional information about creating and using Command Objects ('Add Command') can be found on our support site and within the Online Help file contained in Crystal Reports.
    On our support site search for the technical brief, cr_query_engine.pdf and knowledge base article c2016641 at
    http://support.businessobjects.com/search
    Keywords
    OBJECT ADD COMMAND EDIT SHOW SQL QUERY DATABASE ACCESS MENU MODIFY SQL Crystal Reports Show SQL query Command object , c2017389
    Regards,
    Raghavendra

  • Using DB2 views in crystal reports with java

    Post Author: Shikha Tomar
    CA Forum: JAVA
    Hello,
    We have used DB2 views in Crystal Report 11.
    We are able to view the report through crystal report tool but while using this rpt file in java application,the DB2 view is not found.
    It gives an error: "table SCDC.View_report not found."
    SCDC.View_report=Name of the view used in rpt
    Code for calling rpt is as below:
    The line marked as red gives the error:
    private static void switch_tables(DatabaseController databaseController) throws ReportSDKException, IOException {
    final String URI = "!com.ibm.db2.jcc.DB2Driver!jdbc:db2://"SERVERNAME":"PORT"/"DATABASE_NAME"!"+"";
    final String DATABASE_DLL = "crdb_jdbc.dll";
    //Obtain collection of tables from this database controller.
    Tables tables = databaseController.getDatabase().getTables();
    CommandTable commandTable=new CommandTable();
    //Set the datasource for all main report tables.
    for (int i = 0; i < tables.size(); i++) {
    ITable table = tables.getTable(i);
    //Keep existing name and alias.
    table.setName(table.getName());
    table.setAlias(table.getAlias());
    //Change properties that are different from the original datasource.
    table.setQualifiedName(TABLE_NAME_QUALIFIER + table.getName());
    //Change connection information properties.
    IConnectionInfo connectionInfo = table.getConnectionInfo();
    //Set new table connection property attributes.
    PropertyBag propertyBag = new PropertyBag();
    //Overwrite any existing properties with updated values.
    propertyBag.put("Trusted_Connection", "false");
    propertyBag.put("Server Name", SERVERNAME); //Optional property.
    propertyBag.put("Connection String", CONNECTION_STRING);
    propertyBag.put("Database Name", DATABASE_NAME);
    propertyBag.put("Server Type", "JDBC (JNDI)");
    propertyBag.put("URI", URI);
    propertyBag.put("Use JDBC", "true");
    propertyBag.put("Database DLL", DATABASE_DLL);
    connectionInfo.setAttributes(propertyBag);
    //Set database username and pasword.
    //NOTE: Even if these the username and password properties don't change when switching databases, the
    //database password is not saved in the report and must be set at runtime if the database is secured.
    connectionInfo.setUserName(DBUSERNAME);
    connectionInfo.setPassword(DBPASSWORD);
    connectionInfo.setKind(ConnectionInfoKind.SQL);
    //connectionInfo
    table.setConnectionInfo(connectionInfo);
    //Update old table in the report with the new table.
    databaseController.setTableLocation(table, tables.getTable(i));
    Regards,
    Shikha

    Hi,
    Fo business views please reffer to [Business Views Administrator's Guide|http://help.sap.com/businessobject/product_guides/boexir31/en/xi3-1_bv_admin_en.pdf]
    Yes, Crystal Reports 2008 can consume business views.
    Regards,
    Ramu.

  • Use sql function decode with Zend code

    Hi,
    I need to use sql function DECODE() in a query for PHP Code. This query works well in sql*plus but PHP returns
    the following error message:
    Parse error: syntax error, unexpected T_STRING in C:\Program Files\Zend\Apache2\htdocs\Compta\compta2.php on line 16
    the query is :
    $query =
    'select substr(c.NUM,1 ,2) Compte ,
    c.designation , a.Periode
    ,decode(substr(c.NUM,1 ,1), '1',1, '2',1,'3',1,-1) cp_type ,
    sum(credit) - sum(debit) Montant
    from ecritures a, clients b, compte c
    where
    b.NUM (+) =a.NUM
    and a.DATEECRITURE between to_date(:debut, \'dd/mm/yy\') and to_date(:fin, \'dd/mm/yy\')
    and substr(a.num,1,2) =c.num
    group by substr(c.NUM,1 ,1), substr(c.NUM,1,2) , c.designation ,a.periode
    order by compte ';
    Can any one help me ???
    Thanks by advance
    nb: Iuse Zend 2.0

    Hi,
    You need to escape single quote mark:
    decode(substr(c.NUM,1 ,1), \'1\',1, \'2\',1,\'3\',1,-1) cp_type ,
    the same way you did for to_date:
    to_date(:debut, \'dd/mm/yy\')
    Regards,
    Paweł

  • How to use SQL functions in the queries

    hey guys i wanna know how to use SQL functions in the queries is it possible or not .

    Hi,
    Wat exactly that set values are?
    those from sql query?
    How to use count():
    The COUNT() function returns the number of rows that matches a specified criteria.
    SQL COUNT(column_name) Syntax
    The COUNT(column_name) function returns the number of values (NULL values will not be counted) of the specified column:
    SELECT COUNT(column_name) FROM table_name
    SQL COUNT(*) Syntax
    The COUNT(*) function returns the number of records in a table:
    SELECT COUNT(*) FROM table_name
    SQL COUNT(DISTINCT column_name) Syntax
    The COUNT(DISTINCT column_name) function returns the number of distinct values of the specified column:
    SELECT COUNT(DISTINCT column_name) FROM table_name
    The IN function helps reduce the need to use multiple OR conditions.
    The syntax for the IN function is:
    SELECT columns
    FROM tables
    WHERE column1 in (value1, value2, .... value_n);

Maybe you are looking for

  • Remove .DS_Store files

    On my iMac ios 10.10.1 I now have a Desk-Top Icon and a Finder Application file for .DS_Store. Both show in a faded text. Tried to put in the trash, but they just pop right up. They are not hurting anything that I can tell, but I want them gone. Any

  • SQL Statement error

    Hi All, I was trying to execute a standard function module in which there is a sql statement where IN operator is used. The no of choices given for that field by the IN operator is 1065. The error displayed is  the SQL statement generated from the SA

  • Text link acting up

    All of a sudden one of the text links on my menu bar has gone funky. I redid/reset it in iweb, no change. I'm seeing a blank text box, and after rollover it stays the yellow color. It only is happening on the home page. ?

  • What is the best way to connect my laptop to a sound system?

    Hi I use my  laptop to run videos and sound tracks for our church. I am all taken care of as far as the video. My problem is with hooking up the sound from my Or any PC to the sound system. I am within 10 feet of the 32 channel sound mixer for the so

  • OIM Reconciliation with eBusiness Suite

    Im seeing the following error on enabling the (eBusiness HRMS Trusted Reconciliation) task. I havent configured SSL between OIM and eBusiness suite. Will that be a problem ? What are the exact steps to be followed for the reconciliation task? Thanks