You are on page 1of 48

Crystal Reports

( 3)

1

1.
2.
3.
4.
5.

Crystal Reports


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


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


Crystal Reports

Crystal Reports
WebSAMS Crystal Reports 9
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

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

1,2

WebSAMS

WebSAMS

Table, View, Stored Procedure

Stored
Procedure
View

(Sybase)

Table

10


Table
TB_STU_STUDENT

TB_STU_STUSCHREC

TB_STU_PARENT
/
TB_STU_PHOTO

11


View
VW_STU_LATESTSTUSCHREC
(transferred)
View

VW_STU_LATESTSTUDENT
TB_STU_STUDENT

VW_STU_LATESTSTUSCHREC
View

12


TB_STU_STUDENT ()
SUID
8886

STUID
1234

CHNAME

REGNO CLASSCODE CLASSNO


2004001
3A
1

TB_STU_STUSCHREC ()
SUID
8886
8886
8886
8886

STUID
1234
1234
1234
1234

SCHYEAR
2005
2006
2006
2007

CLASSCODE CLASSNO
1B
2
2B
2
2A
1
3A
1

STATUS
0 ()
8 ()
0

table/ view

VW_STU_LATESTSTUSCHREC ()
SUID
8886
8886
8886

STUID
1234
1234
1234

SCHYEAR
2005
2006
2007

CLASSCODE CLASSNO
1B
2
2A
1
3A
1

STATUS
0
0

VW_STU_LATESTSTUDENT ( + )
SUID STUID CHNAME REGNO SCHYEAR CLASSCODE CLASSNO STATUS
8886 1234 2004001
2005
1B
2
0
8886 1234 2004001
2006
2A
1
0
8886 1234 2004001
2007
3A
1

13

> >

14

15

17

SQL

18

()

19

WebSAMS

SQL Crystal Reports


WebSAMS

SUID

4 ()

STUID

ID

SCHYEAR

SCHLEVEL
(SCHLVL)

2 ()3 ()

SCHSESSION
(SCHSESS)

1 ()2 ()3 ()

CLASSLEVEL P1S6
(
CLASSLVL)

CLASSCODE

1A4C

TIMESEQ

1000 ()1100 (T1)1102 (T1A2)1203


(T2A3)

21


R-STU005

Field Explorer Parameter


Fields
1. SUID (Number)
2. SCHLEVEL (String)
3. SCHSESSION (String)
4. SCHYEAR (Number)
5. CLASSLEVEL (String)
6. CLASSCODE (String)

22

Select Expert
Select Expert
VW_STU_LATESTSTUDENT.SUID

is equal to

{?SUID}

VW_STU_LATESTSTUDENT.SCHLVL

is equal to

{?SCHLEVEL}

VW_STU_LATESTSTUDENT.SCHSESS

is equal to

{?SCHSESSION}

VW_STU_LATESTSTUDENT.SCHYEAR

is equal to

{?SCHYEAR}

VW_STU_LATESTSTUDENT.CLASSLVL

is equal to

{?CLASSLEVEL}

VW_STU_LATESTSTUDENT.CLASSCODE

is equal to

{?CLASSCODE}

23

()

24

join, left
join, right join. inner join
outer join.
WebSAMS SQL left
outer join.
one-toone, one-to-many, many-to-many.

One-to-one:

One-to-many:

Many-to-many:

Inner Join
TB_STU_STUDENT
()

TB_STU_PHOTO
()

SUID STUID CHNAME

SUID STUID PHOTO

8886 1001

8886 1001

8886 1002

8886 1004

8886 1003

8886 1101

8886 1004

8886 1005

SUID

STUID CHNAME

8886

1001

8886

1004

PHOTO

28

Left Outer Join


TB_STU_STUDENT
()

TB_STU_PHOTO
()

SUID STUID CHNAME

SUID STUID PHOTO

8886 1001

8886 1001

8886 1002

8886 1004

8886 1003

8886 1101

8886 1004

8886 1005

SUID

STUID CHNAME

8886

1001

8886

1002

8886

1003

8886

1004

8886

1005

PHOTO

29

Right Outer Join


TB_STU_STUDENT
()

TB_STU_PHOTO
()

SUID STUID CHNAME

SUID STUID PHOTO

8886 1001

8886 1001

8886 1002

8886 1004

8886 1003

8886 1101

8886 1004

8886 1005

SUID

Left Outer Join Right


Outer Join

STUID CHNAME

8886

1001

8886

1004

8886

1101

PHOTO

30


VW_STU_LATESTST
TB_STU_PHOTO
UDENT
()
()
SUID STUID CHNAME

TB_ASR_SUBJASSESSDATA
()

SUID STUID PHOTO

SUID STUID SUBJCODE SYSSCORE

8886 1001

8886 1001

8886 1001

080

80

8886 1002

8886 1002

8886 1002

080

76

SUID

STUID CHNAME PHOTO

SUBJCODE

SYSSCORE

8886

1001

080

80

8886

1002

080

76
31

32

33

()

34

Subreport

Subreport

report
VW_STU_LATESTSTUDENT
TB_STU_PHOTO
TB_HSE_COMMON

subreport

3A
1

TB_STU_PARENT

SUID
STUID

36

37


(HSE)
Table
TB_HSE_COMMON
WebSAMS
TB_STU_STUDENT
TB_HSE_SBJCMP

38


TB_HSE_COMMON ()
SUID

TB_ID

CODE_ID

CH_DES

EN_DES

8886

STUDST ()

Promoted

8886

STUDST ()

Repeated

8886

RELIG ()

Not Applicable

8886

RELIG ()

Catholicism

8886

RELATE ()

01

Father

8886

RELATE ()

02

Mother

8886

EMPRES ()

01

Fill a Vacant Post

8886

EMPRES ()

02

Substitute a Teacher On Leave

39

Subreport
TB_STU_PARENT

TB_HSE_COMMON

CHNAME RELATION

SUID

8886 1001

01

8886 1002

02

8886 1003

02

8886 1004

03

8886 1005

04

8886 ACTCAT
01

8886 ACTCAT
02

Select Expert
8886 ACTCAT
03
8886
EMPRES
01

TB_ID
RELATE

8886 EMPRES
02

8886 EMPRES
03

SUID

STUID

TB_ID

CODE_ID

CH_DES

1. SUID, RELATION
CODE_ID

8886 RELATE

01

8886 RELATE

02

2.

8886 RELATE

03

8886 RELATE

04

3. Select Expert

and {TB_HSE_COMMON.TB_ID} = RELATE


40

subreport

subreport

41

()
subreport

42

Subreport

Websams

Select Expert

Subreport

Report A
TB_STU_Student
TB_SCH_SCHOOL

3A
1

subreport
TB_STU_Student

sibGrp
SUID
EngName

44

Subreport

Report B
VW_STU_LATESTSTUDENT
TB_SCH_SCHOOL

3A
1

Database Field:
sibGrp
SUID
EngName

45

Subreport
Report B added Report As subreport
VW_STU_LATESTSTUDENT
TB_SCH_SCHOOL

3A
1

subreport
TB_STU_Student

sibGrp
SUID
EngName

46

()
subreport


48