Convert Data Table to XLSX Input Format
Howdy,
I am trying to export records out to an Excel workbook, where each record is its own sheet within the workbook. I keep getting an error when running the workflow that the Convert Data Table to XLSX activity is expecting an array (gcx:wf:xlsx::ConvertDataTableToXlsx: [WF: Activity input error] Input dataTable was invalid. Expected type array).
I am a little confused on exactly what format the input is supposed to be in. The documentation https://docs.vertigisstudio.com/workflow/latest/help/activities/convert-data-table-to-xlsx.html states that the required input is a DataTable, or an array of DataTables, however in Workflow Builder it says the input type is an object or array of objects.
I have an array of objects that look similar to this:
[{SiteName1:[attr1:value1, attr2:value2,…]}, (SiteName2:[attr1:value1, attr2:value2,…]}, …]
My thoughts are that it would take each object, create a sheet for each object that is named SiteName1, SiteName2, etc. and then use the array of attributes and values to create the rows of data in each spreadsheet.
As far as inputting a DataTable, I am struggling to find an easy way to create a DataTable from the objects.
Any help is greatly appreciated.
Thanks,
Brian
-
Brian Cunningham , I think you're along the right lines.
The activity should accept an array of DataTable inputs or an individual DataTable.
The designer says “object” in the input description because it's written in TypeScript and we can't reference a .NET data type there, but the documentation is correct.
I believe the input error is because your values are not actual DataTable objects. While TypeScript will often accept something that looks like the expected type (i.e. has the same properties) .NET is stricter and needs the correct types.
The only activity that I'm aware of that can actually create a DataTable is the Convert CSV To Data Table activity. If you're able to supply your values to that activity in CSV format, you will get out a DataTable that should then work in Convert Data Table To XLSX.
1 -
Thanks Ken Lyon ,
So, I also started trying to utilize the Run Operation activity and feed it the results.convert-to-xlsx command and parameters, but ran into some walls there too. If I can covert my objects into a featureset, should I be able to provide that featureset to that command as a parameter?
Thanks,
Brian
1
Please sign in to leave a comment.
Comments
2 comments