473,804 Members | 2,194 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1940
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**********@n ewcross-nursing.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.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
19618
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 quite repetitive. What I had though of was a form that you select key settings and based on that it writes out the letter in an intelligent manner: For example:
4
1726
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 and the end user. The report is a student grades sheet showing the results of all his/her activities and final grade for all students in any course--one page per student. Should I break this into several smaller queries? use DAO inside the...
15
4407
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 of students and columns of activities and the data are the students' scores in each activity. No problem, almost. The problem is that there are five classes at the moment and will be more classes (or courses) in future semesters. I don't want...
1
242
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, ClientGroups, Clients, Bookings & Depts. ClientGroups Clients Bookings -------------- ------------------ ------------------- cgId PK int ClientId PK int BookingId PK int cgName varchar ClientName...
4
3831
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" qryMailingListChristmas sql: SELECT DISTINCTROW tblClients.BillingName, tblClients.AccountType, tblClients.BillingAddress, tblClients.Contact, tblClients.BillingCity, tblClients.BillingState, tblClients.BillingZip,
4
9483
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 using the existing query
4
3137
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 first query where Item is Null. I use a subreport for the details, and the results display correctly. However, the Report_Details event of the subreport is executed about 2 or 3 times more than I would expect (I think 3 times when I have a
6
6873
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 similar reports, but all with different sized Address text boxes. For the function to work, the report need to be open in design view, so that the Text Box Width can be "measured". The function is obviously called for each line of the query (about...
3
1175
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 next and previous button. the buttons work until they go out of bounds. I am trying for example to bring the user back to the first record if the user is about to go out of the records range by pressing the next button and to the last record if the...
0
9715
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9595
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10603
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10353
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10099
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7643
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6869
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3836
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.