473,513 Members | 2,441 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calculate the total sum of data in CR

lotus18
866 Contributor
Hello World!


I have my sample report here



How to get the total sum of my fields that are not duplicated? The highlighted are examples of my duplicated fields (both lec and lab) but they don't have the same time.

I tried Suppress if duplicated under Format Object of the field but still it gives me a total of 19 for Lec (instead of 14) and 4 for lab (instead of 2)
Dec 3 '08 #1
19 1897
Dököll
2,364 Recognized Expert Top Contributor
Heiya lotus18!

What version of CR are you using? I do not have this installed here, but I do at work and have taken a couse in CR 11. Perhaps I can salvage something for you or at least ask gurus there; unless someone else sees your post and comes to aid before I do.

Sorry for your troubles!

Dököll
Dec 6 '08 #2
lotus18
866 Contributor
I don't know what version of crystal report is this. The CR I am using right now is integrated on the IDE of visual studio 2005. BTW, I also have a CR11 here installed in my pc.

Waiting for your replies. Thanks Dököll : )


Rey Sean
Dec 6 '08 #3
Dököll
2,364 Recognized Expert Top Contributor
Quite welcome, lotus18!

Questions for you; are you hoping to combine LEC and LAB to get fourteen, I'm a little unclear on that one. And if so, what are combining to get only 2 in LAB?

Will be loking at this at work, late Monday...

In a bit!
Dec 7 '08 #4
lotus18
866 Contributor
@Dököll

No. If you are going to compute the total LEC in the report no doubt it is 19 as seen above. But my problem is, since the highlighted details are the same subjects however they don't have the same schedules, it should be treated as 1. I know its getting complicated now : )

Like for example, I have 2 ENGG MECH (see image above), they have the same no. of lec which is 5, so there total is 10. I want to treat this 2 subjects as 5 lec and not 10. So, total Lec now is 14. Same as well as with the lab. Hope you got it : )


P.S. All same subjects here have the same lec or lab




Rey Sean
Dec 7 '08 #5
Dököll
2,364 Recognized Expert Top Contributor
Hello Rey!

Hope this isn't something you need right away, I could not do anything today, working CR is not my normal routine at work, had to jump into something straight away as usual...

It does sound a bit confusing, but I'll ask about Supressing dupes and see what I can gather, okay...

Rest assured I sent the link there for quick access.

Hopefully soon!

Dököll
Dec 9 '08 #6
QVeen72
1,445 Recognized Expert Top Contributor
Hi Lotus,

Create a Running Total Formula, for the Lab Field, and Put the Condition, if both the Fields Change then add to the Total, else, Dont add..
Or Create a new Formula Field, this is For Lec :
Expand|Select|Wrap|Line Numbers
  1. currencyvar MyLec;
  2. If RecordNumber =1 Then MyLec := {MyTable.Lec}
  3. Else
  4. If {MyTable.Lec} <>Previous ({MyTable.Lec}) And {MyTable.Lab} <> Previous ({MyTable.Lab}) Then
  5. MyLec := MyLec +{MyTable.Lec}
  6.  
Now, Place this formula in GrandTotal Section...

Regards
Veena
Dec 9 '08 #7
lotus18
866 Contributor
@QVeen72
Thanks Veena! I'll try this later at home.


Rey Sean
Dec 10 '08 #8
lotus18
866 Contributor
I tried your suggestion but unfortunately it did not work. It says "The Report Application Server Failed". :'(

Luckily, after a series of trial and error, I finally got it and I hope I had really make it. This is what I did. I edit my running total fields (total_lec) and on Evaluate Option, I changed the For each record option to On Change field option and I selected SubjectCode. I also did this to total_lab.



Now, my problem is, how can I make the duplicated subject's lec and lab fields to become empty or make the text to 0? I know this sounds complicated but I want to make this way. See my sample report below.



I want to change them (the orange block) to 0 so that it is more accurate and it looks neat.


I don't think that using Suppress if Duplicated will solve this problem.


Rey Sean
Dec 10 '08 #9
QVeen72
1,445 Recognized Expert Top Contributor
Hi,

Did you try my other suggestion..? Creating Formula Field...?

