How to Use Datasets in App Lab

Follow

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:

mceclip0.png

Click the Preview button to see what data is included in the table you’ve selected:

mceclip1.png

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!)

mceclip2.png

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:

mceclip3.png

Your first simple program can be to print out the contents of one of the columns in your table:

mceclip4.png

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):

mceclip5.png

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:

mceclip6.png

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):

mceclip8.png

You’re now ready to start using datasets in your app. 

Additional Information

  • 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:
    mceclip0.png
  • 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
    mceclip2.png
  • 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.
Have more questions? Submit a request

Comments

Powered by Zendesk