App Lab includes a list of featured datasets, such as information about planets, Spotify charts, sports and many more, that you can use to make your app! Or you can make your own data set.
You can find featured datasets by clicking on the Data tab in App Lab:
Click the Preview button to see what data is included in the table you’ve selected:
Click import to add this dataset to your app (you need to import in order to use any of the featured datasets in your app!)
Now go back to the Code tab in App Lab, and use the “getColumn” block to access the data in the table that you have imported:
Your first simple program can be to print out the contents of one of the columns in your table:
Make sure to update the name of the table to the one that you imported and the column name that you want to use (tip: every table has its own unique list of column names):
You can also store the content of the column of data in your table in a variable so you can reference it in other parts of your program:
Here, we are accessing and printing the first item in the "CountryNames" variable (which contains a list of all the Country Names in the "Countries and Territories" table):
You’re now ready to start using datasets in your app.
- Some of the datasets are "live" and are updated on a regular basis. You can see when a live dataset was last updated by the timestamp. If there is no timestamp included, this dataset is not being updated regularly:
- Once you import a dataset, you can edit its content (such as: delete rows, add rows, rename columns, edit individual rows). Note: you cannot edit "live" datasets since these are being updated on a regular basis from an outside source
- In addition to using the "getColumn" block, you can use "readRecords" to access data in your table. Here is information on using ReadRecords()
- If you want to learn more about leveraging Lists and Traversals to use data in your app, this CS Principles lesson is a good introduction!
- If you have ideas of additional datasets you think we should include in App Lab, please let us know.