I have created a global math expression field in views, and I want to sort the results by the results of the math expression.

In particular, I use Drealty to connect to a RETS server and download property listings. My local database gets populated with prices and number of bedrooms for each listing. I want to sort based on Cost per Bedroom.

Any Ideas?


You can't sort currently by just using views but i would recommend to store the value in the database.

Therefore create a computed field: http://drupal.org/project/computed_field and do the logic in there to store the value in the DB. Once you have done this views will be able to sort by that.

|improve this answer|||||

If you have table with aggregation module you can sort without needing to store in DB

|improve this answer|||||

I guess you can do it by creating a new module with hook_drealty_import_presave_alter or rules. The problem is that you need to write the result of the math to the database so that you can sort or filter on it.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.