When a 4D Write Pro document contains external elements resulting from expressions or formulas, they are visible when the “Display expressions” mode is used. Still, they are blended into the text when the values are displayed. This is what you want for a final document, but it is sometimes useful to easily view these calculated values while writing the document. Well, 4D v19 R3 is giving you new display options for this purpose!
As a 4D Write Pro user, you’ve most likely used expressions (or more recently, formulas) to automatically fill in certain parts of your documents. These formulas can return “raw” text or images. In the case of text, they may contain line breaks. The question is how should these line breaks be handled when they are processed inside 4D Write Pro documents? This blog post provides the answers … keep reading!
With 4D v18 R2, 4D Write Pro is able to manage formula objects inside documents. To do so, four new commands have been created: WP Get formulas, WP Insert formula, WP Compute formulas, and WP Freeze formulas. They all can be used with intuitive targets like document, body, headers, etc. And as you may have guessed from the command names, formulas are no longer text expressions but powerful formula objects!
According to the top 10 blog posts of 2019, the Formula: More power behind simplicity post ranked quite high … in the top five. It seems that Formula really grabbed your attention, so here’s another tip that Vincent de Lachaux (developer and 4D expert) has shown me and I’m sharing with you!
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 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!