4D Write Pro: Assign Names to Formulas

In 4D Write Pro documents, formulas are crucial and contribute significantly to their functionality. Previously, these formulas could be represented as values, expressions, or symbols.

However, to further enhance the user experience and improve readability, an exciting new feature with 4D v20 R3 has been introduced: the ability to assign names to formulas. This latest enhancement allows users to quickly identify and comprehend the purpose of each formula within the document.

Download HDI: Assign Names To Formulas 

FOR WHAT PURPOSE?

Thanks to this new feature, you can display this:

…instead of this:

blank

 

How?

Two commands have been revised and improved.

WP Insert formula

The first one, the WP Insert formula, now admits two distinct syntaxes.

The first syntax is, of course, retained for the purpose of compatibility:

$formula:=This.data.customer.lastname+" "+This.data.customer.firstname
WP INSERT FORMULA($range; $formula; wk replace)

The new one allows you to use an object containing the formula and its name.

$o:=New object
$o.formula:=Formula(This.data.customer.lastname+" "+This.data.customer.firstname)
$o.name:="Customer name"
WP INSERT FORMULA($range; $o; wk replace)

WP get formulas

The WP Get formula command has not changed its syntax. It still returns a collection of objects, each corresponding to a formula. These objects have been enriched and now contain the formula name (if defined), the formula itself, and the other existing attributes (range and owner).

Form.formulas:=WP Get formulas(WParea1)

blank

ANOTHER ADVANTAGE

If formulas have been named, this will make documents more readable and hide the potential complexity of these formulas from end-users. In this case, formulas will no longer be displayed as tips in this display mode. And in the case of a display by values or symbols, the ends will no longer display the formulas themselves, but only their names!

But developers haven’t been forgotten: if you still need to display formulas as tips, simply hold down the “Ctrl” (Windows) or “Cmd” (macOS) key when hovering over them.

Conclusion

Introducing this new formula display mode in 4D Write Pro documents significantly enhances their intuitiveness and overall user experience. These documents’ readability and comprehension are greatly improved by allowing developers to assign names to formulas. This update not only makes working with document templates more accessible but also ensures a more pleasant and seamless user experience.

 

Roland Lannuzel
• Product Owner & 4D Expert •After studying electronics, Roland went into industrial IT as a developer and consultant, building solutions for customers with a variety of databases and technologies. In the late 80’s he fell in love with 4D and has used it in writing business applications that include accounting, billing and email systems.Eventually joining the company in 1997, Roland’s valuable contributions include designing specifications, testing tools, demos as well as training and speaking to the 4D community at many conferences. He continues to actively shape the future of 4D by defining new features and database development tools.