473,405 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Customised SQL query report

I am attempting to create a ASP.NET report whereby users can specify
which columns they wish to be able to view depending on the options
they select from a CheckBoxList.

I have 4 tables, ClientGroups, Clients, Bookings & Depts.

ClientGroups Clients Bookings
-------------- ------------------ -------------------
cgId PK int ClientId PK int BookingId PK int
cgName varchar ClientName varchar ClientId FK int
cgId FK int Hours money
deptId FK int

Depts
----------------
DeptId PK int
DeptName varchar

I'd like the report to display a list of all Client Groups and related
clients, and all other clients that don't belong to a group for a
particular department (dependant on which departments the user selects
to view).

Another column option to view is a Total Hours column, which is a sum
of all Bookings hours for that client group and/or client. Additional
column options include the department name, and others that i haven't
included in my table descriptions above.

Anyone got any suggestions how i can go about this?

I initially tried to create a dynamic SQL query based on the options
selected, but was struggerling on how to do a running total for the
Client Groups, and individual clients, and generally it was becoming
very messy.

I next tried to make use of a dataset and datatable but have run into
issues with using INNER JOINS with an SqlDataAdapter to populate a
dataset and using dataset relations. Errors i experienced was the
"These columns don't currently have unique values" as not all clients
belong to a client group, etc.

If anyone can point me in the right direction or has any advice, i'd be
much appreciated.

Thanks in advance

Dan Williams.

Oct 5 '05 #1
1 1915
Dan - if you grab the data you need - you can use Client side methods with
DataTables (ie .Select to filter your rows and .Compute to Aggregate them
based on conditions) http://www.knowdotnet.com/articles/expressions.html
This shoudl probably get you what you need.

HTH,

Bill
<da**********@newcross-nursing.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
I am attempting to create a ASP.NET report whereby users can specify
which columns they wish to be able to view depending on the options
they select from a CheckBoxList.

I have 4 tables, ClientGroups, Clients, Bookings & Depts.

ClientGroups Clients Bookings
-------------- ------------------ -------------------
cgId PK int ClientId PK int BookingId PK int
cgName varchar ClientName varchar ClientId FK int
cgId FK int Hours money
deptId FK int

Depts
----------------
DeptId PK int
DeptName varchar

I'd like the report to display a list of all Client Groups and related
clients, and all other clients that don't belong to a group for a
particular department (dependant on which departments the user selects
to view).

Another column option to view is a Total Hours column, which is a sum
of all Bookings hours for that client group and/or client. Additional
column options include the department name, and others that i haven't
included in my table descriptions above.

Anyone got any suggestions how i can go about this?

I initially tried to create a dynamic SQL query based on the options
selected, but was struggerling on how to do a running total for the
Client Groups, and individual clients, and generally it was becoming
very messy.

I next tried to make use of a dataset and datatable but have run into
issues with using INNER JOINS with an SqlDataAdapter to populate a
dataset and using dataset relations. Errors i experienced was the
"These columns don't currently have unique values" as not all clients
belong to a client group, etc.

If anyone can point me in the right direction or has any advice, i'd be
much appreciated.

Thanks in advance

Dan Williams.

Oct 7 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jay Best | last post by:
Hi there The story is as follows: I write up some pretty detailed reports on people, and what I am wanting to do is speed up the process as a proportion of the reports that I am writing are...
4
by: Richard Hollenbeck | last post by:
The following query takes about one second to execute with less than 1,000 records, but the report that's based on it takes from 15-30 seconds to format and display. That's frustrating for both me...
15
by: Richard Hollenbeck | last post by:
I tried to ask this question before on the 14th of January but I never got a reply. I'm still struggling with the problem. I'll try to rephrase the question: I have a crosstab query with rows...
1
by: dan_williams | last post by:
I am attempting to create a ASP.NET report whereby users can specify which columns they wish to be able to view depending on the options they select from a CheckBoxList. I have 4 tables,...
4
by: Jimmy | last post by:
I have a form with a command button on it that is supposed to open up a report and use a query to populate it. DoCmd.OpenReport "rptMailingList", acViewPreview, "qryMailingListChristmas" ...
4
by: Simon | last post by:
Dear reader, The syntax for Docmd.OpenReport is: OpenReport(ReportName, View, FilterName, WhereCondition, WindowMode, OpenArgs) Example The following example prints Sales Report while...
4
by: lorirobn | last post by:
Hi, I have a report displaying items that are missing from a room. I created 2 queries, the first getting the items IN the room, and the second being an "unmatched" query that references the...
6
by: Phil Stanton | last post by:
I am running a query that calls a function used to format addresses depending on the width of a control on a report that shows that address. The same query is used as the RecordSource of lots of...
3
by: panteraboy | last post by:
Hi there i have been deeply frustated as last week trying to figure out how to cycle through records on a form based on a query by using images instead of command buttons . I have a customised view...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.