IgGrid - How to execute multiple grouping in code? - grouping

In my project I have to create my own multiple sorting and multiple grouping dialogs. Basically user can choose which columns should be included, select order and direction of operation.
For multiple sorting I use this function and it works
.igGridSorting( "sortMultiple", [exprs:array] );
The problem is now with grouiping. Is there any function which will behave similary? I mean executing with array of grouping expressions (which define columns to group by, order of grouping and direction of grouping (acs / desc)) as parameter? (this feature is supported by ignite-ui built-in dialog)
In the documentation I have found:
.igGridGroupBy( "groupByColumns" );
The description is "Adds a column to the group by columns list, executes the group by operation and updates the view."
But there is nothing about how add this columns.

There is no public API method for grouping multiple columns.
The build-in dialog sets the expressions into the datasource and also takes care to rebind the grid and rebuild the grouping area. Unfortunately none of this is exposed as public API.
So the easiest approach would be to go around the columns you need to group and invoke groupByColumn for each column.
Another thing you can do is to re-create the grid with another set of columnSettings for the GroupBy feature.

Related

How to get row count for large dataset in Informatica?

I am trying to get the row count for a dataset with 280 fields with out having affect on the performance. Looking for best possible ways to perform.
The better option to avoid performance issue is, use sorter transformation and sort the columns and pass the pipeline to aggregator transformation. In aggregator transformation please check the option sorted input.
In terms if your source is a database then, index the required conditional columns in the table and also partition the table if required.
For your solution, I have in mind 2 options:
Using Aggregator (remember to use a predefined order by to improve performance with the next trans), SQ > Aggregator > Target. Inside the aggregator add new ports with the sum() and/or count() functions. Remember to select the columns to group
Check this out this example:
https://www.guru99.com/aggregator-transformation-informatica.html
Using Source Qualifier query override. Use a traditional select count/sum with group by from the database- SQ > Target.
By the way. Informatica is very good with the performance, more than the columns you need to review how many records you are processing. A best practice is always to stress the datasource/database more than the Infa app.
Regards,
Juan
If all you need is just to count the rows, use the Aggregator. That's what it's for. However, this will create cache - to limit it's size, use a single port.
To avoid caching, you can use a variable in expression and just increment it. This however will give you an extra column with all rows numbered, not just a single value. You'll still need to aggregate it. Here it would be possible to use aggregater with no function to return just the last value.

Merge cells with similar but different data, different spelling

I am trying Tableau with data extracted from Salesforce. The input includes a "Country" record were the row have different spellings for the same thing.
Example: Cananda, CANADA, CAnada etc.
Is there a way to fix this in Tableau?
The easiest solution is create a group field based on your Country field.
Select Country in the data pane on the left side bar, right click and choose Create Group. Select elements that you want to group together put them into a single group, say Canada, that contains all variations of spelling.
This new group field initially has a name of Country (group). You may want to rename it Country_Corrected. (Or even better, rename the first field, Country_Original, and call the group field simply Country. Then you can hide Country_Original)
Groups are implemented using SQL case statements. They have many uses, but one application is to easily tolerate some inconsistent spellings in your data source without having to change your data. In general, you can specify several transformations like this that take effect at query and visualization time. For very large data sets, or for very complicated transformations, you may eventually want to push some of them upstream in your data pipeline to get better performance. But make those optimizations later when you've proven the necessity.
If the differences are just in case (upper vs lower), you can right-click the Country dimension, and create a calculated field called something like "New Country", and use the following formula to make the case consistent:
upper([Country])
Use this new "New Country" calc dimension instead of your "Country" dimension, and it will group them all without case sensitivity, and display as uppercase. Or you can use "lower" instead of "upper" if preferred.

Infragistics UltraGrid - How to use displayed values in group by headers when using an IEditorDataFilter?

