Winforms UltraGrid Infragistics grouping by two columns - vb.net

I’m working on a WinForms vb.net app where you can see a Grid like the one shown in the picture attached and what I need to do is to group by the first two columns (“Grupo” and “Area”).
As you can see in the picture my SQL select statement returns many same “Grupo” and “Area” with different “identificacion” (the last visible column) and the way I would need to present it is more or less the same you can currently see in the picture but with something like for example a + sign at a side which when you press it expands and shows all the complete list of rows and columns (ungrouped) but one row for every different “identificacion”.
I’ve managed to do an approach with SortedColums with the next:
ulgListaSel.DisplayLayout.ViewStyleBand = Infragistics.Win.UltraWinGrid.ViewStyleBand.OutlookGroupBy
Dim band As UltraGridBand = ulgListaSel.DisplayLayout.Bands(0)
Dim sortedColumns As SortedColumnsCollection = band.SortedColumns
sortedColumns.Add("c_area", False, True)
sortedColumns.Add("c_grupo", False, True)
but data is not being displayed the way I’m looking for.
What I get with the code below is shown in figure 2 but you will see that only "Area" colum is shown before expanding and as a default I need all columns with same value to be shown (everythings except "identificacion").
By the way, I’m using UltraGrid v14.2
Thanks in advance.

If I follow you here correctly, you would like to have a group for each row, because the only differences are in the "identificacion" column values? Or you would like to see all the values in the groupByRow, except the "identification", and having only one group?
In the second case you would end up with only one group having the all of the column values there.
In both cases you could create and add a new unbound column in the InitializeLayout event of your UltraGrid, using the root band (0) columns collection, afterwards in the IntializeRow event populate the values of that new column based on your requirements, either using the values of all of the cells (to end up with the same number of groups as the number of differences in the "identificacion" column), or concatenating the values of all of the columns, without the ones in "identificacion", which would end up with a single group only at end.
Also once you do that, you would have to use again the InitializeLayout event of your UltraGrid, and Group by the UltraGrid, by the newly populated Unbound column, by adding it to Sorted Columns, using the same approach that was used for adding the other columns there.

Related

How to create multiple connected search combo boxes to filter a form?

I have a form with 10 columns, and for 5 of them (Project_Phase, Contract, Design_DPM, AMM/UCC, 1_or_2 stat) I want to add connected drop list combo boxes to filter the records and display data as selected in the combo boxes.
I know how to make multiple drop list combo boxes that filter the whole form based on the selection of one value from one column. For example, "Contract" combo box has options: signed, not signed. If I select "signed" it will display all the records that have "signed". and If I filter another column it will cancel the previous filter and display records relevant only to that selection from that column.
But what I want is the ability to filter using any number of filtering options from the 5 columns I mentioned. For example, if I want to see the records that are ("signed" under "Contract") and in ("proposal" under "Project_Phase") and ("a certain DPM" under "Design_DPM"). And after filtering I want to be able to clear the filters and see all the records again, as I am using this form to display all my records for users. I do not want it to be cascaded, as I might want to filter using only one column or more or all. And I do not want it to be a query or use the basic filtering in datasheet view.
Sorry for the lengthy explanation, if something is not clear I will explain further. Thank you for your efforts.
Here is one way to implement a form filter using multiple comboboxes.
Create a table named 'tblWildcard'; one field named 'Wildcard', save the table.
Enter one record with an asterisk as the value
Create the queries for your comboboxes like:
SELECT DISTINCT Table1.flda
FROM Table1
ORDER BY Table1.flda
UNION Select wildcard from tblwildcard
Save a query like the following SQL to be the Row Source for your form (i.e. qryFormA):
SELECT Table1.Flda, Table1.Fldb, Table1.Fldb
FROM Table1
WHERE (((Table1.Flda) Like [Forms]![frmForm1]![cboFlda])
AND ((Table1.Fldb) Like [Forms]![frmForm1]![cboFldb])
AND ((Table1.Fldc) Like [Forms]![frmForm1]![cboFldc]))
In the After Update event for each combobox add the following code:
Me.Recordsource = "qryFormA"
Sometimes the 'Me.Rowsource.' may not work when changes are made (weird issue!). If so, do the following:
Application.Echo False
Me.RecordSource = vbNullString
Me.RecordSource = "rowVwFilter25"
Application.Echo True
Finally, if a multi-user environment, and people may be adding records that will need to be included in your comboboxes, use the combobox Before Update event and add the following code:
Me.cboFldA.Requery
My question is answered. I found exactly what I wanted here link
Thanks for the help everyone

