Exporting Data from a Database to CSV or XML

Exporting Data from a Database to CSV or XML

Learn how to export dynamic data to a CSV or XML file

With this movie we will show you how to export dynamic data to a CSV or XML file using DMXzone Data Exporter.

Step by Step

Export dynamic data

We will show you how to export dynamic data to a csv or xml file using DMXzone Data Exporter. First, let's create an action file (1). And add a name for it. We will export our data to a csv file so we call this action file csv (2). We will export a database query results. So first, let's add a database connection (3).

Select your database connection, from the menu or create a new one, if you haven't done this already (1). Then, right click your database connection step (2). And add a database query (3).

then add a name for it (1). And setup the query options (2). Select a database table, and add it to the selected tables list (3).

Columns

Then, select which of the columns, you will need. All of the columns, added to this query will be exported later (1). We add all of the table columns, to the query (2). Click OK, when you are done setting up your database query (3).

Now, right click the query step (1). And open the data management menu (2). Select one of the export options - export to CSV file or export to XML file. We select the first option - export to CSV file (3).

Add a name for this step (1). Then, select the path, where the exported file should be saved (2). We select a folder on our server (3).

And then, we enter the name of our csv file (1). Click OK, when you are done (2).

Then, select the data to be exported (1). We select our database query (2). And then, we click the select button (3).

Select whether the exported file should contain a header, or not (1). Change the default delimiter if needed (2). Select whether to overwrite, the exported file or to create a new one on each export. We'd like to have a new file, every time we export data (3). And then, check the output checkbox, as we will need it later (4). Save your action file (5). Now, let's create a server action executor (6).

Add a name for it (1). And select to never auto run it (2). Then, select your action file, from the dropdown (3). And set the method to post (4). And click the OK button (5).

On our page, we added two simple anchor buttons. One of them, will be used to export the data to a csv file and the other one which will be displayed, after the export is complete will be used to download the exported file (1). Select the export button, and add a new behavior (2).

Select control dmxzone server action executor.

And select to run your export action executor (1). Click the ok button (2).

Now, click the download button (1). Select its tag, in the properties inspector in order to make a proper selection (2). Then, in your server action executor select the binding which is called the same as your export step (3). And open the bind to menu (4). Select to bind it as a hypertext reference . And click the bind button (5). Note, that you can skip this step and add a link to your exported file manually, to the download button if you select to overwrite, the exported file. This way your exported file will always have the same name, so dynamic hyperlink won't be required. With the button, and export binding still selected open the bind to menu again. And select data show. This way, the download button will only be displayed after the file is exported. Click the bind button. and we are done! Let's preview the results.

Click the export button, in order to export your dynamic data. Then you can download the exported csv file and open it with excel. That's how easy it is to export dynamic data to a CSV or XML files.

Extensions Covered

Comments

Be the first to write a comment

You must me logged in to write a comment.