GoZync4

Retrieving Account Names

Background

The best mobile solutions present users with just the data they need at any given time. So if you want your mobile solutions to be truly fast, you need to sync just a subset of your hosted data down to your mobile files. We call this "filtering" and this is how you bring down just one user's records, or just their active records. The more specific the better: you can read more about how GoZync lets you use Find Requests to do this here: downloading found sets.

A crucial part of many of these find requests is determining who is using the system so you can pull down just their records. Advanced developers will have many different approaches to this, but GoZync makes two methods particularly easy.

Methods

1. Write a script in your hosted file. (Preferred)

Because the "Filter Records to Zync" script--the script that need to know the user's account name-- is in GoZyncMobile, you need a way to pass the logged in Account Name back to GoZyncMobile.

The easiest way to do this is to make a simple script in your hosted file that returns simply returns Get (AccountName ) as the result in an Exit Script step. You'll see just such a script in our example file QuickContactHosted.fmp12

Then call this script from GoZyncMobile at the beginning of the "Filter Records to Zync" script. Again, you'll find this already done in "Filter Records to Zync", though the routine is switched off by default. Switch it on by turning 1=0 to 1=1 in the If() line following the comment "Retrieve the logged in Account Name from the hosted files." You'll have the user's account name in the variable "gz_AccountName" to use in your PerformFind() script steps.

2. Add matching accounts to GoZyncMobile.

Alternately, you can create accounts and passwords in GoZyncMobile that match those in your hosted files. Since GoZyncMobile is distributed to your mobile users, we think this is kind of hard to maintain, and maybe not the most prudent approach, but it certainly makes it easy to get the user's Account Name: simply set a variable to Get ( AccountName ) toward the beginning of the script "Filter Records to Zync" in GoZyncMobile. Then use this variable in that script's find requests.

(855) SEEDCODE
[email protected]
Follow us: