TAILIEUCHUNG - MASTERING DELPHI 6 phần 7

Nhiều ứng dụng có một thanh công cụ với một hộp kết hợp, bạn có thể sử dụng để chọn một phông chữ. Nếu bạn thường sử dụng một hộp kết hợp tùy chỉnh như thế này, tại sao không biến nó thành một thành phần? Nó có lẽ sẽ mất ít hơn một phút. Để bắt đầu, đóng bất kỳ dự án hoạt động trong môi trường Delphi | ClientDataSet and MyBase 645 if gbFirst in 1 then Text else Text end FIGURE The CdsCalcs example demonstrates that by writing a little code you can have the DBGrid control visually show the grouping defined in the ClientDataSet. Defining Aggregates Another feature of the ClientDataSet component is support for aggregates. An aggregate is a calculated value based on multiple records such as the sum or the average value of a field for the entire table or a group of records defined with the grouping logic I ve just discussed . Aggregates are maintained that is they are recalculated immediately if one of the records changes. For example the total of an invoice can be maintained automatically while the user types in the invoice items. Note Aggregates are maintained incrementally not by recalculating all the values every time one value changes. Aggregate updates take advantage of the deltas tracked by the ClientDataSet. For example to update a sum when a field is changed the ClientDataSet subtracts the old value from the aggregate and adds the new value. Only two calculations are needed even if there are thousands of rows in that aggregate group. For this reason aggregate updates are instantaneous. Copyright 2001 SYBEX Inc. Alameda CA 646 Chapter 14 Client Server Programming There are two ways to define aggregates. You can use the Aggregates property of the ClientDataSet which is a collection or you can define aggregate fields using the Fields editor. In both cases you define the aggregate expression give it a name and connect it to an index and a grouping level unless you want to apply it to the entire table . Here is the Aggregates collection of the CdsCalcs example object ClientDataSet1 TClientDataSet Aggregates item Active True AggregateName Count ExpreSsion COUNT NAME GroupingLevel 1 IndexName ClientDataSetllndexl Visible False end item Active True AggregateName TotalPopulation Expression SUM POPuLaTION

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.