Documentation when to use on tokens/constants/rules

1
Cannot find a generic documentation of when to - and how to - use tokens/constants/rules and regular expresssions. Is there any documentation in the documentation section? I need -at least- to have some values like 'ini' and store it in a central place to use it in multiple microflows.
asked
2 answers
2

Gerard,

Tokens I use when text date needs to be dynamicly filled with data from objects. See this post for some further explanation.

Rules. The best example how rules are used are in the community commons module. I regularly need to check if a string is empty. Now I can reprogram that every time, but a rule comes in handy this time. We have in the community commons the rule IsEmptyString. This rule returns a boolean when we feed it with a string. If the string is empty the rule returns true.

Constants are used to define values that can be different in different configurations. Constants are most of the time used in for instance webservice endpoints. Endpoints do not change most of the time, but they do change for test or production. By defining this endpoint in a Constant we make sure that this endpoint can be used all over the model.

Regular expressions are used to check the validity of data like in a zipcode. With a regular expression one can make certain that the zipcode is correctly entered. See also the community commons for some often used regular expressions. There are also some good sites on regular expressions if you google on them.

Hope this helps.

Regards,

Ronald

[EDIT]

Constants I would only use when something is constant but changes due to the environment like test, accp or live. When using stable values I would define a microflow. The example next week would take a date and add 7 days to it and return the recalculated date. So it depends really what you want to do. You could also use an entity where you always receive the first that defines those constant values.

answered
0

OK this helps me lot. However, one thing i am not sure of. I use a hardcoded value in several MF's, meaning exactly the same, like 365 or 'volgende week' or somehing like that, and i want to be flexible and define these only once. How?

answered