Breaking the SSRS report depending on the Multi Value Parameter

I am working on a SSRS report with a Multi Value Parameter which contains list of names. I have written an expression for the title that works like "Result for SELECTED NAME". It also have an option of (Select All) which displays all the results with title as "Result for MULTIPLE NAME". It is working fine up to this part.
Now I have to modify the report like, If i select multiple values, the report should break into pages with each selected name on different page with title for that individual parameter value(name) as "Result for SELECTED NAME".
Please help me. Thank you.
You can place the entirety of your current report (excluding headers/footers) into a List object. I assume youa re returning the selected values from the parameter (like Manager Name) as part of your DataSet. Assuming this is the case
Create a new list
Insert the contents of your report into the rectangle of this List
Right click the List Row Header and Select Row Group -> Group Properties
Set the Group to Group on
=Fields!ManagerName.Value
This approach will take a simple table like this
And break it into a list like this
Then you can just set the Tablix Properties of the List to Add a Page Break After to checked
Hopefully this is helpful. If you have further questions on this then please let me know
I worked on it and found a way to make it happen. I first created the row group for Names. Then applied the page break for each instance option. Then deleted that group column (Only deleted column but not group). Then added that group in a static column on the top, and wrote an expressions to show that group itself as a title using concatenation.
But here I faced another problem, when there is no data for the selected name, the title row isn't displayed in the preview as it also a column in the table.

OpenRefine - Fill between cells but not at the end of the list

I have a list of stock prices for several stocks. Some of the values are missing due to weekends, holidays and probably other reasons.
The gaps are not consistent. Some are two days and some are more than that.
I want to fill the gaps with the last known value but not at the end of the list.
I have tried in Excel to test a few cells below and if it's now empty, do the fill. The problem is that due to the inconsistency of the gaps, it's a tedious task to change the function for all the cases.
Is there a way to test for the end of a list?
UPDATE - added a screenshot.
See this screenshot. I want to fill where the blue dots are. The red dots are at the end of the list and I don't want to fill those cells.
I am looking for a way to detect the end of the list and stop the filling when the end is detected.
I think this is pretty difficult in OpenRefine and probably a different tool would work better. The main issue is that OpenRefine does not offer the ability to easily work across rows so 'summing a column' (or part of a column) is tricky - this is mentioned in https://github.com/OpenRefine/OpenRefine/issues/200
However, you can do this by forcing OpenRefine in Record mode with the whole project containing a single record. Once you've done this you can access all values in a column using syntax like:
row.record.cells["Column name"].value
This gives an array of all the non-blank values in the column. Since this ignores blank values, in order to have a true view of the values in the column you have to fill in blank cells with a value.
So I think you could probably achieve what you want as follows:
For each column you are going to work with do a cell transform to put a dummy value in empty cells - e.g. if(isBlank(value),"null",value)
Create a new column at the start of your project and put a single value in the very first cell in that column
Switch to Record mode
At this point you should have a single 'Record' in your project - e.g.
You can now access all cells in a column using syntax like row.record.cells["Column 1"].value. You can combine this with 'forRange' to iterate through the contents of this array, using the row.index as the marker for the current row.
I used the following formula to add a new column to the project:
with(row.record.cells["Column 1"].value,w,if(forRange(row.index,w.length(),1,i,w[i].toNumber()).sum()>0,"a","b"))
Then...
Change back to 'Row' mode
Remove the 'null' placeholder from the original column
Create a facet on the 'fill filter' column
In my case I filter to 'a'
Use the 'fill down' option
Remove the filter
And remove the 'record' column
Rather a long winded way of doing it to say the least, but so far I've not been able to find anything better while not going outside OpenRefine. I'm guessing you could probably compress steps 5-11 into a single step or smaller number of steps.
If you want to access the array of cell values using Jython as suggested by iMitwe you need to use:
row["record"]["cells"]["Column 1"]["value"]
instead of
row.record.cells["Column 1"].value
(step 5)
I am doing this on the top of my head, but I think your best chance my be using the fill down option in record mode:
first move your column to the first column and switch to record mode.
then use the following GREL: row.record.cells["data"].value[-1] where data is the name of your column
The [-1] will take the last value and fill the blank. For the case with the red dot, since there is no value it should remains empty. Let us know how it goes.
Unless there's something I am missing or not seeing...
I would have just sorted reverse (date ascending) on the Date column, then individually use Fill Down on each column, except for that last column where you could then use a Date facet on your column Date to specify the exact Date range you wanted to work with, then fill down on that last column, then remove the Date range facet.

