|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="jsdbe.js">
</script>
<script type="text/javascript">
var ds = null;
function testEngine()
{
ds = new DataSet("Test Database.xml", true, onLoadFinished);
}
function onLoadFinished()
{
ds.Tables[0].HeaderStyle = "font-weight : bold; text-align : center; background-color : lightgray; border : solid 1px;";
ds.Tables[0].BodyStyle = "text-align : center; border : solid 1px;";
ds.Tables[1].HeaderStyle = "font-weight : bold; text-align : center; background-color : lightgray; border : solid 1px;";
ds.Tables[1].BodyStyle = "text-align : center; border : solid 1px;";
ds.Tables[0].updateTable("Customers");
ds.Tables[0].updateComboBox("Customers_Selected", "Name");
ds.Tables[1].updateTable("Companies");
ds.Tables[1].updateComboBox("Companies_Selected", "Name");
var dtCustomersCompanies = ds.Tables[0].joinTable(ds.Tables[1], "Id", "CompanyId");
dtCustomersCompanies.updateTable("Customers_Companies");
dtCustomersCompanies.sortTable("Person.Amount", true);
dtCustomersCompanies.updateTable("Customers_Companies_Sorted");
var dtCustomersCompaniesFiltered = dtCustomersCompanies.where("Person.Amount < 200,000.00").where("Person.Age > 20").where("Person.Currency = USD");
dtCustomersCompaniesFiltered.updateTable("Customers_Companies_Filtered");
var dtCustomersCompaniesSelected = dtCustomersCompanies.select("Person.Name, Person.Age, Person.City, Person.Amount, Person.Currency, Company.Name").where("Company.Name = Microsoft")
dtCustomersCompaniesSelected.sortTable("Person.City", false);
dtCustomersCompaniesSelected.updateTable("Customers_Companies_Selected");
dtCustomersCompanies.groupTable("Company.Name");
dtCustomersCompanies.updateTable("Customers_Companies_Groupped");
var dtCustomersCompaniesSummed = dtCustomersCompanies.sum("Person.Amount");
dtCustomersCompaniesSummed.updateTable("Customers_Companies_Summed");
var dtCustomersCompaniesCounted = dtCustomersCompanies.count("Person.Amount");
dtCustomersCompaniesCounted.updateTable("Customers_Companies_Counted");
var dtCustomersCompaniesMinimum = dtCustomersCompanies.min("Person.Amount");
dtCustomersCompaniesMinimum.updateTable("Customers_Companies_Minimum");
var dtCustomersCompaniesMaximum = dtCustomersCompanies.max("Person.Amount");
dtCustomersCompaniesMaximum.updateTable("Customers_Companies_Maximum");
var dtCustomersCompaniesAverage = dtCustomersCompanies.avg("Person.Amount");
dtCustomersCompaniesAverage.updateTable("Customers_Companies_Average");
var dtCustomersCompaniesDistinct = dtCustomersCompanies.distinct("Person.Currency");
dtCustomersCompaniesDistinct.updateTable("Customers_Companies_Distinct");
}
</script>
<title>JavaScript Database Engine</title>
</head>
<body onload="testEngine();" style="font-family: Verdana; font-size: 10pt">
<table id="Customers" width="50%" border="0" style="border: solid 1px; border-collapse: collapse;"></table>
<br />
<table id="Companies" width="50%" border="0" style="border: solid 1px; border-collapse: collapse;"></table>
<br />
<select id="Customers_Selected"></select>
<select id="Companies_Selected"></select>
<br />
<br />
<table id="Customers_Companies" width="50%" border="0" style="border: solid 1px; border-collapse: collapse;"></table>
<br />
<table id="Customers_Companies_Sorted" width="50%" border="0" style="border: solid 1px; border-collapse: collapse;"></table>
<br />
<table id="Customers_Companies_Filtered" width="50%" border="0" style="border: solid 1px; border-collapse: collapse;"></table>
<br />
<table id="Customers_Companies_Selected" width="50%" border="0" style="border: solid 1px; border-collapse: collapse;"></table>
<br />
<table id="Customers_Companies_Groupped" width="50%" border="0" style="border: solid 1px; border-collapse: collapse;"></table>
<br />
<table id="Customers_Companies_Summed" width="50%" border="0" style="border: solid 1px; border-collapse: collapse;"></table>
<br />
<table id="Customers_Companies_Counted" width="50%" border="0" style="border: solid 1px; border-collapse: collapse;"></table>
<br />
<table id="Customers_Companies_Minimum" width="50%" border="0" style="border: solid 1px; border-collapse: collapse;"></table>
<br />
<table id="Customers_Companies_Maximum" width="50%" border="0" style="border: solid 1px; border-collapse: collapse;"></table>
<br />
<table id="Customers_Companies_Average" width="50%" border="0" style="border: solid 1px; border-collapse: collapse;"></table>
<br />
<table id="Customers_Companies_Distinct" width="50%" border="0" style="border: solid 1px; border-collapse: collapse;"></table>
</body>
</html>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
He has a master degree in Computer Science at Faculty of Electronics in Nis (Serbia), and works as a C++/C# application developer for Windows platforms since 2001. He likes traveling, reading and meeting new people and cultures.