Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > DB-Aware

Lost Password?

Thread Tools Display Modes
Old 09-27-2007, 01:46 AM
claudiopisani claudiopisani is offline
Junior Member
Join Date: Sep 2007
Posts: 1
Default DBGrid Question

Hi everybody,

I have an application that collects data from biometric hand readers. The information is the clocking of employees.

What I would like to do is a chart that shows two lines. Basically I will allow the user to enter the proper Time In for a particular employee, which I want to represent as a straight line in the graph, and his/her actual Time Ins for a set period. I would like Time (in hour steps)to be displayed on the vertical axis, and the date to be displayed on the horizontal axis

The query is fine, and I have all the info I need, but I can't get the chart to display what I want.

Any help would be appreciated.

Thanks and Regards

Claudio Pisani
Reply With Quote
Old 08-20-2009, 10:48 AM
digitiger digitiger is offline
Senior Member
Join Date: Jan 2001
Posts: 716
Lightbulb If you have query with proper result

What is the query (SQL) you are using and what are the returned fields in the result data set?

If you have the three related field (say field named "Employee", "Dates" & "Totaltime") then the Work is almost complete.

First of all at design time you set the datasource of the Chart component to your Tquery and then set the related fields for the axis (Dates for X axis and TotalHours for Y axis).

If you also wish to show the employee info in the title or somewhere then at run time you can do that by following:

Mychart.title.text.text := 'Details of employee: ' + Query1.fieldvalues['employee'];

then comes the part of restricting the information to single selected employee.

When user specifies the employee info, you first filter the dataset component (TQuery or whatever u are using) so that it holds the datewise hours information for that single employee. Alternatively, you can use a bind variable in your query string and then close/re-open the query at run time as below:

Query1.SQL.Text := 'Select employee, Dates, Sum(hours) "Total Hours" from Mytable where Employee = :Emp';

In query1's BeforeOpen event you supply the value of bind variable with employee information as below:

Query1.Params(0).Value := EmployeeEdit.Text; //the selected employee value being specified by user in Edit box named EmployeeEdit. You can replace the appropriate place holder instead of EmployeeEdit.text

then in the change even of the above place holder (EmployeeEdit) you can write following two lines:


As and when the

Hope it helps.
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 10:53 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.