You are on page 1of 55

Crystal Reports

()


http://cdr.websams.edb.gov.hk


http://cdr.websams.edb.gov.hk

Crystal Reports

Crystal Reports
WebSAMS Crystal Reports;
Crystal Enterprise Crystal
Reports

Crystal Enterprise
Crystal Reports WebSAMS

Crystal Reports

Crystal Enterprise

(WebSAMS)

(WebSAMS)

ODBC (Open Database Connectivity)


Crystal Reports SYBASE (
SYBASE ODBC )
Crystal Reports Windows ODBC SYBASE

ODBCCrystal Reports SYBASE

ODBC

WebSAMS
ODBC

SYBASE

ODBC

Crystal Reports

ODBC (Open Database Connectivity)



SYBASE
WebSAMS SYBASE
1. genuser
2. stfuser ()
3. fmpuser ()
password
WebSAMS (tel:
31258510)

SYBASE

ODBC

Crystal Reports

(Relational Database)

(Table)

Structured Query Language (SQL


)
Crystal Reports (CR) SQL

CR

(Relational Model)

Activity
Code

Wikipedia (Relational Model)


http://en.wikipedia.org/wiki/Relational_model

Activity
Name

Date

Route No.

23

Patching

01/15/01

I-495

24

Overlay

01/12/01

I-95

24

Overlay

02/08/01

I-66

25

Crack
Sealing

WebSAMS

VW_STU_LATESTSTUDENT TB_STU_PHOTO
VW_STU_LATESTSTUDENT
SUID

STUID

CHNAME

SCHYEAR

CLASSCODE

CLASSNO

School unique
ID (4-digits
number)

Student ID

Student
Chinese
name

School
academic year
(YYYY)

Class code of latest


student schooling
record

Class no of latest
student
schooling record

TB_STU_PHOTO
SUID

STUID

PHOTO

School unique ID (4digits number)

Student ID

Student photo in
jpeg format.

10

WebSAMS
1. WebSAMS > >
2. Crystal Reports
( ODBC )
3. > > WebSAMS

1,2

WebSAMS

WebSAMS

11

()

12

R-STU005-C

13

Crystal Reports

14

Check for Updates

15

Crystal Reports
1. Print Preview Refresh File >
Print Preview
2. (
WebSAMS )
SUID:
9999 & ( WebSAMS ID)
SCHYEAR:
2014
SCHLEVEL:
3 & (2: 3:)
SCHSESSION: 3 & (1: 2: 3:)
CLASSLEVEL: S3 & (Px Sx)
CLASSCODE: 3A &
SUBJGROUP:
ALL &
Departed_Student_Printing: Exclude

16

Crystal Reports

17

Layout Adjustment

Crystal Report

18

Layout Adjustment
1.

19

Layout Adjustment

20

Layout Adjustment
1. File -> Options

21

Layout Adjustment

layout tab
Grid options:
Grid Size
(0.026 2.54 cm)

0.026cm

22

Crystal Reports

Design
23

Workbench

24

WebSAMS

WebSAMS
> >

25

WebSAMS

26

()

27

Create New Connection >


ODBC (RDO)
28

Data Source Name


websams
* 12
websams2
websams
websams2
29

TB_STU_STUDENT
Create New Connection

ODBC (RDO)

websams

wsadmin

Tables
30

Crystal Reports

Field Explorer Sections


31

TB_STU_STUDENT Details
CLASSNO, CHNAME, ENNAME, DOB, SEX
*
File > Options Database Sort Fields Alphabetically
32

Crystal Reports

33

Select Expert (Report > Select Expert)


CLASSCODE CLASSNO 0

Record Sort Expert (Report > Record Sort Expert)


CLASSNO
Group Expert (Report > Group Expert)
CLASSCODE
34

35

Insert > Text


36

Insert > Picture

37

Insert > Line / Insert > Box


38

Highlight Expert

39

section

section

40

41

if then else
e.g.
if {TB_STU_STUDENT.SEX} = 'M'
then ''
else ''
select case
e.g.
select {TB_STU_STUDENT.SEX}
case 'M': ''
case 'F': ''
42

(Functions)

totext()

left()

right()

mid()

trim()

isnull()

Round()

43

(Operators)
Operator name

Crystal Syntax

Basic Syntax

Assignment ()

:=

Add ()

x+y

x+y

Subtract ()

xy

xy

Multiply ()

x*y

x*y

Divide ()

x/y

x/y

Modulus ()

x mod y

x mod y

EXP

x^y

x^y

Not Equal

x <> y

x <> y

Range less than

x<y

x<y

Range Large than

x>y

x>y

Range less than or equal

x <= y

x <= y

Range larger than or equal

x >= y

x >= y
44

totext()

e.g.
totext({TB_ASR_RPTPSTUDENT.SCHYEAR},'0') + '/' +
totext({TB_ASR_RPTPSTUDENT.SCHYEAR}+1, '0')

* '0'

2014/2015

45

left()

e.g.
left({TB_STU_STUDENT.HKID},4) + '****'

A123****

46

right()

e.g.
'****' + right({TB_STU_STUDENT.HKID},4)

****4563

47

mid()

e.g.
'**' + mid({TB_STU_STUDENT.HKID},3,4) + '**'

**2345**

48

trim()

e.g.
local stringvar name;
name := ' Peter Wong
trim(name)

';

Peter Wong

49

isnull()

(null)
e.g.

Not applicate
(N/A)

if isnull({TB_STU_STUDENT.HKID})
then 'No ID Card No.'
else {TB_STU_STUDENT.HKID}

() No ID Card No.
() A1234563
50

Round()

e.g.
Round(1.499)
Round(1.499,0)

1
Round(2345.23456,-1)

2350

51

(formula)
1. Name :
{TB_STU_STUDENT.CHNAME} + ' (' +
{TB_STU_STUDENT.ENNAME} + ')'
2. LastName :
left({TB_STU_STUDENT.CHNAME}, 1)

3. FirstName :
mid({TB_STU_STUDENT.CHNAME}, 2, 10)

52

(formula)
4. Position :
'' + totext({TB_STU_STUDENT.CLASSCOL}, '0') + '' +
' ' + totext({TB_STU_STUDENT.CLASSROW}, '0') + ''

5. Sex :
if {TB_STU_STUDENT.SEX} = 'M'
then ''
else ''
6. HKID:
if isnull({TB_STU_STUDENT.HKID})
then '---'
else {TB_STU_STUDENT.HKID}
53

SEXENNAME
CHNAME
Details

54


55