Create a Multi-Column Report Using DevEx Grid - sql

I have a daily sales report query and it have 2 columns like
days sales
1 12
2 65
3 25
...
30 24
but when I want to print it there is a lots of free spaces on paper, so I want to seperate query with a percentage (like % 33)
and result will be like 3 x 2 columns for one paper. and it will be more comfortable for me.
days sales days sales days sales
1 12 11 21 21 5
2 65 12 53 22 18
3 25 13 0
...
10 45 20 12 30 55
Any way to do this with DevEx Grid?
this is the view which I get
and I dont want such kind of empty paper for couple of records..

You will not find an easy way to achieve the desired result using XtraGrid, because it is not intended for reporting. I suggest that you create reports using another product: XtraReports.

Related

Total of Various Columns as a Separate Column in Oracle

Could you help me out with an issue I have in Oracle?
Let's say I have a table that tells me about how many items were sold in each month, and looks like so:
Item
January
February
March
April
Computer
3
5
2
9
TV
10
12
16
14
Camera
22
25
20
27
What I need in the output is a table that would count the total number of items sold over the period, and would look like this:
Item
January
February
March
April
Total
Computer
3
5
2
9
19
TV
10
12
16
14
52
Camera
22
25
20
27
94
I am honestly not sure how to do that. Should I use grouping()?
Thank you in advance.
You don't need to use grouping at all just try to plus all columns as a new column Total.
SELECT T.*,
(January + February + March + April) Total
FROM T

Need SQL query for Comparing Duplicate Value and print respective column name

HI expert and need your help me on the below requirement in oracle.
I have list of columns and from that I need to know based on the Model No. column filter if the other columns have any duplicate values, if yes then it should display comments column as Column Name + duplicate value (Ex: Category_description having duplicate value)
If the any of the column is blank it should print Column Name is blank (Ex: Parent Category ID has blank value).
The data is:
M_No CAT_DESC CAT_ID P_CAT_ID Comments
1 computer hardware 10 90
1 monitors 11 10
1 printers 12 10
1 harddisks 13 10 CAT_DESC duplicate
1 memory components 14 10
1 harddisks 15 10 CAT_DESC duplicate
1 keyboards, mouses 16 10
1 other peripherals 17 10
1 harddisks 19 10 CAT_DESC duplicate
2 office fur supplies 30 90
2 capitalizable assets 31 30
2 office daily use 32 30
2 manuals, other books 33 30 CAT_DESC, CAT_ID duplicate
2 manuals, other books 33 30 CAT_DESC, CAT_ID duplicate
3 computer hardware 90 P_CAT_ID is blank value
4 computer software 20 90
4 spreadsheet software 21 20
4 processing software 22 20
4 23 CAT_DESC, P_CAT_ID is blank
4 operating systems 24 20
4 software development 25 20
4 miscellaneous software 29 20

How to calculate maximum of three in combined query

usage
The image shows works that I have done in access. The query "overall usage review" count the number of usages in each month by using combined query.
After this step, I want to show the maximum three of usage.quantity among 12months and calculate with the formula ( E.g., "Total MAX three months usage"/3)
E.g.,
Warehouse Part Number ........................................................
A X01 9 16 7 14 10 5 9 11 6 3 11 5
A X02 20 22 10 12 20 17 18 29 14 13 11 19
B X01 8 7 3 26 17 6 3 2 5 10 8 14
B X05 9 10 16 6 10 4 13 12 6 4 3 6
I want to result it as below...
Warehouse Part Number Maximum three usage quantity Results
A X01 41 41/3
A X02 71 71/3
B X01 57 19
B X05 39 13
Someone told me to use dynamic sql, but I dont know what it is... Pls tell me how to solve this problem in detail. The problem stuck in my mind for a very long time...

MS Access - Dynamic Crosstab Query - VBA for Totals Row that provides Column totals

