16     Data Binding

Nucleon BI product allows binding data from your data source using expressions. With this binding technology you can read or get the data from your data source and give it to your script or viewer for further data processing or visualization.

 

 

16.1                Binding Expressions

You need to define in your script file the following expression to get data:

 

{YourDataTableName }

This is expression works only if your project item has a data source connection. You will get the data table from your data source.

 

 

 

If your project item hasn’t any data source connection you can also get the data using full path of connection to a data source or project items.

 

 

{YourFullDataSourcePath}

 

 

 

16.2                Reading Data from Data Source

The binding can read the data from your database using expression. You can put the following expression instead of file name and the binding renderer will get it from database.

 

Data Binding Format:

{YourDataSource.TableName|format=csv..xml..json..html}"

The data source name can be DataSet name or script name.

 

 

Example: mydata <- read.csv(file="{MainDataSet.Invoices}", strip.white = TRUE)

Or

Example: mydata <- read.csv(file="{MainDataSet.Invoices|format=csv}", strip.white = TRUE)

 

16.3                Data Printing

It allows also print the data as an Array or other give formats in your script.

Data Binding Format:

<DataPrint PFormat="custom" Binding="Invoices">
Product Unit Price: {Binding Path=”UnitPrice”}
</DataPrint>

 

This will bind the “invoices” table and print the data table column “unitprice” as given print format (PFormat).

 

<DataPrint PFormat='custom'Source='Orders.dset' Binding='Orders' Sort="Price DESC">
{"period": {Binding path=period}, "licensed": {Binding path=licensed}, "sorned": {Binding path=sornedValue}},
</DataPrint>

 

 

PFormats (Print Format) are:

·         Custom or Json: prints the  template between DataPrint Elements.

·         Array: prints the data as an array srting [1,5,6,7…]

·         XML: print the given path as XML

·         CSV: prints the given path as CSV

·         HTML: prints the given path as HTML

 

VFormat (Value Format): The value format expression to to print values in correct format. In this case String.Format(format, obj);“ will be used to format the value. For more detailed formatting expression please see the .Net string formatting documentation.

 

16.4                         HTML Elements Binding

It allows you to bind the data to the following html elements: Table, UL

 

 

<table border='1'source="All_Employees.dset" binding="Employees"style="width:50%">
</table>

 

<table Border="1" Source='Orders.dset”  Binding="Orders" Sort="Price DESC" Style='margin:5px'>

</table>

 

 

This example bind the given data source (connection) with given table into a html table. The “Employees” table will be print as an html table.

16.4.1              ItemsControl

Nucleon BI has a wide range of controls for displaying a list of data. A casual glance at ItemsControl may not elicit much excitement, but behind its modest façade lays a wealth of power and flexibility.

 

This binding feature is used to print child elements with binding data source rows count. The ItemsControl is made for data binding, where we use a template to define how our data should be presented to the user.

 

<itemscontrol border='1' source="All_Employees.dset" binding="Employees">
<h1> Hello {Binding Path="LastName"}</h1>
<table border="1" width="600px">
<tr><td>Hello {Binding Path="LastName"}</td>
</tr>
</table>
</itemscontrol>

 

<ul>
<itemscontrol border='1'source="All_Employees.dset" binding="Employees" >
<li>Hello {Binding Path="LastName"}</li>
</itemscontrol>

</ul>

 

 

 

16.5                Reading Plots and Images

The binding get the plot and image results from your script executing into a dataset. You only need to write an filename expression. The script renderer catches this expression and read it later.

 

{FileNameToExport.png|title=My Title}

Example for R Script:  png(file="{scatter3D.png}", width=600, height=600, units='px', res=96)….

 

 

 

 

 


powered by Nucleon Software