Skip to content

saveTable() wrong csv output #2842

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 of 17 tasks
thomasvanhemert opened this issue May 3, 2018 · 4 comments
Closed
3 of 17 tasks

saveTable() wrong csv output #2842

thomasvanhemert opened this issue May 3, 2018 · 4 comments
Assignees
Labels

Comments

@thomasvanhemert
Copy link

thomasvanhemert commented May 3, 2018

Hey all,
I hope this is the right place to post this but I figured you might be of help here. I'm working on a p5 javascript project where I load a csv file with loadTable() in the preload() function. And I am saving it again later in my setup() with the saveTable() function when a button is pressed. Now comes my problem, the output csv is not in the right format. The function saveTable() exports the following:

sessionId,timeStamp,selectedItems100000,3-5-2018_10:24,EPC123412341234123412340001

But i need it to output it as seperate rows instead of all the rows placed besides each other. Like this:

sessionId,timeStamp,selectedItems
100000,3-5-2018_10:24,EPC123412341234123412340001

This is the part of the code that prepares and exports the csv file:

var newRow = sessionLog.addRow();
newRow.setNum('sessionId', sessionId);
newRow.setString('timeStamp', timeStamp);
newRow.setString('selectedItems', selectedItems);
saveTable(sessionLog, 'sessionLog.csv', 'csv');

Coud any of you help me with this?

Nature of issue?

  • Found a bug (i have a question)
  • Existing feature enhancement
  • New feature request

Most appropriate sub-area of p5.js?

  • Color
  • Core/Environment/Rendering
  • Data
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Other (specify if possible)

Which platform were you using when you encountered this?

  • Mobile/Tablet (touch devices)
  • Desktop/Laptop
  • Others (specify if possible)

Details about the bug:

  • p5.js version: p5.js v0.5.4 October 01, 2016
  • Web browser and version: Chrome version 66.0.3359.139
  • Operating System: Windows 10 Version 10.0.15063 Build 15063
  • Steps to reproduce this: See the top of the post.

Feature enhancement details:

New feature details:

@Spongman
Copy link
Contributor

Spongman commented May 3, 2018

you might need to open the file in an editor that is sensitive to different types of line endings (notepad.exe isn't).

@thomasvanhemert
Copy link
Author

Thanks for your reply! When I open the file in Excel for example, all the headers and values are placed in individual cells underneath each other. So one column and six different rows. That is also not how I need it to be.

@TanviKumar TanviKumar self-assigned this May 27, 2018
@TanviKumar
Copy link
Member

Hey @thomasvanhemert , could you post a copy of the intial file you load? It works fine when I create a csv file that has sessionId,timeStamp,selectedItems as the header and try your code with some values.

@lmccart
Copy link
Member

lmccart commented Jun 15, 2018

@thomasvanhemert we haven't been able to reproduce this one without the file, so I'm going to close this for organizational purposes. please feel free to reopen if you can update with more info. thanks!

@lmccart lmccart closed this as completed Jun 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants