Sunday, March 11, 2012

CR doesnt show what i want

Hi all! I'm a student from Belgium and I need to make several reports in CR, but I'm having some difficulties.. I hope I can get some help here..

I need to make a reports that shows student's grades, from a class and a period (there are 3 periods):
I have 2 tables, the first one (LLADMIN) has the name, class, etc (general fixed data) of the student, the second table (KLEUTER) holds the grades, period, (data that has been inputted)etc..

The reports should look something like this:

Class: LLADMIN.class Period: KLEUTER.period

Name Grade1 Grade2 Grade3
LLAdmin.name KLEUTER.grade1 KLEUTER.grade2 ...
... ... ...

The 2 tables are linked to eachother (visual linking expert) by a unique students-number, with a Right Outer Join from KLEUTER to LLADMIN

I need to show all the students of 1 class, and the according grades, from 1 period.
So i need to put a Select Expert on LLADMIN.class and KLEUTER.period

The Select Experts on LLADMIN.class works perfect, and the report show all the student names and the grades, but also the grades from period 2 and 3
(reports show something like this now:
Name1 |nogrades|
Name2 |nogrades|
Name3 |grade1_period1| |grade2_period1| ...
Name3 |grade1_period2| |grade2_period2| ...
Name3 |grade1_period3| |grade2_period3| ...
Name4 |grade1_period1| |grade2_period1| ...
Name4 |grade1_period2| |grade2_period2| ...
Name5 |nogrades|
...
)

So I put a Select Expert on KLEUTER.period (=1): but then the reports only shows the names of the students who have a grade for that period (where there is a dbase-entry) (not all students have grades for that period)
The reports should still show the names, even if there are no grades present in the dbase.
(reports show something like this now:
Name3 |grade1_period1| |grade2_period1| ...
Name4 |grade1_period1| |grade2_period1| ...
)

I have like 20 students in a class, and as a test i have only given 2 students grades. When I put an Select Expert on KLEUTER.period the reports only shows the names of those 2 students, and their grades. This should not happen! It should show all the names!

I hope you understand my problem! If not, I will give more explantion..

thanks in advance and sry for my not-so-good-english :)The problem is that you should use an outer join to your condition as well KLEUTER.period (=1). This can be best accomplished by using the add command property in the database expert and write manually your database query

select t.field1, r.field1, t.field2, r.field2
from tab1 t, tab2 r
where tab1.field3 = tab2.field3 (+)
and tab2.field4 (+) = 1

This works fine using CR version 10, if you are using an older version (8.5) you can type the 'and tab2.field4 (+) = 'A'' part of the condition to the SQL-query (DATABASE, EDIT SQL-query).

- Jukka

No comments:

Post a Comment