Database Connector - How to map a database column containing a space to a Mendix attribute?
0
Hello, I use the DatabaseConnector module from Mendix to execute a SELECT query to an external database (SQL Server). The Query is as followed: SELECT [Field1],[Field2],[Other Field] FROM [Table] In my domain model, I have an Entity with the attributes Field1, Field2, OtherField And I got stuck because the Database Connector cannot map the column “Other Field” (with a space) to the attribute “OtherField” (without space). The error sent by Mendix is the following: The entity type 'MyModule.MyEntity' does not contain the primitive 'Other Field' as specified in the query. Any suggestion on how to solve it?
asked
Claire Malcor
1 answers
0
Found the solution.
I just need to use an alias for the column in my SQL query, to match the name of the attribute in Mendix.
My query is now:
SELECT [Field1],[Field2],[Other Field] AS OtherField
FROM [Table]