Hello Istvan,
Have you looked in the marketplace there are certain kind of modules that you can use to do calculation based on a string, further you can use modules to create placeholders token for example for your DPET variable and for the margin.
Math module:
https://marketplace.mendix.com/link/component/207815
Example of tokens can be found in the standard email connector module:
https://docs.mendix.com/appstore/modules/email-connector/
https://marketplace.mendix.com/link/component/106670?_gl=1*1iokev1*_gcl_au*NTg2Nzg2MjMyLjE3MjI1ODQ4Mzc.
Hope this helps,
Good luck!