Saving enumeration values in SQL Server

0
Hi, My application uses an enumeration field and it doesn’t write the enumeration value to the database but the variable. This is the data entry This is the variables debugger    And this is the result in the database Please assist. Cheers, Costin Marzea
asked
7 answers
0

Hi Costin,

What database viewer are you using to see the contents of your table?  I suspect this is a display issue due to the way you are viewing the database table.  I can confirm from experience in a number of projects that Mendix stores the enumeration key in database columns (not the caption).

Also, is there an underlying problem this is causing in the application you are building?

Mike

***EDIT***

The sql statement you are building should be:

'INSERT into Product(ProductName,ProductDesc,ProductOwner,
ProductOpenDate,ProductStatus,ProductVersion,
ProductReleaseDate

VALUES (
'''+$Product/ProductName+''', '''+$Product/ProductDesc+''',
'''+$Product/ProductOwner+''', 
''2020-03-03'',
''’ + getCaption($Product/ProductStatus) +’'',
'''+$Product/ProductVersion+''',''2020-03-03''
);'

answered
0

Hi Mike,

 

I am using the SQL Server Management Studio.

Costin

answered
0

What do you mean by an underlying problem?

answered
0

This is the sql statement in the microflow:

'INSERT into Product(ProductName,ProductDesc,ProductOwner,
ProductOpenDate,ProductStatus,ProductVersion,
ProductReleaseDate

VALUES (
'''+$Product/ProductName+''', '''+$Product/ProductDesc+''',
'''+$Product/ProductOwner+''', 
''2020-03-03'',
''$Product/ProductStatus'',
'''+$Product/ProductVersion+''',''2020-03-03''
);'
 

answered
0

Hi Mike,

I will test this right now.

Thanks,

Costin

answered
0

Hi Mike,

When using ''’ + getCaption($Product/ProductStatus) +’'' I am getting this

 

and when using  ' + getCaption($Product/ProductStatus) +'  (one apostrophe) it extracts the value ‘Development’ but interprets this as a column name.

 

answered
0

This is the microflow

answered