In this lesson, you use the Create Project Wizard to create a new MobiLink project. The Create Project Wizard also creates a synchronization model using the defaults, which can be edited later.
Prérequis
This lesson assumes you have the roles and privileges listed in the Privileges section at the start of this tutorial: Tutorial: Using MobiLink with a SQL Anywhere consolidated database.
This lesson assumes you have completed all preceding lessons. See Lesson 1: Designing the schemas.
In Sybase Central, click Tools » MobiLink 16 » New Project.
The Create Project Wizard appears.
In the What do you want to name the new project field, type mlsqla_project.
In the Where do you want to save the new project field, type C:\mlsqla, and click Next.
In the Database display name field, type demo.
Click Edit.
Perform the following tasks in the Connect To A Generic ODBC Database page:
In the ODBC Data Source name field, click Browse and choose SQL Anywhere 16 Demo.
Click OK, and click Save.
Select the Remember the password option, and click Next.
On the New Remote Database Schema page, in the Which consolidated database tables and columns do you want to have in your remote database list, select the following tables:
Click Next.
Select the Add a remote schema name to the project option.
In the What do you want to name the new remote schema field, type mlsqla_remote_schema and click Next.
Choose UltraLite for the Which type of remote database do you want to use option and click Finish.
Click Yes when you are prompted to install the MobiLink setup scripts.
Click Yes if you are prompted to import the remote schema.
Click OK.
Right-click the new synchronization model and choose Properties.
Type sync_mlsqla in the first field.
Type sync_mlsqla_publication in the Publication name field.
Type sync_mlsqla_scriptversion in the Script version field.
The publication is the object on the remote database that specifies what data is synchronized. MobiLink server scripts define how uploaded data from remotes should be applied to the consolidated database, and how script versions group scripts. You can use different script versions for different applications, allowing you to maintain a single MobiLink server while synchronizing different applications.
Click Apply and then click OK.
Perform the following tasks in the right pane of Sybase Central:
Click the Events tab.
Update the CustomerProducts download cursor to only download customer products for customers in the Eastern region.
Replace the existing SQL script for the download_cursor event for the CustomerProducts table with the following query:
SELECT "DBA"."CustomerProducts"."ID", "DBA"."CustomerProducts"."SalesOrderID", "DBA"."CustomerProducts"."CustomerID", "DBA"."CustomerProducts"."ProductID" FROM "DBA"."CustomerProducts" INNER JOIN "GROUPO"."Customers" ON "GROUPO"."Customers"."ID" = "DBA"."CustomerProducts"."CustomerID" WHERE "GROUPO"."Customers"."Region" = 'Eastern'; |
Update the download cursor for the Customers table to only download customer information from the Eastern Region.
Replace the existing SQL script for the download_cursor event for the Customers table with the following query:
SELECT "GROUPO"."Customers"."ID", "GROUPO"."Customers"."Surname", "GROUPO"."Customers"."GivenName", "GROUPO"."Customers"."Street", "GROUPO"."Customers"."City", "GROUPO"."Customers"."State", "GROUPO"."Customers"."Country", "GROUPO"."Customers"."PostalCode", "GROUPO"."Customers"."Phone", "GROUPO"."Customers"."CompanyName", "GROUPO"."Customers"."Region" FROM "GROUPO"."Customers" WHERE Region = 'Eastern'; |
Update the SalesOrders download cursor to only download sales order information for customers in the Eastern region.
Replace the existing SQL script for the download_cursor event for the SalesOrders table with the following query:
SELECT "GROUPO"."SalesOrders"."ID", "GROUPO"."SalesOrders"."CustomerID", "GROUPO"."SalesOrders"."OrderDate", "GROUPO"."SalesOrders"."FinancialCode", "GROUPO"."SalesOrders"."Region", "GROUPO"."SalesOrders"."SalesRepresentative" FROM "GROUPO"."SalesOrders" WHERE "GROUPO"."SalesOrders"."Region" = 'Eastern' AND "GROUPO"."SalesOrders"."ID" IN (SELECT "DBA"."CustomerProducts"."SalesOrderID" FROM "DBA"."CustomerProducts"); |
Save the synchronization model.
Click File » Save.
The synchronization model is complete and ready for deployment.
![]() |
Discuter à propos de cette page dans DocCommentXchange.
|
Copyright © 2013, SAP AG ou société affiliée SAP - SAP Sybase SQL Anywhere 16.0 |