Introduction

This article explains how to use the import and export feature of a Collection Data Source of Windows Phone App Studio. In my last article we learned about how to use the Collection Data Source for entering and managing our data manually. We learned various table management operations. Entering a data item one by one is a difficult and annoying task. This article explains how you can do the task of table entry automatically.

Importing data

This feature enables you to use your existing files to populate the collection data table. You can create your data file in a Excel Sheet on your PC and upload it directly to a data table. This feature also provides quick updates of a data table. Windows Phone App Studio's Collection Data Source provides an "Import data" feature so that you can use any existing data to populate the table. Right now it supports only Comma Separated Values (CSV) file types. You can create a CSV file using Excel or even Notepad.

Exporting data

Export is the reverse of import. It is a very useful feature and is handy for backup and schema modification tasks. It allows you to get a copy of your data table in a CSV file format. The CSV file is downloaded to the local computer and can be modified locally. Later on the same file can be used to update the app's Data Source using the import feature.

File Format

Windows Phone App Studio supports only CSV file types. You can add a maximum of 40 rows to a Data Source. So if the row count increases then only the top 40 rows will be imported and the rest will be rejected. In a CSV file, we have rows separated by new line characters. Columns are separated by a ";" delimiter. The order of columns in the data table and the order of values in a line of a CSV file should be the same for proper functioning. Your CSV may or may not have a header row.

Using the "Import data" option

To import data in your Data Source you need to have one file that will be imported into the Web Studio Server. The file structure should be the same as that of the Data Source table. So let us first create a sample CSV file.

Next we need to create a new Collection Data Source on the server with the same structure.

Now we are ready to proceed ahead for using our "Import data" feature.

Using the "Export data" option

This is very simple to use. What you need to do is:

Removing Bindings

To clear the bindings:

Possible errors

Summary

The import and export feature of collection data is very useful, especially when we work with dynamic data and slow connections. Thanks for reading this article. Don't forget to comment and share this article. In case of any doubt feel free to query using the comment section.