How to use getcaption for enum fields when retrieving and returning a list from DB

0
Hello I am publishing a webservice from Mendix in which I retrieve a list from DB and return that list. There are 3 fields/attributes in the list which are of type enum. When I am returning the list from the MF, the value for these enum being returned is , 'getName' value. But, I want to return 'getcaption' value for these enum fields. Ex: 'Investment' is a enum field having below values in Mendix Caption                     name €0                                _0 €1 - €10.000             _1____10_000 The value being returned from mendix list is  _1____10_000 instead of €1 - €10.000  How can I return €1 - €10.000 ?   Thanks in advance  
asked
1 answers
1

From what i understand the object youre trying to publish needs these enum attributes as a string attribute. So when creating the object (non-persistant) for publishing you need to use the getCaption(ENUM) in order to create that string value from the persistant object to the non-persistant object. If that still doesnt give the desired string, mendix can do that sometimes because it supports multiple languages (the captions) then you have to create the string yourself based on microflow logic.

If this webservice is used more than the enum is changed for this object and your table isnt that big yet, and the string isnt language dependent (like this monetary example). i'd suggest storing the value as both the enum and the string. making the webservice just that little bit faster since there is no need for this action 3 times every time the webservice is called.

answered