I have built a dynamic crosstab query where the user selects options from multiple combo boxes and then I use VBA to update the SQL for the cross tab query. It is then, in turn, displayed on a subform. My question is basically how can I programmatically (VBA or SQL, don't really care either way) add a totals row that calculates the average of each column. I know how to do this manually, but since the number of columns and column headings are not set, this is impractical. I would basically like to automatically set a totals row at the bottom for the average of each column regardless of the number of columns or column headers. An example of a potential case is shown below with the user inputs on top.
Group: A
Team: All
Start Date: 1/1/2014
End Date: 5/31/2014
Query Type: Monthly
Name 2014-Jan 2014-Feb 2014-Mar 2014-Apr 2014-May
John Doe1 1 2 3 4 5
John Doe2 2 2 2 2 2
John Doe3 1 5 9 13 17
John Doe4 2 10 18 26 34
John Doe5 1 8 15 22 29
John Doe6 2 12 22 32 42
John Doe7 1 15 29 43 57
John Doe8 2 14 26 38 50
John Doe9 1 12 23 34 45
Total (Avg): 1.44 8.89 16.33 23.78 31.22
I am trying the generate the bottom "Totals" row programmatically without knowing the column count ahead of time and without manually inserting totals via the ribbon.
You can use a pivot table on a simple select query.
Doesn't the crosstab query do that for you?
https://support.office.com/en-us/article/Make-summary-data-easier-to-read-by-using-a-crosstab-query-8465B89C-2FF2-4CC8-BA60-2CD8484667E8
http://www.fmsinc.com/microsoftAccess/query/crosstab-report/index.html
Although crosstab queries are somewhat limited in their power, you can certainly create another query to do a basic average of the crosstab query you just created.

How do I loop through a table until condition reached

I have a table product, pick_qty, shortfall, location, loc_qty
Product Picked Qty Shortfall Location Location Qty
1742 4 58 1 15
1742 4 58 2 20
1742 4 58 3 15
1742 4 58 4 20
1742 4 58 5 20
1742 4 58 6 20
1742 4 58 7 15
1742 4 58 8 15
1742 4 58 9 15
1742 4 58 10 20
I want a report to loop around and show the number of locations and the quantity I need to drop to fulfil the shortfall for replenishment. So the report would look like this.
Product Picked Qty Shortfall Location Location Qty
1742 4 58 1 15
1742 4 58 2 20
1742 4 58 3 15
1742 4 58 4 20
Note that it is best not to think about SQL "looping through a table" and instead to think about it as operating on some subset of the rows in a table.
What it sounds like you need to do is create a running total that tells how many of the item you would have if you were to take all of them from a location and all of the locations that came before the current location and then check to see if that would give you enough of the item to fulfill the shortfall.
Based on your example data, the following query would work, though if Locations aren't actually numerics then you would need to add a row number column and tweak the query a bit to use the row number instead of the Location Number; It would still be very similar to the query below.
SELECT
Totals.Product, Totals.PickedQty, Totals.ShortFall, Totals.Location, Totals.LocationQty
FROM (
SELECT
TheTable.Product, TheTable.PickedQty, TheTable.ShortFall,
TheTable.Location, TheTable.LocationQty, SUM(ForRunningTotal.LocationQty) AS RunningTotal
FROM TheTable
JOIN TheTable ForRunningTotal ON TheTable.Product = ForRunningTotal.Product
AND TheTable.Location >= ForRunningTotal.Location
GROUP BY TheTable.Product, TheTable.PickedQty, TheTable.ShortFall, TheTable.Location, TheTable.LocationQty
) Totals
-- Note you could also change the join above so the running total is actually the count of only the rows above,
-- not including the current row; Then the WHERE clause below could be "Totals.RunningTotal < Totals.ShortFall".
-- I liked RunningTotal as the sum of this row and all prior, it seems more appropriate to me.
WHERE Totals.RunningTotal - Totals.LocationQty <= Totals.ShortFall
AND Totals.LocationQty > 0
Also - as long as you are reading my answer, an unrelated side-note: Based on the data you showed above, your database schema isn't normalized as far as it could be. It seems like the Picked Quantity and the ShortFall actually depend only on the Product, so that would be a table of its own, and then the Location Quantity depends on the Product and Location, so that would be a table of its own. I'm pointing it out because if your data contained different Picked Quantities/ShortFall for a single product, then the above query would break; This situation would be impossible with the normalized tables I mentioned.