In this article we will cover how to create a report using Helical Insight Community (free) Edition.
User will be using a reference folder called Template Folder from the Helical website. (Download Template folder here)
This folder contains all the files to make a report with the configurations already defined.
What we will do is, after downloading the folder from the site, we will then define the connection to the database (defined by user) in
datasource.efwd wherein you can write the query to fetch the data from the desired table of the database defined.
This data fetched from the query will be shown in the report that we will be creating.
By default in
datasource.efwd (inside the Template Folder), connection to SampleTravelData database is defined. The SampleTravelData database is present by default with the Helical Insight installer.
1. Get the Template folder.
- Copy the Template folder from the site. (Download Template folder here)
- Open the folder where Helical Insight application is installed. For instance, in my case it is installed at ‘D:\Helical Insight’.
- Open hi-repository folder and paste the Template folder in it.
- Now after you login into Helical Insight application, click on home button.
- Once you click on the Home Button, there are various options coming on the drop-down, Click on HI (Please see the below screenshot).
- Click on file browser to see “Template Folder” inside file Browser.
- Open the ‘Template folder’ and then you can see the ‘Sample EFW Report’ in it.
2. Provide database connection
- We have saved the ‘template folder’ at ‘D:\Helical Insight\hi-repository’.(This path might be different in your case depending on where you have installed Helical Insight.)
- Open this ‘Template folder’ and find the file ‘datasource.efwd’ inside it.
- Open this ‘datasource.efwd’ file using any text editor.
<DataSources> <Connection id="1" type="sql.jdbc"> <!-- any unique number can be given --> <Driver>com.mysql.jdbc.Driver</Driver><!-- database driver --> <Url>jdbc:mysql://192.168.2.9:3306/SampleTravelData</Url> <!-- datasource locationdetails --> <User>devuser</User><!-- user name --> <Pass>devuser</Pass><!-- password --> </Connection> </DataSources>
The following is the description of the above code snippet
- <DataSources> : To define various connections.
- <Connection id=> :- Define your connection to a particular database with unique id.
- <Connection Type=>:- Specifies the type of connection.
- <Driver>:- Specifies the driver used to interact with database. In this case mysql jdbc driver is used.
- <URL>:- Give the location details with the driver detail , server location , port number and the database to be used in the URL tag.
- <User>:- Username credential for connecting to the database.
- <Pass>:-Password credential for connecting to the database.
After providing the database details as shown above, we will provide query in the EFWD file as shown below.
<DataMaps> <DataMap id="1" connection="1" type="sql"><!-- Give a unique id --> <Name>Tabular Report</Name> <!-- Can be any name --> <Query> <![CDATA[ <!- write your query here -!> ]]> </Query> </DataMap> </DataMaps>
- <DataMap> :-There can be multiple datamap and each datamap has to be given a unique id. The database to which it connects is fetched from the connection id. ConnectionId is defined in the previous point.
- <Name> :- Any name of user’s choice.
- <![CDATA … ]]> :- Query is written inside it. The file which you have opened is already having a sample query written to create a sample report from the travel data, you can replace it with your required query.
- If you are creating tabular report you can fetch the data in any order.
- If you are creating reports which contains Axis Charts (bar, line, step, area, area-spline etc.) then note that The Sample VF file which you are referring has first field matched to x axis and second field matched to y axis so write your query accordingly. Also select only 2 data fields one can be string/category/time-series and other is any measures contains numeric value.
- If you are creating reports which are non-axis charts (Radar, Polar, Pie, Donut etc.) then note that The sample VF file which you are referring has first field matched to String/Category/Time-Series and second field matched to measures contains numeric values so write your query accordingly.
Now your first report is ready.
4. Run the report
- Open the Helical Insight application in web browser.
- Open the file browser.
- The folder with name Template Folder is seen.
- Open it and run the report Sample EFW Report. You can then see the tabular report with the query and database which has been defined.
To create the above report, we have used ‘Table.efwvf’ file. Inside this ‘Table.efwvf’ file, we have a DataSource tag.
In this DataSource tag we define the DataMap (inside the ‘DataSource.efwd’ file) to be used by giving DataMap id in the DataSource tag.
The report created above is by default pointing to DataMap id “1” which implies that the data being plotted in the above report is getting fetched from the query written inside DataMap id 1.
Please refer the below flow diagram for explaination:
Open sample .efwvf file present inside TemplateFolder. For your reference we have opened the ‘AreaChart.efwvf’ file. See the screenshot below for the reference. Here you will find that by default DataSource id in AreaChart.efwvf file is set to “1” which implies that the data in this visualization is coming from the query which is written inside DataSource.efwd file having DataMap id “1” .
To add the new DataMap inside the ‘DataSource.efwd’ file refer the following steps:
We need to provide the unique number in the DataMap id and need to add the query inside it, this will give the data that needs to be shown in the report.
- Add any query inside DataSource.efwd file with unique(it should not repeat) ‘DataMap id’ which will give the data that needs to be shown in the report.
- We have written query inside ‘DataSource.efwd’ file and assigned DataMap id “1” to it, this will send the data to DataSource id “1” which is present in AreaChart.efwvf file.
- If you want to fetch the data from different query then add another query and assign the DataMap id as “2”. Below is the screenshot for your reference where we have created added the new query and assigned the DataMap id as “2”
To fetch the data from the newly created DataMap refer the following steps:
In the EFWVF file you need to give the DataMap id inside DataSource tag which will point to that of newly created DataMap
- Change the DataSource tag of VF file, this will lead to changing in the data and not in visualization.
- Let us say it was initially pointing to DataMap id “1” of DataSource.efwd file (which means that it was taking the data from query that has DataMap id “1” in DataSource.efwd file), by changing it to any other number it will take the data from the query which is written inside that DataMap id.
- By changing the highlighted DataSource id we can fetch the data from different query for the same visualization.