export data in txt file

I need to export a result of sql script in txt file.
Can you help me to understand the right way to generate this command?
thank you

Hi Corrado,

Create a middleware service, load data in it’s method and return results as a string or byte array. Invoke this service from a screen and then use ExportDisplay with ByteArrayDataProvider as shown here.