I am new to ExtJS and cannot seem to figure out how to group columns with its own header. An example of what I'm trying to accomplish is below:
+-----------------------+-----------------------+
| Group 1 | Group 2 |
+-------+-------+-------+-------+-------+-------+
| col1 | col2 | col3 | col4 | col5 | col6 |
+-------+-------+-------+-------+-------+-------+
| |
| data goes here |
| |
+-----------------------------------------------+
Obviously, by default I can get col1 through col6 as they are the standard columns. However, I want to add the group names above them. How would I go about doing this or is there a resource that already shows how to do this? I have searched Google for about an hour with no prevail. Thanks in advance for your help!
Like Jared said the pivot grid is great if you want ExtJS to do the pivoting for you. You feed the pivot grid a list of records, specify what to group on on the y and x axis and voila.
I think that would work up to a couple of hundred rows but will become problematic with more ( I have done pivot tables in a online research application I wrote in ExtJS with pivoting on millions of records). Also if you want to feed it your entire grouped data yourself you don't want the pivot grid ( I think)
For both cases you need the GroupHeader plugin:
http://www.sencha.com/forum/showthread.php?22337-Ext.ux.plugins.GroupHeaderGrid-(v1.3)
Good luck with any 1 you choose, both are great
Rob
It looks like you are looking for the pivot grid:
http://dev.sencha.com/deploy/dev/examples/pivotgrid/simple.html
Related
I'm having trouble hiding rows that have no data for certain dimension members for the selected measure, however there are rows for that member in the measuregroup.
Consider the following datasource for the measuregroup:
+---------+----------+----------+----------+--------+
| invoice | customer | subtotal | shipping | total |
+---------+----------+----------+----------+--------+
| 1 | a | 12.95 | 2.50 | 15.45 |
| 2 | a | 7.50 | | 7.50 |
| 3 | b | 125.00 | | 125.00 |
+---------+----------+----------+----------+--------+
When trying to create a pivottable based on a measuregroup in a SSAS-cube, this might result in the following:
However, I would like to hide the row for Customer b, since there are no results in the given pivottable. I have tried using Pivottable Options -> Display -> Show items with no data on rows but that only works for showing/hiding a Customer that's not at all referenced in the given measuregroup, say Customer c.
Is there any way to hide rows without results for the given measure, without creating a seperate measuregroup WHERE shipping IS NOT NULL?
I'm using SQL-server 2008 and Excel 2013
Edit:
For clarification, I'm using Excel to connect to the SSAS cube. The resulting pivottable (in Excel) looks like the given image.
In the DSV find the table with the shipping column and add a calculated column with expression:
Case when shipping <> 0 then shipping end
Please go to the properties window for the Shipping measure in the cube designer in BIDS and change the NullHandling property to Preserve. Change the source column to the new calculated column. Then redeploy and I am hopeful that row in your pivot will disappear.
And ensure Pivottable Options -> Display -> Show items with no data on rows is unchecked.
If that still doesn't do it connect the Object Explorer window of Management Studio to SSAS and tell us what version number it shows in the server node. Could be you aren't on the latest service pack and this is a bug.
Go in your pivot table in Excel, click on the dropdown on your customer column. In the dropdown menu you will find an option called Value Filters. There you can set something like Shipping greater than 0.1.
This filters your Customer dimension column based on the measure values.
Maybe something like this (but I don't see the pivot...)
DECLARE #tbl TABLE(invoice INT,customer VARCHAR(10),subtotal DECIMAL(8,2),shipping DECIMAL(8,2),total DECIMAL(8,2));
INSERT INTO #tbl VALUES
(1,'a',12.95,2.50,15.45)
,(2,'a',7.50,NULL,7.50)
,(3,'b',125.00,NULL,125.00);
SELECT customer, SUM(shipping) AS SumShipping
FROM #tbl
GROUP BY customer
HAVING SUM(shipping) IS NOT NULL
I just want to map dynamically lookup column in LOOKUP Transform SSIS
In my task that look up column will all ways change
For Example:
TableA
```````
Col1 | Col2 | Col3
--------+-----------+---------
1 | 2 | 3
2 | 1 | 4
3 | 2 | 1
This time lookup columns are Col1+Col2
Next day it will change to Col2+Col3
I want to map dynamic input column with ssn
Depending on how the lookup columns are defined from one day to the next, it may be easier to make the query in the Lookup transformation dynamic instead. Check out the following link:
https://suneethasdiary.wordpress.com/2011/12/28/creating-a-dynamic-query-in-lookup-transformation-in-ssis/
I've shifted through views and other points and I've gotten to here. Take example below
Name | Quantity | Billed |
| | |
PC Tablet| 0 | 100 |
PC Tablet| 100 | -2345 |
Monitor | 9873 | 0 |
Keyboard | 200 | -300 |
So basically the select I would do off this view. I would want it to Bring in the data BUT it be ordered by the Name first so its in nice alphabetical order and also for a few reasons some of the records appear more then once (I think the most is 4 times). If you add the up the rows with duplicates the true 'quantity' and 'billed' would be correct.
NOTE: The actual query is very long but I broke it down for a simple example to explain the problem. The idea is the same but there is A LOT MORE columns that needs to be added together... So I'm looking for a query that would bring them together if it contains the same name. I've tried a bunch of different queries with no success either it rolls ALL the rows into one. or it won't work and I get a bunch of null errors/ name column is invalid in the select list/group by because it's not an aggregate function..
Is this even possible?
Try:
SELECT A.Name, A.TotalQty, B.TotalBilled
FROM (
SELECT Name, SUM(Quantity) as TotalQty
FROM YourTableHere
GROUP BY Name
) A
INNER JOIN
(
SELECT Name, SUM(Billed) as TotalBilled
FROM YourTableHere
GROUP BY Name
) B
ON A.Name = B.Name
I have a table that contains a user_id, and an XML field containing basically a series of values. I need to run a report against the data in the XML, but for the life of me I cannot get the XML out of the field in any useful fashion.
Here's the schema for the table:
|-----------------|
| type | name |
|-----------------|
| int | user_id |
| XML | crest |
|-----------------|
And here's a sample of the XML stored in the faves field:
<crest xmlns="SANITIZED" keyAttrib="slot" valueType="String">
<badge slot="0">Money</badge>
<badge slot="1">Independence</badge>
<badge slot="2">Power</badge>
</crest>
In order to most easily generate the report I need, an "associative" table, listing the user_ids and each badge they earned, 1 badge per row, so each user would have up to 3 rows. I am trying to get the data into a form like this:
|---------------------|
| type | name |
|---------------------|
| int | user_id |
| varchar | badge |
|---------------------|
I have tried everything I can think of and scoured the Internet as well as the MSDN docs to no avail. No matter what I try, I cannot seem to get the data massaged into the form I want. I am sure it is possible, but I am at my wit's end as to how to get this to work. Any help, tips, or suggestions would be greatly appreciated!
You should be able to do something like this:
;WITH XMLNAMESPACES('http://schemas.test.com' AS ns)
SELECT
tbl.user_id,
t.badges.value('#slot', 'int') AS 'Slot',
t.badges.value('.', 'varchar(60)') AS 'Badge'
FROM
dbo.YourTable tbl
CROSS APPLY
tbl.Crest.nodes('(/ns:crest/ns:badge)') AS t(badges)
Basically join your base table "YourTable" with a collection of XML nodes (assuming your XML namespace would be "http://schemas.test.com"). From this list of nodes, you just pluck out the bits and pieces you need, as INT, VARCHAR or whatever type it might be.
Suppose I have the following data:
OrderNumber | CustomerName | CustomerAddress | CustomerCode
1 | Chris | 1234 Test Drive | 123
2 | Chris | 1234 Test Drive | 123
How can I detect that the columns "CustomerName", "CustomerAddress", and "CustomerCode" all correlate perfectly? I'm thinking that Sql Server data mining is probably the right tool for the job, but I don't have too much experience with that.
Thanks in advance.
UPDATE:
By "correlate", I mean in the statistics sense, that whenever column a is x, column b will be y. In the above data, The last three columns correlate with each other, and the first column does not.
The input of the operation would be the name of the table, and the output would be something like :
Column 1 | Column 2 | Certainty
CustomerName | CustomerAddress | 100%
CustomerAddress | CustomerCode | 100%
There is a 'functional dependency' test built in to the SQL Server Data Profiling component (which is an SSIS component that ships with SQL Server 2008). It is described pretty well on this blog post:
http://blogs.conchango.com/jamiethomson/archive/2008/03/03/ssis-data-profiling-task-part-7-functional-dependency.aspx
I have played a little bit with accessing the data profiler output via some (under-documented) .NET APIs and it seems doable. However, since my requirement dealt with distribution of column values, I ended up going with something much simpler based on the output of DBCC STATISTICS. I was quite impressed by what I saw of the profiler component and the output viewer.
What do you mean by correlate? Do you just want to see if they're equal? You can do that in T-SQL by joining the table to itself:
select distinct
case when a.OrderNumber < b.OrderNumber then a.OrderNumber
else b.OrderNumber
end as FirstOrderNumber,
case when a.OrderNumber < b.OrderNumber then b.OrderNumber
else a.OrderNumber
end as SecondOrderNumber
from
MyTable a
inner join MyTable b on
a.CustomerName = b.CustomerName
and a.CustomerAddress = b.CustomerAddress
and a.CustomerCode = b.CustomerCode
This would return you:
FirstOrderNumber | SecondOrderNumber
1 | 2
Correlation is defined on metric spaces, and your values are not metric.
This will give you percent of customers that don't have customerAddress uniquely defined by customerName:
SELECT AVG(perfect)
FROM (
SELECT
customerName,
CASE
WHEN COUNT(customerAddress) = COUNT(DISTINCT customerAddress)
THEN 0
ELSE 1
END AS perfect
FROM orders
GROUP BY
customerName
) q
Substitute other columns instead of customerAddress and customerName into this query to find discrepancies between them.