I'm using GridGroupingControl to show kind of statistic.
I have two kind of summary:
- by number of contracts (row count)
- by value of contracts (sum of column value)
Sorting on summary on one of that summary working, I'm usinng SetGroupSummarySortOrder
It is possible sorting by combination of this summaries ?
e.g if number of rows is the same I would have sort by value.
Hi Krzysztof Adamowicz,
We are checking the possibilities to achieve your requirement. We will check and update you with more details on February 14, 2022.
Regards,
Sampath Narayanan.S
Hi Krzysztof Adamowicz,
We are checking the possibilities to achieve your requirement. We will check and update you with more details on February 17, 2022.
Regards,
Sampath Narayanan.S
|
gsd.GroupSortOrderComparer = new CustomComparer(summaryColumn2.GetSummaryDescriptorName(), "Count");
CustomComparer.summaryDescriptorName1 = summaryColumn1.GetSummaryDescriptorName();
CustomComparer.propertyName1 = "Average";
public class CustomComparer : IGroupSortOrderComparer
{
string summaryDescriptorName;
string propertyName;
public static string summaryDescriptorName1;
public static string propertyName1;
public CustomComparer(string summaryDescriptorName, string propertyName)
{
this.summaryDescriptorName = summaryDescriptorName;
this.propertyName = propertyName;
}
public int Compare(object x, object y)
{
Group gx = (Group)x;
Group gy = (Group)y;
bool strongTyped = false;
if (strongTyped)
{
// strong typed (propertyName is ignored ...)
DoubleAggregateSummary dasx = (DoubleAggregateSummary)gx.GetSummary(summaryDescriptorName);
DoubleAggregateSummary dasy = (DoubleAggregateSummary)gy.GetSummary(summaryDescriptorName);
int v = dasx.Average.CompareTo(dasy.Average);
return v;
}
else
{
// using reflection (slower but more flexible using propertyName)
object vx = gx.GetSummaryProperty(summaryDescriptorName, propertyName);
object vy = gy.GetSummaryProperty(summaryDescriptorName, propertyName);
if(int.Parse(vx.ToString()) == int.Parse(vy.ToString()))
{
object vx1 = gx.GetSummaryProperty(summaryDescriptorName1, propertyName1);
object vy2 = gy.GetSummaryProperty(summaryDescriptorName1, propertyName1);
return ((IComparable)vx1).CompareTo(vy2);
}
return ((IComparable)vx).CompareTo(vy);
}
}
public string[] GetDependantFields(TableDescriptor td)
{
SummaryDescriptor sd = td.Summaries[summaryDescriptorName];
if (sd == null)
{
return new string[0];
}
return new string[] { sd.MappingName };
}
#endregion
} |
Not working for me :-(
I have SummaryRows which names "Suma".
It has SummaryColumns which names "WizytaSum", this is sum of value Wizyta in table.
I set CaptionText in ChildGroupOption as that:
{Category} - Wizyty: {Suma.WizytySum}
It is working, I have caption for example: UTECO - Wizyty: 3
Now I will have add sorting on this value.
I have own "comparer"
public class VisitGroupComparer : IGroupSortOrderComparer
This method workin because I tested it using records count (gxRecordCount = gx.GetRecordCount())
Bu when I use
object vx = gx.GetSummaryProperty("Suma", "WizytySum");
It is not working because value vs is null.
Hi Krzyztof Adamowicz,
We are currently analyzing the reported scenario, we need some time to complete the validation and will provide an update on or before February 23, 2024.
Regards,
Chidanand M.
Hi Krzyztof Adamowicz,
We regret the inconvenience.
We are still analyzing the reported scenario, we need some time to analyze this reported scenario on our source level and will provide an update on or before February 28, 2024.
We appreciate the patience until then.
Regards,
Chidanand M.
Hi Krzyztof Adamowicz,
We have analyzed the reported scenario on our end, we suspect that reported scenario is occurs due to the propertyName. If the propertyName is not property provided then the vx will be null. Could you please review the provided sample and if possible, can you please replicate the reported scenario in the provided sample and revert us back.
Providing these details will help us better understand the issue and work towards finding a solution promptly.
Regards,
Chidanand M.
Working!
It was bad argument.
When I change
object vx = gx.GetSummaryProperty("Suma", "WizytySum");
to
object vx = gx.GetSummaryProperty("SumaWizytySum
", "Sum");
then it is OK
Thanx
Krzysztof
Hi Krzysztof Adamowicz,
Glad that your issue is resolved!! Please let us know if you require any additional assistance. We are happy to help you.
Regards,
Chidanand M.