1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

csv json and arrays

Discussion in 'JavaScript' started by Baldlygo, Feb 4, 2022.

  1. #1
    I’m responsible for a decades-old archaeological project and have compiled a DVD size HTML linked archive of the results. This DVD archive is published at https://www.pastcaring.com/LoftsDVD2014/ I am continuing to expand the archive and add functionality to simplify the use of the data.

    Basic data is stored on a 1200ish line 20ish row Excel spreadsheet. My previous small involvement with JavaScript scripting is too far away for me to remember so I would value some advice for my next project to help me best understand the areas I need to revise.

    I need a search function that will search a column and return the row for a display to a customized table. By that, I mean a table that does not display all the rows and shows cells of particular sizes. I need the search to work independent of the internet.

    I see and I have tried scripts that parse a csv and write to tables. I have also tried scripts that write csvs to json files. In my case the data csv is fixed so could be stored as a json file. I believe the actual search will be done using arrays.

    My first question here is which store would be the most efficient (and fastest) for my search?
    Thank you for reading.
     
    Baldlygo, Feb 4, 2022 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,641
    Likes Received:
    4,486
    Best Answers:
    123
    Trophy Points:
    665
    #2
    There's a lot to unpack here - let's start with working independent of the internet... are you going to be distributing your code for offline use?

    If this data is going to be used by a limited number of people, all of whom you have access to you could do a google doc and write a cool script to give powerful search functionality. Google docs can be set up by the user to work offline.

    There are tools like google firebase and MongoDB that give you offline access after the first visit. I'm guessing some of the archeologists are going to be in far flung places.

    The simplest thing to do would be to create a webpage that uses jquery and datatables.net that picks up the json feed and allows searching. It won't, however, give you offline functionality unless you embed the json into the webpage and then you've got a nasty performance problem.

    The next best thing would be to put that data into a table and write ajax queries for the datatable to give a really powerful search experience. There's a bit of upskilling involved there, and it still wouldn't be available offline. There's equivalent stuff you can do with nextjs and other coding systems.

    Finally, I think Microsoft Access is still about - that lets your users download a single file with a search screen built in.
     
    sarahk, Feb 4, 2022 IP
  3. Baldlygo

    Baldlygo Active Member

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    86
    #3
    Thanks for your thoughtful answer Sarak.
    My primary purpose is to distribute the entire raw excavation archive offline. The first effort was on a CD followed by a DVD. I am now working on a USB version. These are already online but I need media that will exist longer than me and my Websites ;)

    The searching I am adding will be very very simple. eg. Enter an archaeological context number and return the data stored for it (description, notebook reference, photographs, finds etc).
    Getting back to Javascript my raw data is constant and there could be numerous searches in a session. It only takes a second to parse and display the entire csv. My question is - would it be better (easier - quicker) to work from a json file rather than a csv file?
     
    Baldlygo, Feb 5, 2022 IP
  4. sarahk

    sarahk iTamer Staff

    Messages:
    28,641
    Likes Received:
    4,486
    Best Answers:
    123
    Trophy Points:
    665
    #4
    Easier: it all depends on what's doing the search. Json is more predictable.

    You could put an html file on a usb with the json and use JavaScript to search.
     
    sarahk, Feb 6, 2022 IP
  5. Drand2000

    Drand2000 Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #5
    Thanks for giving such a complete answer. Tell me, as an intelligent user - I started to learn JavaScript, but I have problems understanding mathematics. What are my chances of becoming a good programmer?
     
    Drand2000, Mar 30, 2022 IP
  6. sarahk

    sarahk iTamer Staff

    Messages:
    28,641
    Likes Received:
    4,486
    Best Answers:
    123
    Trophy Points:
    665
    #6
    If your goals are web development then you don't really need maths but you definitely need logic, attention to detail - and resilience.

    If you want to work on other systems, where you have to manipulate data to provide meaningful information then maths might be necessary but chances are Google will serve you up a code snippet or example that someone else has already done.

    As an example, in fact my only example, my husband had drawn up an excel spreadsheet showing how NZers could leverage Government assistance programs to buy a house and pay it off in 25 years (the "normal" timeframe) and he wanted it put up on a website. The layout was going to be a challenge but the real problem came with the calculation of interest and principal. In excel it's a function but I couldn't find anything for javascript or PHP and the equation blew my mind. I did university statistics papers but this was something else. I have been a programmer for 30+ years and it just hasn't been an issue.

    Logic and resilience - let me tell you about my week. I'm working on a specific tool in the admin panel of a new site I'm building. My time is my own so I can take my time. I had a plan for what I wanted to do and there were some online examples of how people used the npm plugin I intended to use. I'm new to jsx so my expectation was that I'd need to refactor my code a few times. I eventually threw all my code out and started over with a different strategy to get to the same end goal. Finally yesterday I started to make really good progress and I'm on the right track. Does it hurt to bin code, oh yes, is it just part and parcel of being a programmer - absolutely.
     
    sarahk, Mar 30, 2022 IP
  7. Drand2000

    Drand2000 Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #7
    Thanks for the recommendation!
     
    Last edited: Mar 31, 2022
    Drand2000, Mar 31, 2022 IP