Forum Forum

Retour

RE: Importing table/list data from csv

Bascule
Importing table/list data from csv
Réponse
07/03/21 23:33
I am looking for some information on working with csv tables and lists. I've tried the documentaion wasn't able to find to much. Basically I am looking to import data from an external csv into a table. Thanks.
0 (0 Voter)

RE: Importing table/list data from csv
Réponse
08/03/21 01:06 en réponse à Ry Landry.
Hello Ry,
Can you tell us a little more about your needs?

A. Are you trying to bring in static data (that happens to be in csv format) so that you can populate a table for display purposes?
B. Do you have a CSV file that lives somewhere (internet, desktop) that needs to be loaded in by the lesson on the fly, and push that into a table?
C. Or something in between?

Let us know a little more about what you've got to work with, and we can provide more guidance. We might eventually need to take this conversation off the forum, and have you send us a copy of what you're starting with. We can return to the forum to post the method that works once we have a good solution (for anyone else trying to do the same thing).

- Nav
0 (0 Voter)

RE: Importing table/list data from csv
Réponse
09/03/21 00:04 en réponse à Navdeep Dhillon.
Hey Nav,

Thanks for respinding. I am look to do something like B. Basically populate tables or lists from a csv file that lives in the same root folder as the index file. This way the content could be quickly updated without touching the moudle itself. The csv file will contain part numbers and prices as an example.

At this point I am starting from scratch and totally open to ideas or suggestions. Thanks!
0 (0 Voter)

RE: Importing table/list data from csv
Réponse
03/09/24 20:58 en réponse à Ry Landry.
Hello Ry,
Here's how you can do that!

video: https://share.smartbuilder.com/public/support/load_csv.mp4
source files: https://share.smartbuilder.com/public/support/load_csv.zip
sample lesson online - https://share.smartbuilder.com/public/support/load_csv/index.htm (you don't have access to our server to overwrite the csv file, but I can change it as much as I want)

Edit: There's a more in depth use case outlined below. Check it out!

Let us know if you have any questions!

- Nav
0 (0 Voter)

RE: Importing table/list data from csv
Réponse
14/03/21 02:02 en réponse à Ry Landry.
Fantastic! Just what I was looking for,
0 (0 Voter)

RE: Importing table/list data from csv
Réponse
29/08/24 22:58 en réponse à Navdeep Dhillon.
Here's an update to this topic with some more information about a specific use case. Once you've loaded CSV data into SmartBuilder, you can create a search in one of those fields and get related data.

Video - https://share.smartbuilder.com/public/support/load_csv_and_data_parsing.mp4
Sample files - https://share.smartbuilder.com/public/support/load_csv_and_data_parsing.zip
0 (0 Voter)

RE: Importing table/list data from csv
Réponse
04/10/24 22:43 en réponse à Navdeep Dhillon.
Hey Nav,

This is awesome!  Exactly what I needed as well. I think you're on to something with a good use case here for externalizing data into a csv so that it can be easily opened and updated in Excel and not require any SB navigation skills.

My question is, how does SmartBuilder know to package that CSV into the lesson to begin with?

Since I'll need to be re-building this functionality in an existing lesson, how do I initially associate my CSV with the lesson prior to the first publish so it gets included in the lesson package?  In other words, once I configure my existing csv with all my unique data, how do I drop it into the package that would be getting uploaded to Smartbuilder?

Or do I just need put the csv in the SBconfig file, make sure the names match, and it will automatically include it at publish time?  

Thanks!

Leif
0 (0 Voter)

RE: Importing table/list data from csv
Réponse
04/10/24 23:54 en réponse à Leif Cederblom.
Hi Leif,
As shown in the video, you can create a folder with the same name as your lesson + .sbconfig and drop your file in there. That will expose it to the sb lesson during Preview, and when you publish it, it will suck in those files with the packaged output.
0 (0 Voter)

RE: Importing table/list data from csv
Réponse
05/10/24 00:47 en réponse à Navdeep Dhillon.
One other question... 

If I don't know how many rows in the table I might ultimately need (as the CSV would be updated over time to include all options as they are added,) do I just set up the SB table object with more than enough rows to enable future capacity?  In other words, if I'll have 50 unique rows to start, do I set the SB table object to have 100 rows, and just know that if I ever exceed that amount of rows in my csv, that I would need to update the SB table object?

Or would the SB table object automatically grow to match the size of the csv?

Thanks!

Leif
0 (0 Voter)

RE: Importing table/list data from csv
Réponse
05/10/24 18:31 en réponse à Leif Cederblom.
Hi Leif,
0. Try it out and see what happens!
1. The SB Table is just to display the data while you're testing so you can see what's happening. You could omit the visual table entirely since you're working straight from the variable, which is the data from the CSV. You're never asking the table anything.
2. The SB Table object will grow to match the data. If it's too long for the bounds of the object, it will use a scrollbar. Oddly, we have a "Scroller" property for the Table object that doesn't appear to do anything (you'll always get a scroller when there's too much data and not enough room).
0 (0 Voter)