Script patterns – Test then act (cont.)
|
Yesterday we detailed two scripts that would solve the problem presented – test for the FileMaker client being used, and navigate to a specific layout designed for the client. Today we will try to find other ways to solve the problem. When working through alternate solutions we must bear in mind that there are no wrong answers — just solutions of variable quality and fit. #3: Run a subscript for layout navigationThis solution aims to put all the layout navigation code into a script that is then called whenever needed. This is done by adding the following to any script that needs to use the client layout navigation:
The subscript (Navigate to Client Layout) is:
#4: Use a layout routing tableThis solution uses a routing table which stores the client and target layout value pairs in JSON.
The calculation used for $client is as for #2:
The calculation used for $routing is:
This structure means that the layout name does not have to match the client name (as in #2). Although there is still a layout name dependency, the layout name is more flexible. Which one works for you?We have come up with four different solutions to our problem – one more than required because we are overachievers! The next step, which we will go through tomorrow, is to assess each solution and decide on the "best" one for us.
|