I have a situation where I'm using the IEditorDataFilter interface within a custom UltraGrid editor control to automatically map values from a bound data source when they're displayed in the grid cells. In this case it's converting guid-based key values into user-friendly values, and it works well by displaying what I need in the cell, but retaining the GUID values as the 'value' behind the scenes.
My issue is what happens when I enable the built-in group by functionality and the user groups by a column using my editor. In that case the group by headers default to using the cell's value, which is the guid in my case, so I end up with headers like this:
Column A: 7F720CE8-123A-4A5D-95A7-6DC6EFFE5009 (10 items)
What I really want is the cell's display value to be used instead so it's something like this:
Column A: Item 1 (10 items)
What I've tried so far
Infragistics provides a couple mechanisms for modifying what's shown in group by rows:
GroupByRowDescriptionMask property of the grid (http://bit.ly/1g72t1b)
Manually set the row description via the InitializeGroupByRow event (http://bit.ly/1ix1CbK)
Option 1 doesn't appear to give me what I need because the cell's display value is not exposed in the set of tokens they provide. Option 2 looks promising but it's not clear to me how to get at the cell's display value. The event argument only appears to contain the cell's backing value, which in my case is the GUID.
Is there a proper approach for using the group by functionality when you're also using an IEditorDataFilter implementation to convert values?
This may be frowned upon, but I asked my question on the Infragistic forums as well, and a complete answer is available there (along with an example solution demonstrating the problem):
http://www.infragistics.com/community/forums/p/88541/439210.aspx
In short, I was applying my custom editors at the cell level, which made them unavailable when the rows were grouped together. A better approach would be to apply the editor at the column level, which would make the editor available at the time of grouping, and would provide the expected behavior.

Excel Interop: Grouping columns

How do i group columns using Excel interop?
if i record a macro (usually a good way to get started) i get this code:
Columns("I:M").Select
Selection.Columns.Group
unfortunately this doesn't work due to several problems, at least in C++. First of all, Application.Selection returns a normal Range, then Range.Columns is another Range. And Range.Group is this method:
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.range.group%28v=office.11%29.aspx
This method only works in connection with pivot tables.
So how do i create a column group using Excel interop?
Even if i manage to create a group, how can i shrink/expand it? By that i mean clicking on the + to show the content of the group, or rather the other way around, "click" on the minus to hide the group. If i do that while recording a macro, it is not reflected in the macro at all.
Despite the fact that the Range.Group() documentation appears to relate to pivot tables, if you extract the columns using Range.Columns, and then apply the .Group() method to that range, it will have the desired effect. In C#:
Range range = sheet.get_Range("c1","e1");
range.Columns.Group();
Edit: The complete example, again in C# (apologies, it's the example I have handy):
Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application();
app.Visible = true;
app.Workbooks.Add();
Worksheet sheet = app.Workbooks[1].Sheets[1];
Range range = sheet.get_Range("c1","e1");
range.Columns.Group();
One thing the macro recorder obscures is the need to use the Range.EntireColumn property. Here's some code that groups, expands and collapses. I got this by googling and fooling around, but I think it gets the concepts right. Hopefully it's easy to translate into C++:
Sub test()
Dim ws As Excel.Worksheet
Set ws = ActiveSheet
With ws
If .Columns.OutlineLevel > 1 Then
'clear any existing hidden grouped columns and grouping
.Outline.ShowLevels columnlevels:=.Columns.OutlineLevel
.Range("1:1").EntireColumn.Ungroup
End If
'group
.Range("A:C").EntireColumn.Group
'collapse
ws.Outline.ShowLevels columnlevels:=1
'expand
ws.Outline.ShowLevels columnlevels:=.Columns.OutlineLevel
End With
End Sub

How to create more than one group in List , SSRS 2005?

I am using a List in one of my reports. It has a detail grouping on a field, and controls like subreports. Now my requirements changed a bit and I need to have an outer group around the existing one, and a page break on the outer group.
How do i do this? I tried using the same list, but couldn't figure out how to create an inner and outer grouping. Do I have to use nested lists, where the outer list has does the outer grouping and the inner list does the inner grouping?
Your guess is correct.
You'll need to add another List control to the report. Drag the existing List control into the new control. Under the properties for the new List control go to "Edit details group" and add to needed column to the "Group on". Next, select either "Page break at start" or "Page break at end" to add the page breaks. The rest of the report design will determine which is most appropriate.
This answer assumes that the value for the outer group is already in the dataset for the existing list. If that assumption is incorrect, you'll need to add the column into the dataset.