Hi. I've encountered this before and can recommend a solution. You might want to check out Fast Scripts
https://www.fast-report.com/products/fast-script. That should suit you. I don't think you'll find a better solution. FastReport has a large library of scripts that should be useful.