Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question How to combine the csv files

Discussion in 'Scripting' started by Alexander21, Jun 13, 2023.

  1. Alexander21

    Alexander21

    Joined:
    Dec 14, 2015
    Posts:
    301
    Hi All

    In my project i am storing all the values in csv format in mysql. This is my format.and database field also.

    Level Time PlayerAction Playehealth Coins

    1 11.23.01 running 500 2343

    1 11.23.02 static 505 2345


    each and every seconds i am updating to the database . so each and every second i am updating to the database.

    Is there any way that i can combine all the data in the single string..

    like a similar way:
    1 11.23.01 running 500 2343 +1 11.23.02 static 505 2345


    I have to combine more than 40 similar rows..

    i can combine and store in the database. but i dont know how to extract the field in csv format.

    is there any i can do it...

    i have to combine and exract into the csv format. is it possible . can any one help me.
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,722
    If you're using MySQL why would you complicate/slow things down by introducing CSV format into the mix?
    Also updating the database every second seems excessive.
     
    Bunny83 likes this.
  3. Alexander21

    Alexander21

    Joined:
    Dec 14, 2015
    Posts:
    301
    Actually i am doing real time data analytics. So each and every second i need the user analytics for my research .
    So only i am doing it. So is it possible to combine it. or is there any other way to do it.

    Actually i need the data for each and every second. can you suggest good solution for it..
     
  4. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,124
    I've tried reading this a few times and it still doesn't make any sense.
     
    Bunny83 and PraetorBlue like this.
  5. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,722
    I don't really understand the question to be honest. What are you trying to "combine" exactly? You can still record second-by-second data without actually writing it to the database each second. I would put it in batches of maybe 60 rows at a time (1 minute) and update the database in a batch.

    Keep the data in memory in a list of DTOs in the meantime. https://en.wikipedia.org/wiki/Data_transfer_object

    I also still fail to see where CSV format plays into any of this.
     
    Bunny83 likes this.
  6. Bunny83

    Bunny83

    Joined:
    Oct 18, 2010
    Posts:
    3,525
    As others have said, what does
    actually mean? Your example only has two rows in your csv, so do you want to collapse all lines into a single line? Or do you want to group certain lines together? Your data sample and your explanation is just not enough to make sense of what you want to do.

    This is even more vague. There seems to be a language barrier. At least provide more contrete examples of what the input data is and what the output should be.

    You do realise that a question like: How does this series continue?
    14, 42, ...
    doesn't make much sense, right? We can't really see any pattern with such a small sample size.
     
  7. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,722
    Would also love some clarity on this statement. Does this mean rather than keeping your data in separate columns, as is typical in a SQL database, you are instead storing all of the information in a single comma-separated string column? Why would you do this?
     
    Bunny83 likes this.