Hey Andreia,
Yes, it is possible, but it is not a common thing to do.
1. You can create a Java action to do this. Here you have an example code that you can modify as you wish.
IMetaObject metaObject = mendixObject.getMetaObject();
for (IMetaPrimitive metaPrimitive : metaObject.getMetaPrimitives()) {
String attributeName = metaPrimitive.getName();
PrimitiveType attributeType = metaPrimitive.getType();
Object attributeValue = mendixObject.getValue(context, attributeName);
System.out.println("Attribute Name: " + attributeName);
System.out.println("Attribute Type: " + attributeType);
System.out.println("Attribute Value: " + attributeValue);
}
If is the first time that you are using/creating java actions, check the official documentation:
https://docs.mendix.com/refguide/extending-your-application-with-custom-java/
2. The module MxModelReflection can be also used. Create a microflow that does:
MxModelReflection official doc: https://docs.mendix.com/appstore/modules/model-reflection/
Best Regards,
Ricardo Pereira
Sure. Indeed with MxModelReflection like Ganesh said. Here is a sample microflow:
And if you like a live example, again, like Ganesh said :-), take a look at microflow MxModelReflection.IVK_RecalculateSize which does this and loops over each attribute, making an estimation of the size per attribute.
Yes you can do that in
1. a java action. Pass your mendix object as a param to the java action. Since an entity is a Proxy class in java you can easily access the attributes via the getter and setter methods
2. i think using model reflection you can traverse the attributes within mendix. (you may have to explore this slightly as this might already be done in the MxModelReflections internal microflows