Keep track of your formulas with this new command

Imagine you have a list of formulas containing table names and some fields … then days later you decide to rename your tables. Now your formulas are no longer valid, which is totally understandable!

Well, good news: the new Parse formula command allows your formulas to remain valid when renaming 4D language or structure elements.

This command makes it possible to transform the contents of a 4D formula into different formats. For example, a formula containing the name of a table and a field can be transformed into a formula containing the corresponding virtual structure and vice versa.

It also lets you tokenize or detokenize a formula. This makes it possible to save a user-defined formulas by converting it to its tokenized format. You can then display the formula in a detokenized format without worrying about problems caused by changing a table or field name.

code snippet

Here is an example of this command in action:

// ask the user to type their favorite formula

EDIT FORMULA([Table_1];$formula)
// save the formula for later use
CREATE RECORD([users_preferences])
$persistentFormula:=Parse formula($formula;Formula out with tokens)
// later: execute the previously saved formula
EXECUTE FORMULA([users_preferences]formula)

And voilà, no more invalid formulas!

Fabrice Mainguené
• Product Owner •Fabrice Mainguené joined 4D Program team in November, 2016. As a Product Owner, he is in charge of writing the user stories then translating it to functional specifications. His role is also to make sure that the feature implementation delivered is meeting the customer need.After obtaining a Bachelor degree in Computer Science at CNAM, Fabrice joined a small software publishing company as a Windev developer. Then he worked for different companies in industry and trade areas as a Windev and web developer as well as technical advisor on new features.