Author |
Message |
albazel2004
Newbie
Joined: 11 Jan 2012
Location: Yemen
Online Status: Offline
Posts: 7
|
Topic: Adding Fake Records Posted: 11 Jan 2012 at 9:04am |
Is it possible to add a fake records for the existed records? Suppose I have to subreports, both of them get data from same view or table but with different parameters, the first one returns 10 records and the other returns 6 records. I want to add 4 more records to make the both subreports look alike in records number.
e.g. :
1st Subreport look like this :
------------------ 1st Term Result ------------------ 1 Math1 10 2 Eng1 20 3 Physics1 30 4 Chemistry 40 5 Spanish 50 6 Computer 60 ------------------ Total : 210 ------------------
2nd Subreport look like this :
------------------
2st Term Result
------------------- 1 Geology 60 2 Microbiology 90 3 Eng2 50 4 5 6 -------------------- Total : 200 --------------------
I'll appreciate it if any one can come up with an idea that might help me. I need it so much.
|
Live with Peace
|
IP Logged |
|
kostya1122
Senior Member
Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
|
Posted: 11 Jan 2012 at 12:52pm |
i don't think there is any way to add date to your database with crystal
i had the same problem when i was using cross-tabs, so i had to recreate them differently.
so could try that
from what i see you need to group on table.subject
then create text-boxes with subject names in them(as many as needed) place them in your report header or footer
then create a formula for each subject total like
if table.subject = "Geology" then table.TermResult
place it in your detail section then right click
insert>summery>...
take that summery place it next to the appropriate text box.
|
IP Logged |
|
albazel2004
Newbie
Joined: 11 Jan 2012
Location: Yemen
Online Status: Offline
Posts: 7
|
Posted: 12 Jan 2012 at 7:46am |
Thank you for your reply, but I think you misunderstand me, 1 st Term
Result SubReport1:
No.
|
Subj Name
|
Mark
|
1
|
A
|
10
|
2
|
B
|
20
|
3
|
C
|
30
|
4
|
D
|
40
|
5
|
E
|
50
|
6
|
F
|
60
|
7
|
G
|
70
|
8
|
H
|
80
|
9
|
I
|
90
|
10
|
J
|
100
|
|
Total
|
550
|
2st Term Result
SubReport2:
No.
|
Subj Name
|
Mark
|
1
|
Aa
|
40
|
2
|
Bb
|
90
|
3
|
Cc
|
80
|
4
|
Dd
|
70
|
5
|
Ee
|
60
|
6
|
Ff
|
50
|
|
Total
|
390
|
I want the second table to be like the following :
No.
|
Subj Name
|
Mark
|
1
|
Aa
|
40
|
2
|
Bb
|
90
|
3
|
Cc
|
80
|
4
|
Dd
|
70
|
5
|
Ee
|
60
|
6
|
Ff
|
50
|
7
|
|
|
8
|
|
|
9
|
|
|
10
|
|
|
|
Total
|
390
|
just to look like the first one by number of rows. There is no date or something else. Thank you any way
|
Live with Peace
|
IP Logged |
|
kostya1122
Senior Member
Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
|
Posted: 12 Jan 2012 at 10:11am |
the idea is still the same...
create 10 text-boxes with numbers in them(or as many as needed) place them in your report header or footer then create formulas for each of those numbers like if table.number(if this is not a field, create a formulas for it like if table.SubjName = "Aa" then 1 else...) = 1 then table.SubjName (place it next to the textbox with number 1 in it ....
then create a formula for each subject total like if table.number = 1 then table.TermResult
place it in your detail section then right click
insert>summery>...
take that summery place it next to the appropriate text box
|
IP Logged |
|
albazel2004
Newbie
Joined: 11 Jan 2012
Location: Yemen
Online Status: Offline
Posts: 7
|
Posted: 13 Jan 2012 at 1:06am |
kostya1122,
Thank you for kind and reply,
the problem is still the same, the number of subjects may be varied from term to term, and it depends also on the department that the student is belonging to. i.e. if the number of subjects in first term is 10 or 7, then the records or rows must be numbered from 1 to 10 or 1 to 7 in both subreports and so on.
I want it dynamically not statically. the total is not a problem at all, the problem is by numbering fake rows in the second subreport so that it looks like the first one and vice verse.
Thank you in advance.,
|
Live with Peace
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
|
Posted: 16 Jan 2012 at 4:18am |
use a stored procedure, then you can create as many 'extra' rows as desired. CR reports only what is returned from the databaase (via table, stored proc, or view)...if it isn't in the set, CR doesn't show it (which you already know) and CR doesn't have the facility to add records the set. HTH
|
IP Logged |
|
Shrek
Newbie
Joined: 18 Jan 2012
Location: United Kingdom
Online Status: Offline
Posts: 3
|
Posted: 18 Jan 2012 at 4:03am |
Instead of subreports have you considered linking the same table multiple times to itself? As you add it Crystal will ask you to Alias the table.
Then join on Subject using a left outer join, making sure the table on the left hand side of your links tab contains all the subjects you want to display. Where there is no matching subject in the field Crystal will display a blank field.
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
|
Posted: 18 Jan 2012 at 6:54am |
The only problem that I see with the multiple linking is how many times do you do that? If it is dynamic and for 1 record 9 lines are needed and for another 20, how do you set up the report? Not that it's a bad solution, and I know that I have a bias toward stored procs, and that there are other ways to write reports and I would guess that stored procs could be overkill in some reports.... but I still think that in most cases a stored proc will save many a headache in getting around reporting issues.
|
IP Logged |
|
Shrek
Newbie
Joined: 18 Jan 2012
Location: United Kingdom
Online Status: Offline
Posts: 3
|
Posted: 18 Jan 2012 at 9:07pm |
Indeed - but without knowing what time period the OP wishes to run the report over its hard to know how much effort to throw at the problem!
Plus a Stored Procedure isn't always an option on the table for all report developers.
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
|
Posted: 20 Jan 2012 at 7:27am |
I realize that not all writer can / are allowed to create stored procs... Guess I have always been lucky that way. Hence, my comment that I don't always find/think of other ways to accomplish the same thing, as I can write a stored proc. Who knows, someday I might be limited as well.
|
IP Logged |
|
|