Regards
Veena
Dec 10 '08 #10
lotus18
866 Contributor
@QVeen72
Thanks Veena for your reply

What do you mean by your other suggestion? I'm a little bit confused with your suggestion I tried it but it didn't work. Hope I got your suggestion right.

Is it possible to make the duplicated subjects for both lec and lab fields to become empty or set them to 0.0? Like for this example.
--------------------------------------------------
Subjects. | Lec | Lab
--------------------------------------------------
  1. Subject 1 | 3.0 | 0.0 ...
  2. Subject 1 | 3.0 | 0.0 ...
  3. Subject 2 | 0.0 | 3.0 ...
  4. Subject 3 | 3.0 | 0.0 ...
  5. Subject 4 | 0.0 | 2.0 ...
  6. Subject 4 | 0.0 | 2.0 ...
  7. Subject 5 | 2.0 | 0.0 ...
    --------------------------------------------------
    Total| 8.0 | 5.0

I want to make the sample table above to this
--------------------------------------------------
Subjects. | Lec | Lab
--------------------------------------------------
  1. Subject 1 | 3.0 | 0.0
  2. Subject 1 | 0.0 | 0.0 ->Duplicate, set 0.0 for lec and 0.0 for lab
  3. Subject 2 | 0.0 | 3.0
  4. Subject 3 | 3.0 | 0.0
  5. Subject 4 | 0.0 | 2.0
  6. Subject 4 | 0.0 | 0.0 ->Duplicate, 0.0 for lec and set 0.0 for lab
  7. Subject 5 | 2.0 | 0.0
    --------------------------------------------------
    Total| 8.0 | 5.0

Rey Sean
Dec 10 '08 #11
QVeen72
1,445 Recognized Expert Top Contributor
Hi,

Create a New FormulaField, for GrandTotal, :

Expand|Select|Wrap|Line Numbers
  1. currencyvar MyLec;
  2. If RecordNumber =1 Then 
  3.     MyLec := {MyTable.Lec}
  4. Else
  5.     If {MyTable.Lec} <>Previous ({MyTable.Lec}) And {MyTable.Lab} <> Previous ({MyTable.Lab}) Then
  6.    MyLec := MyLec +{MyTable.Lec}
  7.  
  8.  
Now, Place this formula in GrandTotal Section...

Regards
Veena
Dec 11 '08 #12
lotus18
866 Contributor
Hi Veena,

As you have said, I created a new Formula fields named GrandTotal and I placed your codes. After that, I putted it on the GroupFooterSection of my report but still it didn't work. It gives me unexpected result. By the ways, this is the sample layout of my report now .



One more thing, is it neccessary to declare MyLec variable to a currency?


Rey Sean
Dec 11 '08 #13
QVeen72
1,445 Recognized Expert Top Contributor
Hi,

Can you Just Post the PrintPreview (Not Design View..) after pasting that Formula..

Regards
Veena
Dec 12 '08 #14
lotus18
866 Contributor
Here's my sample report:

Dec 13 '08 #15
Dököll
2,364 Recognized Expert Top Contributor
Sorry Rey Sean!

I hadn't forgotten you, it's just been a crazy week... Certainly happy that you have some company:-) Will be asking my colleagues to make it quicker response, of course only if V or others hadn't nailed it for ya...

In a bit!

