Click here to Skip to main content
15,891,849 members
Please Sign up or sign in to vote.
1.44/5 (3 votes)
See more:
Hi,

I have a new project wherein we have to provide client the feature to perform adhoc queries where they can group by or filter etc.

I am new to this and I am finding hard how can we do this?

1) Can it be done from UI
2) or a database has to be given to them ?

Can anyone guide how to proceed with analysis for this.

What I have tried:

Trying to find various BI tools which will serve the purpose.
Posted
Updated 16-May-17 9:05am

The quick answers to:
1) Yes
2) No
First, determine what kind of queries the users are allowed to make, based on their roles and access rights.
Second, on server-side, compose the SQL script for each query bearing in mind SQL Injection[^]
Third, on the client-side, list out the type of queries that a logged in user is allowed to make, based on his role and access right, determine the UI controls to allow him to enter the necessary parameters for queries. For example, if the options are fixed, use radio buttons, check boxes, or drop down for selection, else text boxes. As far as possible, limit the use of free text by the user.
Lastly, the user will submit his choice of query and the required parameters to the server-side script which, among other things, cleanse and validate the parameters before injecting them into the correct SQL script for further processing.
 
Share this answer
 
v4
I have previously worked in an environment that had a similar requirement.
We had an overnight job that created a separate read-only database that could be queried by users/other clients.

We also had a UI that could run pre-defined queries against either the live database OR the "copy database" depending upon need ... for example "What work is left outstanding today" versus "What work was completed yesterday"

Our approach was to insist that they sent us (the IT dept) their requirements and we built the reports for them ... they could either be run in real time (two types of outputs ... excel or csv) or it was run for them overnight.

We did actually develop a sort of "I want this query" system that was very VERY limited in it's behaviours (avoid SQL Injection for example).

We did determine that appropriate conversation with the "client" could end up with *controlled* queries against either the live database or the MI database (copy taken each night purely for the users to query without F*ing up performance on the live system). We had programs running that read text (xml) files to determine what query to run and where to store the results.

I have to say, it was a very successful system, it just needed to be actively managed.

Life being what it is, they also discovered a 3rd party tool that would allow them to build their own ad-hoc queries... they (the business users) thought it was great. We (IT) knew it was s**t. Cost the company lots (like millions) of money

TL;DR; .... control "ad-hoc" queries like the bubonic plague. Let users "think" they're doing ad-hoc, tie it down so tight they cannot fart.

Apologies for the ranting ... this is the one single reason why I went grey in my 30's
 
Share this answer
 
use reporting services for this
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900