Relations no longer being automatically generated after upgrading

Stimulsoft Reports.NET discussion
Post Reply
bastiaanvdb
Posts: 1
Joined: Tue Apr 02, 2024 8:06 am

Relations no longer being automatically generated after upgrading

Post by bastiaanvdb »

After upgrading from 2018.2.2 to 2024.1.3 problems started to arise related to automatically generated relations.
Capture.PNG
Capture.PNG (331.26 KiB) Viewed 573 times
As you can see here, on 2018.2.2 after opening a report with Designer.WinForms.exe (or with our .NET implementation) and looking at the data sources, there are automatically generated relations between a node (e.g. FactuurView --> PakbonnenView --> FactuurRegelsView) and its children (e.g. FactuurView --> PakbonnenView --> FactuurRegelsView --> VerkooporderRegel & PakbonnenView). As another example, the relation "FactuurView_PakbonnenView_FactuurRegelsView_VerkoopOrder.Artikel" points to "FactuurView_PakbonnenView_FactuurRegelsView_VerkoopOrder_Artikel".

However on 2024.1.3, which is performing well in the Designer.exe, something goes wrong in our .NET implementation.

Code: Select all

public static DataSetResultInfo CreateAndFillDataSet(IProcessInstance processInstance, DataSetInfo requestedData)
{
    var usedPaths = GetUsedDataRows(requestedData);
    
    var columnMappingCurrentDataSet = new Dictionary<IExpression, TableColumnInfo>();
    var rootInstance = processInstance[requestedData.Root];

    var tmpPrimaryKeys = new Dictionary<object, int>();
    
    var entityCollectionRoot = requestedData.Root as IManagedDynamicCollection;
    if (entityCollectionRoot != null)
    {
        var tableInfos = CreateAndFillDataSetForCollectionRoot(requestedData, usedPaths, entityCollectionRoot, processInstance, columnMappingCurrentDataSet, tmpPrimaryKeys);
        return new DataSetResultInfo(columnMappingCurrentDataSet, tableInfos);
    }

    var entityRoot = requestedData.Root as IEntity;
    if (entityRoot != null)
    {
        var tableInfos = CreateAndFillDataSetForEntityRoot(requestedData, usedPaths, entityRoot, (IEntityInstance)rootInstance, columnMappingCurrentDataSet, tmpPrimaryKeys);
        return new DataSetResultInfo(columnMappingCurrentDataSet, tableInfos);
    }
    
    var summaryRoot = requestedData.Root as ISummary;
    if (summaryRoot != null)
    {
        var tableInfos = CreateAndFillDataSetForSummaryRoot(requestedData, usedPaths, summaryRoot, (ISummaryInstance)rootInstance, columnMappingCurrentDataSet, tmpPrimaryKeys);
        return new DataSetResultInfo(columnMappingCurrentDataSet, tableInfos);
    }

    throw new NotImplementedException();
}
Building the report:

Code: Select all

var dataSets = definition.DataSets
    .Select(reportDataSet => DataSetBuilder.CreateAndFillDataSet(processInstance, new DataSetInfo(reportDataSet.Root, reportDataSet.Fields, definition.CustomTableNames, translator)))
    .ToDictionary(map => map.DataTablesMetaInfo.First().Table.DataSet);

dataSets.Keys.ForEach(report.RegData);

... validation ...

foreach (var dataSetColumnMappingsPair in dataSets)
{
    foreach (var expressionColumnInfoPair in dataSetColumnMappingsPair.Value.ColumnMappingMetaInfo)
    {
        IExpression<IText> description = null;
        if (expressionColumnInfoPair.Key is IReadOnlyProperty) // expression is almost always a property (with a description), 
            description = ((IReadOnlyProperty)expressionColumnInfoPair.Key).Description;
        else if (expressionColumnInfoPair.Key is IEvaluableMethodCall) // but can also be a method call
            description = ((IEvaluableMethodCall)expressionColumnInfoPair.Key).WorkDescription;

        if (description == null)
            description = expressionColumnInfoPair.Value.Column.ColumnName.AsText(); // just incase (methods for example do not require a description)

        RegisterVariable(report,
            dataSetColumnMappingsPair.Key.DataSetName + ".Headers",
            expressionColumnInfoPair.Value.TableInfo.Table.TableName + "." + expressionColumnInfoPair.Value.Column.ColumnName,
            description,
            uniqueVariableNames, 
            isCompiledReport, 
            validateData, translator, processInstance);
    }
}

... register other variables ...

report.Dictionary.RegRelations();
report.Dictionary.Synchronize();
The relations which were shown in the first screenshot are no longer being generated. Has something changed related to this from 2018 to 2024?
Lech Kulikowski
Posts: 6247
Joined: Tue Mar 20, 2018 5:34 am

Re: Relations no longer being automatically generated after upgrading

Post by Lech Kulikowski »

Hello,

Please try to check teh last release build.

Thank you.
Post Reply