Exporting numbers instead of the caption to .xls

5
The object 'Article' got a reference set selector to the object 'Colour' with a single attribute 'Name'. The database is filled with 93 colours which are connected to the different articles. Unfortunately, the object 'Colour' doesn't contain an attribute 'Number'. I would like to make an Excel export but I want to export a number instead of the colour's attribute 'Name'. A simplified example is given below: Available colours in the database: * Blue * Red * Yellow I would like to export '1' instead of 'Blue', '2' instead of 'Red' and '3' instead of 'Yellow'. How can I do this? And how would you do this with an article which contains more than one colour?
asked
1 answers
4

You can create a virtual attribute in 'Article' and define in a custom action a number value for each colors. This is an easy method to get a clear combined number string for articles which contain more than one colour.

For the generation of a unique color number, maybe you can use the getGuid() method of the Colour proxy object. If this number is too long, you can use the following method:

colour.getMendixObject().getId().getObjectStoreId()

This number is the internal database id for the object. This is a low number and unique within all Colour objects.

answered