CSV download for a device state table

Is it possible to have a CSV download button for a device state table in an experience website?

Assuming you’re referring to adding a button next to the block in a dashboard page, it’s not possible now. But it’s a great feature idea and I’ll add it to our backlog.

With a custom page, you could get there but it would be a lot of work. You would have to …

  • Query the data in the workflow responding to the endpoint request
  • Convert it to a CSV format, probably using a Function Node
  • Reply to the endpoint request with the CSV data. We don’t currently allow generating a file within our workflows so the content would be sent back to the browser in its raw form and it would be up to the user to download it.

ok it would be a good feature to have because you see it in a lot of analytics dashboard so customers expect this and thinks it is easy to do

2 Likes

Dylan,

I think the original poster is trying to achieve the the same thing I had in mind but I just want confirmation. I would like to be able to query a bunch of data from a device and generate a custom CSV file in which one of the two scenarios would happen (Whichever is easier to implement):

  1. Email the CSV directly to a user given an email address provided in an Input Control Block.
  2. Prompt the user to download the generated CSV directly from the dashboard.

I assume option 2 would be done using what you mentioned above correct?
Is option 1 even possible?

Thanks

1 Like

I’d like to be able to do the same thing.

2 Likes

Same here. I’m trying to export the DST today and can’t find this feature. I even tried to simply drag the mouse over the piece of the table I needed, copy and paste onto a txt/xls format; it doesn’t work and it doesn’t copy everything. Definitely something to have in the future. :red_circle:

PS.: one more thing: could we also adjust the table’s columns size (how wide they are)?

I looked on the DST help section and forums and couldn’t find a way to do it. Thanks! j

1 Like

Hi @Jose_Cruz,

The implementation Dylan suggested last year has a few less steps than it did thanks to some updates and features. Today, if you wanted to export Device State as CSV to an email, you can do so in an experience or a regular dashboard. There is not a single button that does it, but you can easily make your own! Let’s dive in.

In an experience, you would use a Losant API Node and an Endpoint and Endpoint Reply Node. You would begin with an Endpoint Node that is triggered by a button in your experience (/button), then use the Losant API Node and configure its Resource and Action as Device: Export. Then, your Endpoint Reply Node could communicate a success message, or just do nothing!

In a regular dashboard, you can cheat this a little by using an Input Control Block that triggers a Virtual Button in a workflow that also has a Losant API Node. The Input Control Block could exclusively have a button, like so:

On clicking this button, my Virtual Button in the configured workflow will be triggered. Over in this workflow I have a Losant API Node with the same configuration as my experience workflow (configure its Resource and Action as Device: Export):

For both the experience method and regular dashboard, I get an email with a link to download my state report in CSV format:

Hopefully this method can help in the meantime, but I will also add a +1 to this feature request with our engineers.

Thanks!
Julia

1 Like

Awesome! I’ll definitely check those examples and try em’ out asap! Thank you! :red_circle:

1 Like