Dököll
Dec 13 '08 #16
lotus18
866 Contributor
@Dököll
Still hoping :-(


Rey Sean
Dec 14 '08 #17
QVeen72
1,445 Recognized Expert Top Contributor
Hi,

I guess, Formula is Fine, Just Change the Sorting Order of the report..
Sort First by Lec and then by Lab...
Also post your formula here...

Regards
Veena
Dec 15 '08 #18
lotus18
866 Contributor
@QVeen72
I changed my sql statement from

Expand|Select|Wrap|Line Numbers
  1. SQLString = "Select Distinct * From PrintSchedule Where Courses.Title='" & frmPrintOption.cboCourses.Text & _
  2.             "' And Semester='" & frmPrintOption.cboSemester.Text & "' Order By SubjectCode"
  3.  
to this (Sorted First by Lec and then by Lab)

Expand|Select|Wrap|Line Numbers
  1. SQLString = "Select * From PrintSchedule Where Courses.Title='" & frmPrintOption.cboCourses.Text & _
  2.             "' And Semester='" & frmPrintOption.cboSemester.Text & "' Order By Lec, Lab ASC"
When I tried to the sort the lec and lab the value of @GrandTotal now is Php0.0 (previous value is Php3.0 as seen on post #15)

Here's the formula:

@GrandTotal (Formula Field)
Expand|Select|Wrap|Line Numbers
  1. //Taken From Veena
  2. currencyvar MyLec;
  3. If RecordNumber =1 Then 
  4.     MyLec := {PrintSchedule.Lec}
  5. Else
  6.     If {PrintSchedule.Lec} <>Previous ({PrintSchedule.Lec}) And {PrintSchedule.Lab} <> Previous ({PrintSchedule.Lab}) Then
  7.    MyLec := MyLec +{PrintSchedule.Lec}
#total_lec(Running Total Field)
    • Summary
  • Field to summarize : PrintSchedule.Lec
  • Type of summary: sum
    • Evaluate
  • On change of field : PrintSchedule.SubjectCode
  • On change of group : Group#1: PrintSchedule.SectionUnit - A

#total_lab(Running Total Field)
    • Summary
  • Field to summarize : PrintSchedule.Lab
  • Type of summary: sum
    • Evaluate
  • On change of field : PrintSchedule.SubjectCode
  • On change of group : Group#1: PrintSchedule.SectionUnit - A

Rey Sean
Dec 16 '08 #19
Dököll
2,364 Recognized Expert Top Contributor
Rey Sean, Do forgive me, a load of stuff happened... just bad timing, trust me I do have a number of CR experts near me and I would get you the answer you need even if I could not do it myself... thing is, I am entrusted to finish an application in Java and have been practicing and reading all about it...

Even if I am late in providing you a cure, I will still post what I find out, or at least tell you the smoke has finally cleared and that I'm on it.

As said I don't normally work with CR, it would have helped... makes it hard to go into it there at will. I am also an army of one at work:-)

Sorry Pal!
Dec 31 '08 #20

Sign in to post your reply or Sign up for a free account.

Similar topics

1
9971
by: Building Blocks | last post by:
Hi, All I need is a simle calculate form script which contains this: A script that can handle text input, radio buttons, checkboxes, and dropdowns. Each one of these variables will contain a...
53
5656
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is...
1
474
by: Manal/report designer | last post by:
Thank you in advance for any suggestions... I'm using crystal reports version 8 & SQL server. I've created a report that is composed of 2 parts: 1st part contains the mainreport which uses...
4
13766
by: dmisen | last post by:
I have data on air pollution coming from sources across the country, and control options for reducing pollution from each source. The example below shows data for: - 2 sources (plant_ID "001" and...
7
4312
by: Jurek | last post by:
I have 10+ experience in C/C++ - mostly automation and graphics. I have never written any business apps though. Recently I've been asked to write a simple report that would calculate sales...
3
2698
by: nimda via AccessMonster.com | last post by:
hii..i'm new here and dummies in access..i create one form that count total salary.i have 3 field.let say a,b and c.c is auto calculate and will show the total of a and b.my problem is when i look...
6
5242
by: kodt | last post by:
I have a form with 4 text input fields. The last one is the total of the previous three fields and should automatically calculate this value when a user enters data into any of the first 3. ...
1
3509
by: Jassim Rahma | last post by:
here we have aa limited broadband internet accounts, 5GB, 10GB and 15GB. I want to calculate the total threshold to monitor the internet usage using C#?
6
4864
by: Stuart Shay | last post by:
Hello All: I have a array which contains the totals for each month and from this array I want to get a running total for each month decimal month = new decimal; month = 254; (Jan) month =...
0
4624
by: SuzK | last post by:
I am trying to calculate in VBA in Access 2002 a moving average and update a table with the calculations. Fields in my WeeklyData table are Week Ending (date) ItemNbr (double) Sales Dollars...
0
7259
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7380
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7535
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5683
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5085
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
455
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.