Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Selection diff records and Sum issue Post Reply Post New Topic
Author Message
awakendream
Newbie
Newbie


Joined: 23 Mar 2009
Online Status: Offline
Posts: 7
Quote awakendream Replybullet Topic: Selection diff records and Sum issue
     Posted: 23 Mar 2009 at 8:32am
Hi,  this question might looks stupid as i'm a newbie on this CR.
I was assigned to make a summary report for file processing using Crystal Report and found some problem here :

No Date  Tx_Id  Orgnal_Tx_Id  Ttl_rcds ok_rcds unprocess_rcds failed_rcds
1   1Mar   001             -                10          2                6                      2
2   2Mar   011            001             6           1                3                      2
3   3Mar   012            001             5           1                2                      2
4   4Mar   013            001             4           2                1                      1
5   5Mar   014            001             2           1                1                      0
6   6Mar   015            001             1           0                1                      0
7   7Mar   016            001             1           0                1                      0

This is my file processing result and also the CR preview.. after i run the program, each records will be stored in DB, and i'm not worry about the design as i just pull it out from DB.
i will run this generated report everyday and will show the last 6 days records... (i.e. 7Mar is today... then will show 1-7Mar)
after that, i have to show the summary like this :

Total_records = 10
Successful_records = 7 (total from ok_rcds)
expired records = 3  --  1+0(both from 7Mar) + 2 (failed rcds 1st time)

the problem is:
how to read and get the expired records which is 3.. i need to get 1 from today's records (unprocessed + failed from 7Mar) and 2 (from first row records)
any formula or tricks can help this?
Thanks a lot for the advice Smile

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 23 Mar 2009 at 9:03am
So you want to get a SUm of:
Failed_Rcds where row is today-6days +
unprocessed_rcds and failed_rcds where date=today, correct?
You can use a formula and Sum on that.
If datediff("d",table.datefield,currentdate)=6 then table.failed_rcds else
if datediff("d",table.datefield,currentdate)=0 then table.unprocessed_rcds + table.failed_rcds else 0
IP IP Logged
awakendream
Newbie
Newbie


Joined: 23 Mar 2009
Online Status: Offline
Posts: 7
Quote awakendream Replybullet Posted: 24 Mar 2009 at 1:18am
Hi DBlank, thanks for ur advice..
after a long time trying, i can understand what u mean.. Smile

could you help me again 1 more time for this?
For the final summary that i need to create, i must get it from the 1st row... Is there any way to show all the records again below, but only show the first row? example

Final Summary
Date_Processed  Tx_Id  Orgnal_Tx_Id Ttl_rcds  OK_rcds   Expired_rcds
       1 Mar              001              -                 10        (can ignore this 2, as i
                                                                              will use formula to show)

Thanks a lot for ur help!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 24 Mar 2009 at 7:48am
Probably the easisest way is to insert a sub report that only displays data where the date is 6 days ago.
For some of the data you could use Minimum and Maximum of the fields but I am not sure that this is always the case for all the columns so the subreport would be better to consistently show all the correct data.
Probably some easy variable statements you could use but I am not sure what that would.
Anyone else want to take a stab at that if the sub report idea is not sufficient...
IP IP Logged
awakendream
Newbie
Newbie


Joined: 23 Mar 2009
Online Status: Offline
Posts: 7
Quote awakendream Replybullet Posted: 26 Mar 2009 at 7:17am
Hi DBlank, yeah previously i was using subreport.. just thinking is there any other way for that... thanks anyway 4 ur advice Big%20smile
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum