Hi all!
I've got a table in perspective that I use an export function to spit out to CSV (code below).
This is great for dumping the whole dataset, but doesn't give me the current data view.
I thought I could get around this by instead enabling and copying the 'Results' data set when a filter is applied. The problem I'm having with this 'hack', is I first need to convert this into a dataset to be able to export it.
When using system.xxx.toDataset on the array, it gives me a 5X1 dataset where the objects are strings and not columns.
Can anyone please advise how I correctly convert this structure to a dataset? And/or if there's a better way of exporting the current table data view to CSV?
Thanks!
Alex
# Get the table component to retrieve the dataset from
table = self.parent.parent.getChild("TableOfThings")
# Create a CSV from the dataset
csvData = system.dataset.toCSV(dataset = table.props.data, showHeaders = True, forExport = False)
# Prompt the browser to download the file
system.perspective.download(fileName, csvData)