Solved

OData null values


Badge +1

I've created a API-routine to collect article-items. The purpose is to use these items to refresh webshop-information by a third party. The following problem occurs: when a description of an article is emptied in the ERP OData seems to skip the field in the output because it is NULL. The third party will not recieve any data so the description in the webshop stays filled. Is there a way to force NULL-fields to be in the API-output without using spaces oslt in empty fields where the third party has to coop with.

icon

Best answer by Hugo Nienhuis 25 March 2021, 12:14

Hi all,

I found the error in the log files:

 

2021-03-25T12:07:48.6943227+01:00 0HM7FCTUHH9L1:00000001 [err] TSFMessagesMiddleware: An unhandled exception occurred while processing the request. (fffadd8a)
Microsoft.OData.ODataException: The property 'biologisch[Nullable=False]' of type 'Edm.Boolean' has a null value, which is not allowed.

 

I have successfully retrieved a record including null- values after entering a valid value in property 'biologisch’.

 

Thanks for all the help :thumbsup:

 

View original

10 replies

Userlevel 6
Badge +18

Hi Peter,

It is possible to send NULL values by sending the following Header:

Accept: application/json; include_null_values=true

 

Badge +1

Hey Mark,

Thanks for the response but I don’t know how to translate your answer into action...

Maybe some screenshots makes it eayser for you to help me. This is the case:

When I empty the field “Opmerking” in the ERP the following result is shown in Insomnia:

The view ws_artikel from the ERP is formed by:

 select a.artikel_id
          ,a.opmerking                             
          ,ISNULL(a.status_art,0)
          ,a.produ_naam                         
          ,case when a.blokkering_igv_breuk_aantal=1 then 1 else 0 end
          ,a.magazijn
    from [cf_finas].[dbo].[artikel] a
    where a.magazijn='100'

Where do I have to activate your given solution to force the NULL-value in Opmerking to be exported ??

Userlevel 6
Badge +18

Hey Peter,

The correct way of adding this header can be done in the Header tab and doing the following:

Insomnia example

On the left

Accept

And on the right

application/json; include_null_values=true
Badge +1

Goodmorning Mark,

I add your suggestion to my Insomnia-request but it returned an error:

When i de-activate the header with the check mark, the response is OK again.
Any suggestion ?

 

Userlevel 5
Badge +2

Hello Peter,

You are running into this problem because you’re using a very old version of Indicium.

We recommend to regularly update Indicium to the newest version in order to ensure continued support, having the latest stability and security fixes, performance improvements and new features, such as the one you are trying to use right now.

I would recommend using Indicium Universal for interfacing the web shop with the Thinkwise Platform. However, if you are using a Mobile GUI or a Windows GUI with RDBMS=indicium, then you will need Indicium legacy as well.

Badge +1

Hi Vincent,

Which (IU-)version is the earliest version in where this function is available or (better) which IU-)version do you recommend ? There is a lot of choice… :wink:

Userlevel 5
Badge +2

Hello Peter,

I always recommend using the latest version of Indicium Universal, which is currently version 2021.1.17. Version 2021.1.17 does have two important changes, most notably the new .NET 5 requirement, which are described in detail in our release notes.

I could understand not wanting to update to .NET 5 right away, in which case I would recommend version 2021.1.16 of Indicium Universal instead.

Userlevel 3
Badge +7

Hi Vincent,

 

We have upgraded to 2021.1.16 but the request with this specificheader still returns a 500 error.

Userlevel 5
Badge +2

Hello Hugo,

Could you check Indicium logs to see what the error message is and share it here?

I don’t see anything wrong with how the header was added to Insomnia, but the screenshot below shows an example of how it should look. Perhaps an invisible character is making your value invalid. It could be worthwhile to make a new Insomnia request and carefully type the Accept header without copy-pasting anything. But we can start by looking at Indicium’s error log.

 

Userlevel 3
Badge +7

Hi all,

I found the error in the log files:

 

2021-03-25T12:07:48.6943227+01:00 0HM7FCTUHH9L1:00000001 [ERR] TSFMessagesMiddleware: An unhandled exception occurred while processing the request. (fffadd8a)
Microsoft.OData.ODataException: The property 'biologisch[Nullable=False]' of type 'Edm.Boolean' has a null value, which is not allowed.

 

I have successfully retrieved a record including null- values after entering a valid value in property 'biologisch’.

 

Thanks for all the help :thumbsup:

 

Reply