How to resolve "The types 'Edm.Boolean' and 'Edm.Int32' are not compatible." error while working with the Odata adapter in TIBCO Data Virtualization?

book

Article ID: KB0072124

calendar_today

Updated On:

Products Versions
TIBCO Data Virtualization All supported versions

Description

Below are the steps mentioned which will result in such issues:

- orders table has been used in this example which is found under /the examples folder. The table has been published under the databases with the name 'OdataTest' and schema name 'examples'.
- Copied the Odata V4 URL for the published resource and used it as a URL for the Odata datasource connectivity.
- Created the Odata datasource with the below credentials:
---------------
URL: http://<host_machine>/odata4/databases/OdataTest/examples
user: admin
Auth Scheme: Basic
---------------
- The below query runs into an error when executed from the scratchpad or as a view:
--------------
QUERY: SELECT * FROM /shared/Test/Odata/"odata-inhouse"/CIS/OData/orders WHERE employeeid = 20
ERROR: Cause: [9901015] The types 'Edm.Boolean' and 'Edm.Int32' are not compatible.
--------------

Environment

All supported environment

Resolution

The error message is due to the "+" character which is being added to the filter parameter, in the GET request the adapter is firing to the server. Essentially, whenever one is executing the query "Select * from /shared/ODataTest/CIS/OData/orders where employeeid=20", the connector is issuing the following GET request to the server (please note the "+" characters in the filter parameter):
================
http://localhost:9400/odata4/databases/Test/examples/orders?$filter=employeeid +eq +20
================

The workaround, in this case, would be to either replace the "+" characters with whitespace (filter=employeeid eq 20) and then issue the request or replace the "+" characters with "%20" (filter=employeeid%20eq%2020), then subsequently issue the GET request.

One can configure the adapter to modify the GET request using a connection property called " UseDotNETSpaceEscape", which will help in performing the latter as mentioned above, i.e, replace the "+" characters with "%20", wherein the user will have to set this property to true via the "Other" property such as "Other=UseDotNETSpaceEscape=true" in addition to the other connection properties. This will help the connector in explicitly escaping "+" characters with "%20" in the filter parameter.

Follow the below steps to resolve the issue.

1. Right-click on the Odata data source and go to the Configuration tab.
2. Under the Connection, look for the parameter " Other". 
3. Add the following property here " UseDotNETSpaceEscape=true" (as shown below)

User-added image

4. Run the query again in the scratchpad to see the results.
----------
SELECT * FROM /shared/Test/Odata/"odata-inhouse"/CIS/OData/orders WHERE employeeid = 20
----------

Issue/Introduction

This article emphasizes over one such use case where a user might come across the following error. This article explains the cause of the error and how to resolve it in TIBCO Data Virtualization.