Devexpress Total Sum Summary cell is blank and wont display summary - winforms

I have a Devexpress XtraGrid with a total summary cell in the footer.
The cell is displayed correctly, but there is no value in it.
I have:
Grid.OptionsView.ShowFooter = true and Grid.OptionsBehavior.AutoUpdateTotalSummary = true.
In the column where I want the total sum I have:
Col.SummaryItem.FieldName = col.FieldName and col.SummaryItem.SummaryType = Sum and col.SummaryItem.DIsplayFormat = ${0}
The summery cell never shows a value.
If right click on the summary cell and then select Sum the summary value shows up and works correctly. But I need to work without the user needing to right click on the cell and select Sum.
Any help would be appreciated. Thanks :)

The following code works fine to me, so I believe that there is something wrong in your source code:
using DevExpress.Data;
using DevExpress.XtraGrid;
//...
colUnitPrice.FieldName = "UnitPrice";
colUnitPrice.Name = "colUnitPrice";
colUnitPrice.Summary.AddRange(new GridSummaryItem[] {
new GridColumnSummaryItem(SummaryItemType.Sum, "UnitPrice", "${0}")});
Please, check your source code again (don't forget to review the Total Summary article) or provide us with more details on this issue.

Related

Get SUM from CATEGORY and by MONTH

So I'm trying to sort some data from a form in google sheets. I need to sort the data by category. and by the month.
So far I have been able to sort these individually but not in the same cell.
my code so far for my test form is below the image.
To Filter by a category, in F2:
=UNIQUE(B2:B25)
for cells G2 and below I used: =SUMIF(B$2:B$25,F2,C$2:C$25)
to get the TOTAL for entire categories I used: =SUMPRODUCT((MONTH(spending_response!D2:D100)=5)*(YEAR(spending_response!D2:D100)=2020)*(spending_response!C2:C100))
my problem is I can't put these two together. I tried adding the two codes in the same cell separate by a comma but it doesn't seem to work. please see the below image for what I am using this for and dismiss the test values.
Put this in G2 and drag downwards :
=SUMPRODUCT((spending_response!$B$2:$B$100=F2)*(MONTH(spending_response!$D$2:$D$100)=5)*(YEAR(spending_response!$D$2:$D$100)=2020)*(spending_response!$C$2:$C$100))
Idea : add another draggable 'checking' criteria to the sumproduct. /(^_^)
use:
=QUERY(A2:C, "select A,sum(B) where month(C)+1=5 group by A label sum(B)''", 0)

FieldType.Number is capping the edit value to 100, any value more than 100 is automatically changed to 100

I have been struggling with this issue for a while now. In popup edit of Shield UI all the values that are entered FieldType.Number seems to have a upper limit of 100. Every value more than 100 gets automatically changed to 100.
There seem to be only 4 types String, boolean, data & number. The number seems to limit the max to 100 on edit and add.Even any decimal values are being rounded off automatically and their website is not providing much help on the issue because demo grid views on website are showing similar behaviour
Fields("empNumber", fb => fb.Path("empNumber").Type(ShieldUI.AspNetCore.Mvc.DataSource.FieldType.Number))
I'm looking for a way to add values more than 100 as well as decimal point for prices. Any help or suggestions in this regard are much appreciated
I ran into the same issue. However I found the following workaround. I have set the grid fieldtype to string instead of number. When editing or creating the grid a javascript is started that calls the controller method through ajax call. In my controller method I take the "string" value and convert it to an int like so:
propertyOfModel = Convert.ToInt32(stringParameterFromGrid);
That works for me, let me know if you need more help.

SSRS Hide one legend from each series

I've been looking around at SO and Google but not really found anything that matches my current problem.
I'm making a stacked barchart based on two series. One series shows late, outstanding issues and one shows only outstanding (still within the due date).
The problem is that my legend shows four individual items, whereas I only want two (one for each series).
I've attempted by adding this in the Series Properties>Legend>Do not show this series in a legend formula (fx):
=IIF(Fields!ReadyForWork.Value = 1, False, True)
This basically checks to only display the legend if the value is 0. However this hides both the items in the legend, not just the one.
The relevant data I'm working with right now is:
TRK_Feature_LKID (basically each row's PK)
DateToBeActioned (important for maroon) - Used to determine if Date.Now() is higher to a set date when the issue should have been resolved.
ReadyForWork - A numeric value (0 / 1) to see if the item is ready for work.
AcountablePerson - The name of the responsible person (x-axis).
In below image I want to remove the red 'Late Issue' and the maroon 'True - ReadyForWork'.
So I managed to fix this by adding a separate field in the report's dataset that basically checked whether the DateToBeActioned was outside of GETDATE:
CASE
WHEN DATEDIFF(day, [DateToBeActioned], GETDATE()) >= 0 THEN 1
ELSE 0
END as 'Outstanding'
And by using that field in the legend as well as specifying that the dataset should only retrieve issues that had not been completed:
WHERE ReadyForWork = 0
I was able to set the legend to only show the two preferred items.
So for anyone who might face a similar issue; one way of fixing it might be to have a seperate field in your dataset that checks the case that checks for the parameters you don't want / you want to show in the legend.

DataGrid requests when shift multiselection with data virtualization

Adding up on a post of 4 months ago which unfortunately didn't receive any answer.
I'm basically standing before the same problem when using multiselection in a datagrid with shift.
When in somewhere in the middle of a huge list (say it's 1,000,000 items in the grid, all data virtualized) and I were to select from 500,000 to 500,050 using shift + mouse click, the grid calls the "GetEnumerator()" method of my virtual list (similar implementation to Vincent's and Paul's). What I did until now was just a SelectMany on the cached pages. But unfortunately resulted in the rows not being properly selected (while ctrl + mouse click does the job!).
So what I found is, that the DataGrid actually expects all items from index 0 to the last of the selection. This, obviously, isn't ideal for a list of 1m items as this would result in requests for each and every item from 0 till (in my example) 500,050 and thus loading everything form database.
So my questions would be the same as those of Daniel in th elinked posted above:
Why does the DataGrid request items multiple times (selected items are requested ~6-7 times in a row for no apparent reason)?
Is there a way to tell the DataGrid not to use the Enumerator and to just take the items selected and not iterate through from 0 on?
Thank you very much, hoping I have more luck in getting at least thought provoking answers, as there isn't much to be found concerning data virtualization.
I found a solution to this problem (at least I can say it works for me).
What I basically did was fooling the VirtualList as such that I do the following code:
for (int i = 0; i < Count; i++)
{
int pageIndex = i/PageSize;
int pageOffset = i%PageSize;
IList<TItem> page;
if (pages.TryGetValue(pageIndex, out page))
{
yield return page[pageOffset];
}
yield return default(TItem);
}
That way I will always get the items that are really in the list, but return nothing when it is part of the virtualization.
Of course this can result in some other problems, but this is so far the closest I got concerning this.

Selection of multiple values in ListBox

What I have is two indexes. I want to select both the indexes from a ListBox but when I use SelectedIndex = count (that's where the index is stored), only the last index is selected. I have also tried using selectedItems.add(count) but the result doesn't show up. Here's my code:
if (checkedvalues_forclass[j] == subjectid_forreverse[count])
{
listBox1.SelectedItems.Add(count);
//or
listBox1.SelectedIndex=count;
}
Can anyone help me with this?
The solution to your problem is the following:
listBox1.SelectionMode = SelectionMode.Extended;
listBox1.SelectedItems.Add(listBox1.Items[firstindex]);
listBox1.SelectedItems.Add(listBox1.Items[secondindex]);
These two links might help you:
http://marlongrech.wordpress.com/2009/06/02/sync-multi-select-listbox-with-viewmodel/
http://www.gbogea.com/2010/01/02/mvvm-multiselect-listbox

Resources