Filtering columns presented as comboboxes in a split form

I have a split form based on a table (tblMain). The form shows many columns some of which are textboxes and others are comboboxes. I can easily sort and filter every column in a datasheet part of the form except of two columns.
These two columns are comboboxes which have the same control source and same row source table however with the following difference:
cboPUNUM:
control source tblMain.[PU_ID];
row source SELECT tblPU.[PU_ID], tblPU.PUNUM FROM tblPU;
cboPUTYPE:
control source tblMain.[PU_ID];
row source SELECT tblPU.[PU_ID], tblPU.PUTYPE FROM tblPU;
Table tblPU has the following structure:
PU_ID PUNUM PUTYPE
1 11234 SMC
2 21234 DPL
3 11234 NEC
4 21123 SMC
and so on...
The idea is to have two separate columns for PUNUM and PUTYPE in the split form and be able to filter them.
Both columns in the split form show all available values in checkboxes for filtering in the drop-down list on top of columns until the filter is applied:
The problem is that I can filter only one of these columns (see the picture below). For example if I select 84174 in the PUNUM field then I lose an ability to filter PUTYPE field. Ideally PUTYPE should give me an option to check FHP or ADH but checkboxes don't appear in a drop-down list.
And vise versa, if I start from filtering the PUTYPE, i.e. I select FHP and expect the PUNUM to have many options but it doesn't show checkboxes for filtering (see below).
Please advise what I can do with this as I have no ideas...?
P.S. DLookup function instead of comboboxes doesn't allow to filter columns at all.
I know that I can base the form on a query and save DLookup expressions in that query, but it significantly slows down the performance.
Ok, Looks like I was over thinking the issue...
I just changed the query for the split form and included tblPU with those two fields. And then converted form controls to text boxes and sourced them to that fields directly. Works as I wanted.

Automatic Chart Pagination with Report Parameters

Based on several report parameters in SQL Server 2005 reporting services, I would like to automatically generate one or several chart(s) for each row in the return result and paginate or space them out. How do I go about that?
If the number of charts will vary for each row, but the variations are known (e.g. it's either just chart 1, or chart 1 and 3, or charts 1 2 and 3) then it's simple enough using a table.
In the default detail row add any normal fields you need. Now insert a new detail row for each chart you might need. Lastly set the visibility of each chart row based on your rules, noting that the rule will hide the row if your expression evaluates to true. Make sure you select the row using the area to the left of the left-most cell, if you got it right you'll see that it's a row in the properties grid.
To get the layout you want you can merge cells for the charts to go in, or use a single cell and put a Rectangle in it, then in the Rectangle lay out your other controls.
Any rows that are hidden will be collapsed, so you wont get big empty sections like you can if you simply toggle the visibility of the charts themselves.
What you can do is place a List control on the page, set List grouping by record unique key (ID, or several fields if composite), and place a charts on the List. Next, set items visibility expressions to control it with report parameters.