Hi
I want to save my csv file from each button click in rows. Is there any way to change my blocks to save in one column instead of one row. Also, how can I add a timestamp to save each click in my csv file as a new column. In summary, I want to save 2 columns in my csv file (click column, time column).
Correctly formatted csv files save data in rows, not columns.
There are methods to transpose your data into columns if that is what you need?
Hi, I want to transpose it to a single column
But you would have many columns, as many as the number of rows ?
Show some example data, as it is in your csv file, and how you would like to see it.
For example is this what you want?
from:
Name, Age, Location
Tom, 22, UK
Sue, 24, USA
Nic, 31, Mexico
Jan, 27, Germany
to:
Name, Tom, Sue, Nic, Jan
Age, 22, 24, 31, 27
Location, UK, USA, Mexico, Germany
I want your first format (names in different rows)
We probably need to know more about what and why ...
- What are you trying to achieve ?
- Why do you need to transpose ? - Just for display purposes ? (it would be easier to work with the data as a row...)
- Why are you storing a stringified list in your csv ?
Also see
It may be better to just do one row, given the different lengths in each row. This is easily done.
Because after that, I want to get the click timestamp in the 2nd column for counting easily.
What click timestamp ?
I will add it later, but want to change the csv format first. I want to get each click button name and the click time in one csv file (col 1-button name, col 2-time)
A case like this requires extra tables (sheets).
That allows additional data to be accommodated as rows, not columns.
Though not part of the AI2 block set, they are called JOIN Tables
There is a good explanation at What is a Join Table and why should you use them? | Tadabase
(NOT a recommendation of their product, just their explanation.)
Do you want to record the timestamp when each button is clicked, or set the timestamp for when each button is clicked ?
You may need a separate csv for each record...
Thanks for your reply. My crosstab (csv file) only requires 2 columns and multiple rows to show the name and time of a specific event (e.g. button press). Imagine you have buttons R and L and press each button in a different sequence. RLLRRRRLL,...Ultimately, you will have a column for all button pressing and their time in a separate column. I thought it was easy to change my blocks to transpose the data format from a single row to a single column. It seems that \n cannot work here to insert new row after each click.
Yes it can, but recording the buttons and the timestamps for multiple records does not fit the formatted layout of a single csv file.
Do you need to store the data in a single file ?
Why not store each record in a tinydb ?
Something like this ?
What do the colors represent, and how do they change?