I'm configuring a REST service of my own, following the pattern provided in the Integrating with Web Services course.

In an UpdateCommission method, in the GetCommissionById aggregate:


The Commission entity's CommissionID data type is Integer.
The CommissionAPI structure's CommissionID data type is Integer.

In TrueChange it reads "Unexpected Data Type: 'Commission Identifier' data type expected instead of 'Integer.' Recheck the expression or use a Data Conversion function."

What am I missing/what is going on here?

Thank you in advance.

Solution

In fact what counts here is not if it's integer or not. If they don't belong to the same table/field you will get the warning.

I believe Comission and ComissionAPI are different data types.


Eg.

If you have two tables Commission and Table2, both will have the column "Id" as long integer. But for Service Studio the first one the type is "Commission Identifier" and the second one is "Table2 Identifier", that's why you get the warning.


You can add an IntegerToIdentifier(CommissionAPI.CommissionID)

Solution

Hello Landon,

This is a bit confusing, but let me try to explain.

An Identifier is a Data Type by itself. So, the ComissionID, that I presume is an Identifier for the Comission Entity, is the Data Type Comissiong Identifier. The "underlining" data type is an integer, but when comparing variables/attributes that have an Identifier data type with something else, the platform does not use the "underlining" data type, to be able to detect wrong comparisons (e.g. ComissionID = OrderID, even if both are integers, would probably be an error).

Hope this helps clarify why you are getting this warning.

You can safely ignore this warning in this specific situation.

Cheers.

This warning occurs because you are comparing a identifier (which is of the type integer) with a integer. One way to solve this is, as Denis said, to use the IntegerToIdentifier function to convert the integer to an identifier.


A better way would be to take a look at cause of the warning.

I don't know the exact structure of your application, but there probably is (well, should be) a one-to-one or one-to-many between the Commission and CommissionAPI tables, based on the CommissionID field. To make this relation, change the datatype of the CommissionID field in the CommissionAPI table to Commission Identifier. This creates a foreign key between the tables and will solve the warning.

Thanks for all the replies!

Before seeing your response Eduardo, I already threw some IntegerToIdentifier() calls in there, and upon testing things seem to be working as expected.

Thanks again!

Glad everything is working as expected now :)
Cheers!