How can I make generating reports more intuitive for a non programmer? - sql

I made a GUI for generation of SQL, something much similar to MS Access Visual Query Designer, the purpose was to let our Customer Service team make their own reports. But even after designing the whole thing and I can see that they are unsure on how to proceed for generating a new report.
SQL is much intuitive for me after long experience, but things like grouping, aggregate functions, various date/string functions are not easy for a non programmer.
How can I make it easier for a non programmer to build the SQL using a GUI?

Maybe you can apply a simplifying transcription of the SQL. Think something like https://ifttt.com/wtf. This in combination with the visual part might make it easier to understand what's happening.

Please follw up :
1) combo box for selecting database
2) combo box for selecting table for selected database
3) One Grid is display columns for selecting table.
4) user select,update column display name, order of display, aggregate of column option, group on column option.
5) finally display result in grid as per selection of column setting.

Related

Dictionary vs pivot Table and some office issues

In company when I currently work we have big issue with MS excel stability, hence my question below.
Recently I just learned about excel Dictonary code.
I know pivot tables and how they work.
sadly the issue is not with pivot themselves but with excel. (IT dept. is working on the issue for 3 weeks now, and we dont know when / if they gonna fix it)
Hence my big ask for thi community:
I would need a userform working with the dictonary.
What I would need is to create a code that could work as pivot table but using dictonaries (since theoreticaly they are faster and are outside of VBA / excel basic in-build option)
so?
Can some1 help in creating such code?
Is this the right option?
I would like to see a userform where I can choose my Table(ctrl+T) headers to choose by which header i want to sum values up, and ofc I would have to be able to choose a column by which the dictonary summing is working on.
Thank you both for answering.
Lets start then.
I watched ExcelMacroMastery videos regarding dictionaries,
In this example, he used them to make a basic sum exactly like the basic functionality of Pivot table.
So since that's the basic use where I work I wish to have a dictionary macro from which I can choose the column by which I get unique values and 2nd column with a sum from the second provided column from a table.
the issue is: if I show any file or any example this could result in macro working for this specific case, and I would like it to be able to choose by Table's (CTRL+T) headers for the unique values and to use some way(like a dropdown menu) to choose the column by which the sum can happen.
This instability is due to 32 bit office suite 365 working n 64 bi PCs/ laptops and recent company update made it even worse, now there is an issue with even basic save file option.
Not to mention excel crashing for no apparent reason.
So to sum up,
I need dictionaries to kinda step up and replace basic summarizing functionality of an pivot table.
or to replace this non pivot way:
use unique function to determine unique values from specified column (non-table object sadly)
Use sumif or sumoifs function to summarize the specified amount/value for that unique list.
//EDIT:
I kinda found what I was looking for thus the edit.
Im showing the link to the file I wish to change a bit:
https://app.monstercampaigns.com/c/s0iavndiopijkrar8ghp/
to this file I wish to add a user form by which the headers of the report will be chosen from source data, and by which the sum will occur.

Database to Excel charts (or pdf)

Hi guys I have a simple DB that has two fields in it (time and number 1-3), the data needs to be exported and shown in simple charts (horizontal bars from 0 to max time from my DB)? What is the best way to do that?
The easiest was to establish a direct data access from excel to SQL-Server and use Excel's abilities for the graphics.
If you need the data "exported", it is quite easy to get a table as CSV-list. Again this can be opened with Excel directly to do the graphical work there.
Depending on your environment you might think about any reporting tool, obviously the first choice was SSRS or PowerBI, which is part of the box.
You might even use a SELECT * FROM YourTable and just copy-and-paste the full result into Excel.
The main things to think about:
One-time action or regularly
Grade of automatism
Size of data / Count of rows
Location / Access-rights / Linkability of your systems
Existing tools

SQL Server 2012 Intellisense issue

