Build a Report in 5 MinutesΒΆ

In this tutorial you’ll use the Studio and the Gateway to build a report and send it to your customer in 5 minutes. You will use World Bank project data that you can download from http://jsonstudio.com/resources/. Each document in the collection describes a funded project by the World Bank. Use mongoimport to insert this into a new collection called world_bank_mod1 in order to follow this tutorial.

You will build a simple query in the Studio, then parameterize it so that your users will be able to get the information they need, and then send them a link to the report in an email.

Step 1: Build your query and test it.

Login to the Studio and connect to the database in which the world_bank_mod1 collection resides. In the top-left pane select your collection.

_images/rep1.jpg

In the lower left pane you have a cursor on the documents in the collection with which you can select conditions as well as select which columns you want shown in the report.

_images/rep2.jpg

Rather than see all documents in the collection, you want your users to see all funded projects by region. Scroll down the document until you see the regionname field and the value next to it (e.g. “regionname”: “Africa”) and double-click on the value for regionname (e.g. “Africa”). This adds a condition to the query you’re building so that only projects funded in that region are shown. You can see this condition in two places. In the lower right-hand pane you see the current query - find({“regionname”:”Africa”}):

_images/rep3.jpg

If you click on the “Construct Query using Double Clicks” tab at the top you will also see the query in the “Where” area:

_images/rep4.jpg

Each document in the result set has many details - perhaps too many for your users. Suppose that your users only want to see the country, region, grant amount and approval date. Back on the lower-left hand pane showing sample documents hold down the alt key and double-click the countryname, regionname, approvalfy and grantamt fields. This will add projections to your query - e.g. the “Select” area will be populated and your query will have these components:

_images/rep5.jpg

Test your report by clicking on the “Table View” tab at the top (where you can see the data in a tabular view and click on the “Report” button to see what your users will see.

_images/rep6.jpg _images/rep7.jpg

Before you save your query/report you should parameterize it. The current query will always report on countries in Africa but your users will want to choose the region they want to get data for. Switch to the “Construct Query using Double Clicks” tab and edit the text in the “Where” text area to read “regionname”: “$$region”:

_images/rep8.jpg

$$ tells the Studio and the Gateway that this is a parameter that the user needs to provide.

The query is done - you need to save it and give it a name. In the “Save search as:” field enter thename by which you want to call this report - e.g. amt_by_region and click enter. Your query will be saved.

_images/rep9.jpg

Step 2: Create and send the URL to the report.

Your report is ready for your users. Click on the “Publish URL” button to get a URL that you can send your users. The following dialog will open up:

_images/rep10.jpg

In this dialog you do your final configuration for the link that will be sent to the users. For example, you can create a separate link for them to view a report or to download a CSV that they can use from a spreadsheet application (by selecting the CSV radio button instead of the REPORT radio button). If you want them to use your account for generating the report or this account is a generic functional account you can specify your password in the Password field. If you do not want the password in the (encrypted) URL then leave it empty and they will need to put the password in themselves. If they will each be using their own username then leave the username field empty. In this tutorial I just put the password in the URL.

The limit value is based on the data you were viewing in the Studio - change that to whatever value you want or leave it empty if you do not want a limit. If you enter a value for the region it will hard-code the report so leave that empty for now. Click on the “Publish URL” button to have the Studio generate the report URL for you.

_images/rep11.jpg

Copy the URL from the Encrypted URL field an paste it into an email to send to your users:

_images/rep12.jpg

When the user gets your email and clicks on the link they get the following screen:

_images/rep13.jpg

The reason is that the user needs to specify the region (if you have a region in there then it would not go through this screen and instead go directly to the report). If you do not include the password or username then the user needs to enter these as well. Enter “Africa” in the region field (including the double quotes) to get the following report:

_images/rep14.jpg

Table Of Contents

Previous topic

Release Notes for JSON Studio

Next topic

Using World Bank Project data

Copyright © 2013-2016 jSonar, Inc
MongoDB is a registered trademark of MongoDB Inc. Excel is a trademark of Microsoft Inc. JSON Studio is a registered trademark of jSonar Inc. All trademarks and service marks are the property of their respective owners.