fly_mo
Posts: 109
|
| Posted: 08/20/2008, 8:09 AM |
|
Hello All,
Probably a stupid question, however I haven't found a way round yet and nothing quite like it in the forum that I can find.
I have to fields in a row - Monday Mileage(MonM) & Friday MilageFriM) I need to subtract Friday from Monday to total the traveled weekly milage for each vehicle.
I have tried Count(FriM-MonM) in the sql I keep getting errors
I have tried
component->field->GetValue()
component->field2->GetValue()
component->field2-field->GetValue()
I don't think I'm even close.
Any pointers would be appreciated
Thanks
John
_________________
John |
 |
 |
wkempees
Posts: 1679
|
| Posted: 08/20/2008, 8:24 AM |
|
John
Count() will count the number of occurences.
Sum(), is the one that does what is says.
However if your Monday and friday mileages are postive numbers,
you just need to do the substraction in the SQL.
Do you want the result in the report as well?
If so, do it like this, assuming you used VisualQueryBuilder (VQB) to build the reports SQL.
SELECT MonM, FriM, FriM - MonM as weektotal
FROM tablename
WHERE.........
To do this just open VQB (press [...] in DataSource of Properties of the Report.
In the left pane click the SELECT, the lower right pane will now display the fields you selected by name or a * if you selected all fields.
Simply click an empty cell and add "FriM - MonM" then click the ALIAS cell and add "WeekTotal"
Press OK, go back to your report
In the Detail Line click (add a column, and in the header as well) add label and select the WeekTotal now available in the fields dropdown.
This solution has no need for custom code in the events.
Walter, tested.
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
fly_mo
Posts: 109
|
| Posted: 08/20/2008, 8:29 AM |
|
Walter,
Thanks for the really rapid response - I'm working on as we speak.
Regards
John
Worked like a charm....Thanks again.
_________________
John |
 |
 |
wkempees
Posts: 1679
|
| Posted: 08/20/2008, 8:50 AM |
|
Welcome!
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
|