My problem is that Intellisense does not provide complete auto suggest for the columns that I have in my tables .
Here is an example:
As you can see on SSMS it does give me auto suggest for my tables, but does not for columns. I have read couple articles about solving some Intellisense issues, but nothing helped. Here is things I tried described in this article: http://www.mssqltips.com/sqlservertip/2591/troubleshooting-intellisense-in-sql-server-management-studio-2012/
Any suggestions would be greatly appreciated, thank you for your time!
IntelliSense can't predict which table you're going to select from, and will wait until you have at least one table in the FROM clause, and probably only until you specify an alias. before populating the columns in the case of a join or other multi-table query.
There's a good reason for this. Imagine if you have CustomerID or InvoiceID in 20 different tables in your database. Should it list this 20 times? Which one should you pick? Do you really want all the columns in your entire database in a drop-down list? In a lot of scenarios this will be a very long list. And not pretty either, in things like SharePoint, NAV Dynamics, etc.
If you're not happy with the way the native IntelliSense works, there are 3rd party tools that might do what you want, but I'm not sure what you want will actually help you work any better.
First, that's because at the time of the screenshot SSMS does not know from what object you are selecting. In other words, it cannot guess what columns you're interested in when there is not a from clause in your select statement. If you try to type in the columns in the following select statement...
select from dbo.Invoices
you will see that SSMS will start to pick up your columns because you have already specified a from clause, so SSMS knows how to suggest you column names...because there is a table specified in the from clause
This is mainly occurs when you add any table in the Database OR Add any Column in the Table.
This is the known issue of the SQL Server 2012. You need to refresh the Cache for that.
You can achieve using 2 ways..
1) You can Refresh the Local Cache of the IntelliSense.
Open New Query window and Navigate to following menu.
Edit > IntelliSense > Refresh Local Cache
Shortcut key for this is (Ctrl + Shift + R)
2) ReConnect Your Database.

How does Access's query editor decide whether to discard my formatting?

Like a lot of developers who are comfortable with SQL syntax I get frustrated when working with Access's query editor. I'm talking about the raw SQL Syntax view, obviously.
One of its many annoying properties is that upon saving it will discard my layout / formatting. When reopening the query all I see is a bunch of unformatted SQL.
However, if my syntax is long and/or complex enough I've noticed that Access will retain my formatting and layout and, oh joy, the query remains clear and readable. I'm looking at an example right now with a page of SQL containing couple of UNIONs all nicely laid out from a few days ago.
At what point does Access flip over to allowing the user to retain his own formatting? Is it length? Complexity? And is there maybe even a trivial structural edit (if trivial structural isn't an oxymoron) I can make to all my queries which will force Access to leave my layout in place?
There are certain things that Access' query editor is not able to display in design mode.
Queries with UNION are the only thing that come to my mind right now, but there are probably more.
In my experience, Access always changes the layout as long as it's able to display the query in design mode.
As soon as you put something in the query that Access can not display in design mode (like UNION), Access leaves your layout and formatting as it is.
I couldn't figure out why Access kept changing my format in a union query (but not for every query or table included).
I simply created another SELECT query based upon the Union query and corrected everything in design view. It's a lot easier.
When I created the SELET query based upon the UNION query, I included tables or queries that I used as lookup tables and had formatted a field to select the second column from a record in a lookup field that the ubion query had anoyingly converted back to the first field in the selected record (usually the ID No of the record).
For example, I might lookup the account name in a record in the cash disbursements table that should display "Office Supplies Exp" but the Union Query converts at least one of the queries or tables I have combined in the union query to the Account Number, the first record in the lookup table, which was originally hidden in the lookup field.
Just to add to Christian's answer, I've done some more testing and find that UNION and DDL queries are left alone by Access.
If we add Pass through queries to that list, then that would match the queries deemed SQL Specific on the menu:
So, those would seem to be the three special cases.
Before saving just type the word union before the ;.
After opening Access next time, remove the word union and start working. When you want to save, first type union again.

Access Database

I need help in creating an query interface with access database.
In brief, with this query interface I want to see calculated future dates for different steps of a process based on the date the process actually started.
The future dates will always be at a fixed number of days after the start date. I hope I am able to explain this in an understandable manner.
I was thinking of using access forms? Please help me in this. I am not sure of how to proceed with this.
If your data is already in MS Access, then using Access Forms would be your easiest method of displaying that data. If the data is elsewhere, such as in Sql Server, you may be better suited in the long run using a different display technology.
That being said, to select a number of dates, as you would do in Access, you can use the Date Add function. If you had a table Processes with a column StartDate, you could use the query
SELECT *, DateAdd("d",5,StartDate) as "5 Days", DateAdd("d",36,StartDate) as "36 Days"
FROM Processes
to generate a record set to bind your form to. Binding that query to a new form is easy. You just need to change the record source by:
Right click anywhere blank in your new form
Select Properties
Change to the data tab
Click the button next to the text box labeled "Record Source"
Build your query using the built in editor (or, to paste the given SQL, right click in the designer view and select SQL view, then paste)
Close the query building dialog and use your new fields. You can drag them from the field list onto the design surface.