The best AppML Case Model Tutorial In 2024, In this tutorial you can learn
Application Model,<AppML> Filters,Example:,<AppML> Update,Example:,Example:,<AppML> Security,Example:,Example:,Customers complete model,Model: Customers.xml,Model View,Views: Demo_Model.htm,Now all merged together,Demo_Model_Views.htm,
AppML Case Model
This case study demonstrates how to build a complete <AppML> Internet applications, with information listed for a number of tables in the database, edit and search functions.
Application Model
In this chapter, we will be in the database Customers table to create a complete application model.
<AppML> Filters
To allow filtering <AppML> data, simply add a <filters> element to the model:
Example:
<filters>
<query>
<field label="Customer">CustomerName</field>
<field>City</field>
<field>Country</field>
</query>
<order>
<field label="Customer">CustomerName</field>
<field>City</field>
<field>Country</field>
</order>
</filters>
For a full, see <AppML> Reference Manual .
<AppML> Update
To allow updates <AppML> data, simply add a <update> element to the model:
Example:
<update>
<item><name>LastName</name></item>
<item><name>FirstName</name></item>
<item><name>BirthDate</name></item>
<item><name>Photo</name></item>
<item><name>Notes</name></item>
</update>
And add a <maintable> and <keyfield> element to the <database> element:
Example:
<maintable>Customers</maintable>
<keyfield>CustomerID</keyfield>
For a full, see <AppML> Reference Manual .
<AppML> Security
You can add a security label attribute to <AppML> come easily to <AppML> add security model.
Example:
<appml
security="admin" >
In the example above, only the user logs in as a user group "admin" of Members to access model.
For the <update> element to set security, simply add a security attribute to the <update> element:
Example:
<update
security="admin" >
<item><name>LastName</name></item>
<item><name>FirstName</name></item>
<item><name>BirthDate</name></item>
<item><name>Photo</name></item>
<item><name>Notes</name></item>
</update>
Customers complete model
In this chapter, we will set up a database for each table in an application model.
Create a new folder called Models. In the Models folder, create a model for each application.
Model: Customers.xml
<appml security="">
<datasource>
<database>
<connection>Demo</connection>
<maintable>Customers</maintable>
<keyfield>CustomerID</keyfield>
<sql>SELECT * FROM Customers</sql>
<orderby>CustomerName,City,Country</orderby>
</database>
</datasource>
<filters>
<query>
<field label="Customer">CustomerName</field>
<field>City</field>
<field>Country</field>
</query>
<order>
<field label="Customer">CustomerName</field>
<field>City</field>
<field>Country</field>
</order>
</filters>
<update security="admin">
<item><name>CustomerName</name></item>
<item><name>ContactName</name></item>
<item><name>Address</name></item>
<item><name>PostalCode</name></item>
<item><name>City</name></item>
<item><name>Country</name></item>
</update>
</appml>
Model View
Create a model view, save it as Demo_Model, and try it out:
Views: Demo_Model.htm
<h1>Customers</h1>
<div id="List01"></div>
<script src="appml.js"></script>
<script>
customers=new
AppML("appmlx","Models/Customers");
customers.run("List01");
</script>
Now all merged together
Then, a small amount of JavaScript code, create a test page for all models:
Demo_Model_Views.htm
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet"
href="appml.css" />
</head>
<body>
<h1>Demo Applications</h1>
<button onclick='myOpen("Customers")'>Customers</button>
<button
onclick='myOpen("Products")'>Products</button>
<button
onclick='myOpen("Suppliers")'>Suppliers</button>
<button
onclick='myOpen("Shippers")'>Shippers</button>
<button
onclick='myOpen("Categories")'>Categories</button>
<button
onclick='myOpen("Employees")'>Employees</button>
<button
onclick='myOpen("Orders")'>Orders</button>
<button
onclick='myOpen("OrderDetails")'>OrderDetails</button>
<br><br>
<div id="Place01"></div>
<script src="appml.js"></script>
<script>
function myOpen(pname)
{
var app_obj
app_obj=new
AppML("appml.php","Models/" + pname);
app_obj.run("Place01");
}
</script>
</body>
</html>
Showing results »