In a previous blog post, you learned how to build sophisticated and complex search criteria by applying formulas in an ORDA query. To further provide you with complete and powerful development tools, a new ORDA method available: orderByFormula(). With the help of formulas, you can now order an entity selection using complex criteria in a project method or 4D expression.
In 4D v17 R6, ORDA queries are becoming increasingly more powerful and concise. This blog post is for those of you who need more sophisticated search criteria than just a simple syntax like “name = Smith‘”. With this R-release, you can use any project method or 4D expression in the query() member method by using formulas.
What better way to explain this feature than with an example? Let’s dig into the details.
The New formula command is available since 4D v17 R3. So far you might have thought of assigning a formula as a method to an object or building smart objects that can calculate values or do anything you need. That’s really great, and there’s more than meets the eye!
I had a great demonstration from Vincent de Lachaux – Developer and expert 4D – on how he uses this command. For this blog post, I compiled different scenarios from that demo to give you insight on a different dimension of this command.
A new command is at your disposal allowing you to use formulas in your code. You can now encapsulate them in objects and call them when needed. There’s no more need to write your code as text. Now you can just pass your formula in your command and that’s it! This is a great addition, since your code isn’t text, you can benefit from Syntax highlighting and all the other advanced functionalities of the code editor!