Wednesday, 25 June 2014

Reasons to Use SAP Crystal Reports SQL Expression Fields




Overview

These objects provide an excellent alternative to using a formula in Crystal Reports. The main advantage being that the processing of an SQL Expression field is performed at the database server side and not on the client machine.

The SQL Expression functionality will vary depending on the database you connect to. One useful thing to know is that Crystal Reports supports any SQL function for the database you connect to, even if the function name is not visible in the Functions area of the SQL Expression Editor.

Figure 1 below shows an example of the Microsoft SQL Server DATEADD function.



(Figure 1)

Comparisons between a Formula and an SQL Expression field?

The SQL Expression Editor bears many resemblances to the Formula Editor. As a report designer, you will need to know the SQL Syntax to successfully utilise SQL Expressions in your Crystal Reports. Let’s take a look at the example in Figure 1. The DateAdd formula syntax is almost identical. Figure 2 below shows the formula syntax.


(Figure 2)

Report Optimisation

This is the main reason for using SQL Expressions over formulas. SQL Expression fields allow a user defined calculation in a Crystal Report to be processed on the database server. This means that the column is derived and sent to the client machine. Compare this with a formula that is wholly processed on the client machine. Figure 3 shows the SQL syntax for the DATEADD function being derived on the database server.

(Figure 3)

A valid equivalent to ‘if-then-else’

Using the SQL CASE statement is a very useful alternative to the very popular ‘if-then-else’ Crystal syntax. Figure 4 shows a simple CASE statement.


(Figure 4)

Pre-defined SQL Expression functions

These are set out in an almost identical way to the formula functions in the formula editor. Figure 5 shows the main function area.


(Figure 5)
Using a pre-defined SQL Expression function is easier because you can simply select the function, field and arguments without typing the SQL. Figure 6 shows an example of the pre-defined MONTHNAME function.


(Figure 6)
And as you would expect, it is derived on the database server. Figure 7 shows the SQL syntax below.


(Figure 7)

Written by Steve Chapman, Senior BI Consultant, DSCallards

Thursday, 19 June 2014

Where Have You Been All My Life?

Every once in a while a technology comes along that once you have become accustomed to it you wonder how you ever got by without it. For me the ‘stand out by a mile’ example of this is of course LINQ and lambda which if I do not use within any given day means that I’m probably on holiday or procrastinating.

Sometimes, and much more rarely a tech comes to my attention that has been in existence for many years and once used I think…

‘Man, where have you been all my life?’

Read the full blog here.

Written by Conrad Rowlands, Senior Systems Architect and Developer, DSCallards

Wednesday, 14 May 2014

The DSCallards' Guide to the Universe!

The Universe is business-friendly. 

As it is based upon business terminology that is familiar to the business user and shared throughout the organisation, the Universe allows you to create queries and get information using your own every day terms.

Essentially, a Universe maps to the data in the database, but uses every day terms to describe your business environment. This means that you can select exactly the data that interests you using your own business terminology.

Understanding the Semantic Layer

The SAP BusinessObjects Universe is the semantic layer that isolates you from the technical complexities of the databases where your corporate information is stored.  It essentially hides the typical database structure from the user.

This layer takes care of the translation of tables and columns to meaningful business terms in such a way that business users do not need to know any query language - such as SQL - towards the database. The semantic layer contains metadata about the table columns and their relationships within the underlying database. This layer is presented in a Universe by the use of classes and objects.

Advantages of Universe or Semantic Layer

1.    The Universe places a layer between database and business users and presents database/data warehouse in business terminology which makes it easy for them to create a report.

2.    The Universe allows the user to have no knowledge of SQL or database terminology.  Only the developer needs to know the SQL. The business user can simply drag and drop the objects and the tool will generate the required query to fetch the data.

3.    All types and security can be applied on the Universe making it data secure and only available to related person.


To understand how the Universe can help your company, why not enrol on our SAP BusinessObjects Universe course? This one-day virtual course is designed to introduce you to the principles of the Universe and to get you up and running with your Universe project.  Click here for more information.