Page 2 of 2

Re: Register Business Object with nested objects as JToken

Posted: Fri Apr 02, 2021 1:32 pm
by Ruslan Kadyrbaev
Lech Kulikowski wrote: Sat Oct 17, 2020 5:35 pm Hello,

We work hard on this problem and do our best to do it as fast as possible. We will let you know when the solution is available.

Thank you.
#2871
Hi all,

Is there any update? It is really important

Re: Register Business Object with nested objects as JToken

Posted: Fri Apr 02, 2021 2:40 pm
by Lech Kulikowski
Hello,

We work hard on this problem and do our best to do it as fast as possible. We will let you know when the solution is available.

Thank you.

Re: Register Business Object with nested objects as JToken

Posted: Wed Mar 05, 2025 1:39 pm
by Antonin H.
Hello,
I would like to revive this old thread, because I am getting the exact error described above in very much the same situation.

On my backend, I have nested json data delivered as string that I need to insert as business objects.
I use the strategy originally described above to create nested business objects based on a JToken definition. Here is a snippet of how I prepare my report before compilation:

Code: Select all

        public void LoadDataIntoReport(StiReport report, string jsonStringData, string businessObjectName)
        {
            var dataToken = Stimulsoft.Base.Json.Linq.JToken.FromObject(jsonStringData);
            report.RegBusinessObject(businessObjectName, dataToken.ToList()); // Without the "toList()" call the generation behaves inconsistenly and warns of ambiguous businessobject columns
            report.Dictionary.SynchronizeBusinessObjects(2); // This line throws an unhandled exception
        }
The error I am currently getting is this (same as in previous posts on this thread):

Code: Select all

System.NullReferenceException: Object reference not set to an instance of an object.
         at Stimulsoft.Report.Dictionary.StiBusinessObjectHelper.GetColumnsFromITypedList(ITypedList typedList)
         at Stimulsoft.Report.Dictionary.StiBusinessObjectHelper.GetColumnsFromObject(Object value)
         at Stimulsoft.Report.Dictionary.StiBusinessObjectHelper.GetColumnsFromData(Object data, Boolean includeChildDataSources)
         at Stimulsoft.Report.Dictionary.StiBusinessObjectHelper.GetColumnsFromData(Object data)
         at Stimulsoft.Report.Dictionary.StiDictionary.SynchronizeColumns(Object data, StiBusinessObject source)
         at Stimulsoft.Report.Dictionary.StiDictionary.SynchronizeColumns(StiBusinessObjectData data, StiBusinessObject source)
         at Stimulsoft.Report.Dictionary.StiDictionary.SynchronizeBusinessObjects()
         at Stimulsoft.Report.Dictionary.StiDictionary.SynchronizeBusinessObjects(Int32 maxLevel)
On flat data (or data on the top level of the nested json) this code works fine, but without the call to synchronize business objects, nested data is of course not included.

Upon closer inspection (and a peek into the call stack via Visual Studio), I can see where in Stimulsoft the exception occured:


Image


Is there a known way to get around this or an upcoming bugfix?

Thank you in advance for more information on the topic and have a nice day.

Re: Register Business Object with nested objects as JToken

Posted: Fri Mar 07, 2025 5:30 pm
by Lech Kulikowski
Hello,

Please send us your request with a detailed description on support@stimulsoft.com.

Thank you.