Hello Support Team,
Here I met a performance problem while using formula in ultragrid. I have around 50,000 data entries (each entry with more than 200 fields) populated in an grid it takes around 20 min including query, download, populating data to grid. in the testing I noticed around 60% of the time was in the formula assignment clause.
the grid data populating business is:
1. fill data in grid
2. set formula (column.Formula = translatedFormula;)
3. set format
can you please help to see if there is any solution to improve the populating data performance? thank you in advance.
Hi,
There's not a lot of information here to go on. How are you determining the time it takes the formulas to calculate? formulas in the grid are calculated asynchronously, so unless you explicitly changed them to work in synchronous or manual mode, they will never lock up the UI and you will not be able to tell when they are done.
Hi Mike,
Thank you for your quick reply.
I tested twice with the single set formula clause commented and uncommented, the time difference is more than half of the total time, thta was how I get the figure. I tried to find the property of formula synchronous/manual, but didn't find it. I can see there are a few properties in MISC->CalcSettings on FormulaManager, but no this setting. can you please tell how to set this formula behavior?
for some reason I cannot upload too much of the source code. the method below is how I set formula and this method gets invoked after all data is populated.
protected override void FinalizeGridLayout(DataTable table)
{
foreach (UltraGridColumn column in Band.Columns)
ColumnTemplateInformation colInfo = (column.Tag as ColumnTemplateInformation);
WorksheetField field = colInfo.Field;
if (field != null)
{// Set up the formulas
if (!string.IsNullOrEmpty(field.Formula))
try
string translatedFormula = TranslateFormula(field.Formula);
column.Formula = translatedFormula;
}catch (Exception ex)
Logger.Write(ex);
column.Formula =null;
}
// set up the formats
if (!string.IsNullOrEmpty(field.Format))
string translatedFormat = TranslateFormat(field.Format);
if (!string.IsNullOrEmpty(translatedFormat))
column.Format = translatedFormat;
catch (Exception ex)
column.Format = null;
// Prepare the drop-down data
if (field.ValueListQuery != null)
column.ValueList = vlManager.GetValueList(column.DataType);
Thanks,
Russell