Need to export or somehow pull a DataTable out of a custom code block inside of a BPM

I’m working on creating some custom code that I run in a BPM that performs a table pivot and some extra formatting. I am at the point where my BPM fires and data from a BAQ flows in and the table is “pivoted” and formatted (sorta) however I need to debug my formatting. I really need some way to take my DataTable from the custom code block and export a CSV or excel or literally ANY format that will display all the data in the table in rows/columns. As of right now all I have been able to do is a “Show Message” where I display one cell at a time dtResults[0][1] etc…

In BPM you can insert a message box and reference a table or dataset. It doesn’t really export it for you. You could try using the email widget and include a table in the body of the email. At least then you could get the data.
Good luck!
Nate

Data formatting should be done in the BAQ, or in whatever system you output your file to. The idea of doing significant data manipulation in the BPM itself makes me nervous.

Personally, I’d skip the BPM and file writing parts entirely and just have whatever outside app you’re using make a REST call to the BAQ in question. I dabbled in E10-Python integrations for a bit and found it was stupid-easy to take the output from the REST call and convert it to a data object in (I think) pandas.

@jcmobley84 Not that it can’t be done as you can do most anything in C# in getlist, but I am with @jtownsend that it would be cleaner to do a REST call and then format. An Excel macro can do this or you can use oData built into Excel to get the baq results.

Creating a REST call just for a debug function in a BPM is a bit overkill IMO…

The DataTable type has a .WriteXml() method you can use to export it to XML. If you want a string, there is also an overload that outputs to a Stream.