DroidDB Tip of the Month
DroidDB® Tip for November 2012
Dividing a Table Among Different Handhelds
Say you have a table on the desktop/server called MyTable. Say you have three handhelds named Alpha, Beta, and Gamma (the handhelds are identified by the name specified in FILE | HANDHELD NAME). You can set things up so some of the records in MyTable are synchronized with Alpha, some with Beta, and a some with Gamma.
Normally MyTable on the handheld would synchronize to MyTable on the desktop/server. But you can set things up so MyTable on Alpha synchronizes to Alpha_MyTable on the desktop/server, MyTable on Beta synchronizes to Beta_MyTable on the desktop/server, and MyTable on Gamma synchronizes to Gamma_MyTable on the desktop/server. Please note the naming convention: the handheld name, followed by an underscore, followed by the table name.
Furthermore, Alpha_MyTable, Beta_MyTable, and Gamma_MyTable do not have to be tables. They can be views (MS Access calls these "queries") so long as they are updatable views. And these views can be views over MyTable.
You can define these three views to include or not include whatever records you want. Most likely, there will be a column (perhaps called Owner) in MyTable specifying which handheld the record belongs to. In the records for the Alpha handheld, Owner would be set to "Alpha"; in the records for the Beta handheld, Owner would be set to "Beta"; in the records for the Gamma handheld, Owner would be set to "Gamma". You then define the Alpha_MyTable view (query) to be those records with Owner set to "Alpha", the Beta_MyTable view (query) to be those records with Owner set to "Beta", and the Gamma_MyTable view (query) to be those records with Owner set to "Gamma".
So, all that is left to do is to convince the Visual CE synchronizer to synchronize MyTable on the handheld to Alpha_MyTable, Beta_MyTable, or Gamma_MyTable on the desktop/server (depending on which handheld is being synchronized). Here's how to do this:
- Create MyTable in the desktop/server database.
- Use DroidDB and download MyTable to one of the handhelds (FILE | DOWNLOAD TABLE).
- Create a form over MyTable.
- Give each handheld a unique name (using FILE | HANDHELD NAME).
- Create the views (queries) in the desktop/server database (being sure to use the <handheld-name>_<table-name> naming convention).
- Turn on the name mapping. You do this by editing a file in the Application Folder
called <<MyApplication>>.INI using a text editor such as notepad. Change
[VICESYNC]
to[VICESYNC]
QualifyByDevice=1