Multiple if/end blocks.
Seems like a bad idea to have one java script call try and execute multiple FM scripts. Having said that I would not expect it to fail, both scripts should show up in the stack when you have the script debugger enabled.
It might initially seem like a bad idea, however I don't believe it is.
The solution is very robust (complex) and used in a high paced enviornment.
There are two basic reasons why I decided not to send all commands to filemaker in a single script:
1) modularity: it is much easier to maintain and expand upon the solution with this flexibility by having chunks of code that do distinct things, much like you have subscripts in FM.
2) pace of use: the fact that a user might click a button withing fractions of a second of eachother sending separate commands to FM makes me need to solve this problem even if sent all commands to FM in a single script, because separate button clicks would trigger multiple calls anyway.
1 of 1 people found this helpful
When I read your post I had thoughts similar to what Wim has said. While I appreciate the modularity offered by what you are doing, I am suspicious of potential log-jams that could happen when the pace of use is fast.
My sense is that running multiple successive calls using the FM url from the same HTML page could fail due to a subsequent call pre-empting a previous call before the browser has even sent the first request.
Should this be the case, it isn't the case that FM is failing to act on the first call, it simply so happens that the first call never even happens.
If you think that this theory potentially has merit, one thing that you might try would be to use a more robust method for calling the URLs. Specifically, instead of using the window.location method to invoke a URL, you might see how it works out to try invoking the URL via an Ajax type of methodology. If I were trying this, I think that the first thing I would check out would be the jQuery API documentation for Ajax functionality, and set up a test environment which uses this to trigger the URLs instead of window.location.
Hope this helps and good luck!
I agree that the issue is probably in the webviewer (browser) and not su much in Filemaker. If FM does get the call, it should appear in the stack.
AJAX is probably more what I might be looking for. I did some initial tests and was unsuccesful.
I was using the MBS plugin to make the calls before having to migrate to the FMP URL. Unfortunately the technique used with the MBS plugin for the MBS("WebView.InstallCallback") function is not compatible with ie10 and the solution must be compatible with ie10...
1 of 1 people found this helpful
Thanks for the further details.
In thinking about this today I realized I wanted to run an idea by you:
Since you already were working with the MBS plugin, I wonder if you have considered using it in a different fashion.
I believe that the MBS plugin allows you to invoke a FM script from within the calculation engine. As this particular feature is not tied to browser functionality, I suspect that it will be available to you in your environment.
In particular, the benefit of this function is that it opens the door to allowing you to retain the modularity of your system which you wish to preserve, while at the same time considering an approach hinted at by Wim's post, namely, having a FM "dispatch" script which is engaged solely for the purpose of:
- receiving the click callbacks from the browser/webviewer
- queuing up any new requests -- (adding the newest requests to the end of the queue)
- dispatching the scripts which are in the queue, starting at the top of the queue, and working down until the end of the queue has been reached
The "invoke script by name" type of functionality afforded by using the plugin should allow you to retain your modularity, while being able to implement your own dispatch script might give you the control that you need to be able to mitigate the behavior you've observed with the FMP URL whereby the most recent URL-invoked script jumps to being second in line in the stack.
I hope perhaps the above may be useful to you as you work on this and consider various ideas. Please let me know if I should clarify any of it.
Very best and good luck,
p.s. Also, one issue that would require some research would be getting used to how scripts invoked by MBS via the calculation engine wind up queued in the stack.
Message was edited by: steve_ssh. Corrected some spelling errors.
Great ideas Steve, thanks for the input!