Search from calulated Attribute

Hi togehter, i created a calculated attribute where i set a concated string from alle atributes of the entity by MF. This works fine. But when i try to search in this attribute it doesn’t get any content. i can’t use it in any contraint and using it in datagrid2 i seems not to work at all. I can use it with any other attribute but not with a calculated. How to filter with calculated attributes??
1 answers

It’s best to not use calculated attributes if at all possible as they are calculated for every single access and can’t be used for sorting or filtering.

In your example, I would look at refactoring the calculated attribute so it’s a regular stored attribute. You can generate and store this when another attribute in the entity is changed. One approach could be using a before commit event handler on the entity, so you know whenever data is stored to the database, the field will be regenerated and available for use.

I hope this helps.