Hello,
I tried to find a solution reading the other posts in forum and google, however i am not sure that i have the correct solution in mind.
I am using UltraGrid, but in order to display numeric information with customized behavior based on the system configuration, i have constructed a text wrapper which is attached to a column Editor. Maybe editor is not the best option for the business that i need to cover, but it is an old application with fresh UI.
Textbox (and grid as a consequence), receives a metric numeric value and based on configuration decides if this will be translated to Imperial, with how many digits etc. The issue with digits can be easily handled using the SummarySettings.DisplayFormat, but the problem arises when the value is transformed to Imperial.
Grid summaries doesn't know anything about the transformation, returning all Summaries in Metric.
What i really need is to take the already calculated summary value, translate it to Imperial and give it back to system. However, in OnSummaryValueChanged, summary values are readonly.
An alternative can be to use External Summaries(https://ko.infragistics.com/samples/windows-forms/grid/external-summaries), but in this case i have to calculate the values on my own, right?
What do you suggests?
Thank you in advance for your help.
As you have custom logic to convert the metric numeric values to imperial and as the Grid is not aware of this translation, your assumption is correct. You need to use the ExternalSummaries to implement the custom summary logic that translates the Grid summaries to imperial.
Please let me know if I may be of further assistance.
Sincerely,Sahaja KokkalagaddaAssociate Software Developer
That's great. I applied your suggestion and the summaries are calculated as expected.
Next, i tried to export to excel, but in this case, i lost again the value - since Grid exports the known to him values - not the formatted.
Do we have any way to override these values too?
I tried using SummaryCellExporting event, but in this case the Summary.value is locked too.
Please elaborate on how you are calculating the ExternalGridSummaries. Once the ExternalSummaries are added to the Grid when exported the calculated values will be exported to excel. You can observe this behavior in the attached sample. If the ExternalGridSummaries are not being exported then please reproduce this behavior in the attached sample and post it here.
I will further look into this issue as soon as I hear back from you.
indeed your code works well. The only difference with my case (sorry not being precise from the beginning) is that i don't create the summary programmatically, but I let user ask for it (and probably other aggregate options - min, max average). I am using this line of code to activate the options in Grid Columns:
ultraGrid1.DisplayLayout.Override.AllowRowSummaries = AllowRowSummaries.BasedOnDataType;
In the attached code i have commented your code in Form1_Load and I have added mine. If you try to export the excel you will replicate the behavior i am facing.
In the meantime, i have found a workaround - or a proper fix (please confirm), using the event ultraGridExcelExporter::SummaryRowExporting. In this event i recalculate the summary values. I just need to say again that we use External Summary Calculator.
e.Summaries[0].SummarySettings.Band.Override.UseExternalSummaryCalculator = DefaultableBoolean.True;
Do you think that this is a proper implementation from my side, or i should have used different way to export values?
Thank you in advance.
Hello Greycon,
I have investigated External summaries are not exported to Excel when using External Summary Calculator issue, and I have asked our engineering staff to examine this further. To ensure that it will receive attention, I have logged this behavior in our internal tracking system with a Development ID of 244227. This will be assigned to a developer in a future sprint to review my investigation and confirm my findings or to offer a fix, or other resolution.
I have created private case (CAS-187732-M4D1N7) to follow up on this issue. I will leave this case open and update you with any new information after the review. You can also continue to send updates to this case at any time.
You can view the status of the development issue connected to this case by selecting the "Development Issues" tab when viewing this case on the web site.
The resolution that you found, which is using the SummaryRowExporting event for recalculating the summary values is the best workaround for this issue.
Please let me know if you need more information.