SchemaAwareJsonDataProvider prints table row with null values

Hello,

We are using SchemaAwareJsonDataProvider in List&Label Cross Platform.

In some cases we don’t have any data for a table so we send an empty array in the data source. In this case the export fails with an error:

System.NullReferenceException: Object reference not set to an instance of an object.

Sending an empty object will make the export work:

{
    "Kosten": [
        {}
    ]
}

But this will print the string fields of the table as “(NULL)” values:

The same happens when sending an item with null values:


"Kosten" : [
    {
        "In_Nachkalkulation_beruecksichtigen" : null,
        "Dms_Rechnungsnummer" : null,
        "Betrag" : null,
        "Firma" : null,
        "Folgenummer" : null,
        "In_Verkaufskalkulation_beruecksichtigen" : null,
        "Filiale" : null
    }
]

If empty strings are sent for string fields:

"Kosten" : [
    {
        "In_Nachkalkulation_beruecksichtigen" : null,
        "Dms_Rechnungsnummer" : "",
        "Betrag" : null,
        "Firma" : "",
        "Folgenummer" : null,
        "In_Verkaufskalkulation_beruecksichtigen" : null,
        "Filiale" : ""
    }
]

Then no rows are shown which looks better:

I compared the result with the List&Label Classic version, and all in these cases it doesn’t show the table, which would be the expected result.

We thought that maybe Tables are still under development in Cross Platform and this might be the reason for this difference. Or do you think this is a bug instead?
It was tested with version: 31.1.0-stable.186

Unrelated to this, for the Cross Platform features in general, is there a roadmap available where we could check which features are already supported?

Thanks in advance,
Andras

The table object is supported in LLCP. The most compact list of what is supported and what is not can be found in the table here:

Part of the problem at hand is that LLCP doesn’t support the DelayTableHeader option yet, which means that the header of a table will be printed regardless of if there’s data in it or not. However, the NullReferenceException shouldn’t happen for an empty array. Would you mind sharing your JSON (both data and project file) and schema here? That would make the repo much easier. I’ll also check workarounds for the table header issue then.

1 Like

Thank you. I can share them. So far we used simple templates for testing purposes. On this one we have two tables which are showing different fields of Kosten.

print.zip (62.6 KB)

The export works with datasource.json.

With datasource-empty-arrays.json it will result in an error: “System.InvalidOperationException: Enumeration already finished.”

I said it wrongly earlier, the “System.NullReferenceException: Object reference not set to an instance of an object.” happens only with a completely empty datasource: “{}

Thanks very much. With your data, we were able to reproduce this issue. Please check the latest NuGet stable package by tomorrow morning. This should also fix the issue of tables appearing if empty then.

1 Like

The case with empty array works now, if we send

{
  "Kosten": [
  ]
}

then the export works and it won’t print the table header as expected. Thank you.

1 Like