If null condition in word aspose LINQ

I have the following code:

<<if [listInfoPojo != null]>>
<<foreach [infoP in listInfoPojo]>> 
             Firma Disclaimer <<[infoP.numberOf()]>>	<<[infoP.numberOf()]>> 
<</if>   !! end tags here !!!

image.png (3.9 KB)

When the list is not empty works perfectly. When listInfoPojo is null, it gives this error:
Can not get the value of member ‘info’ on type ‘class com.aspose.words.net.System.Data.DataRow’.

I have also tried infoP?.info and it doesn’t work either. If I delete <<[infoP.info]>> from the template, it works.
Also, is there any method for checking is the list or array is empty?

Thanks in advance.


It seems like you use either JsonDataSource or XmlDataSource. In this case, if an XML or JSON node/property representing a complex object is null, there is no information on members of the object. By default, the engine throws an exception when it encounters a missing member. However, for scenarios like yours, the ReportBuildOptions.ALLOW_MISSING_MEMBERS option can be applied as follows.

ReportingEngine engine = new ReportingEngine();

Please check Accessing Missing Members of Data Objects for more information.

Thanks for your response Ivan,
Unfortunately, I have already used engine.setOptions(ReportBuildOptions.ALLOW_MISSING_MEMBERS); and it doen’t work for my case.


Thanks for the information. Could you please share your sample code, data, and template then, so we could reproduce the issue at our end and properly address your issue?