Many years ago (pre FM 16) we built a Help Request system including a dedicated (HelpRequest.fmp12 File) that we call from multiple files, passing in a dictionary of name value pairs based on Get ( Functions ), a few Design Functions, and a script comment (polyfill).
Pre FM 16, we used (Six Friend Rice) SFR to build the dictionary. We did not use a Custom Function (CF) to wrap the dictionary (in order to make the code more portable). Probably should have committed to using a custom function.
We distributed the code based on Scope (Script, File_Layout, or Application/Session) between the calling Scripts, a few Scripts local to the file, and a few Scripts in the HelpRequest File.
We are in the planning stage of refactoring the code to:
- Switch from SFR to JSON
- DRY out the code by using a CF in the calling Scripts
- Possibly adding or removing some of the values gathered in the calling Script.
Because we have some customers still on FMS 18, the plan is to use the features up to FM 16, which should be both safe and sufficiently helpful. Because we are DRYing out code into Custom Functions, moving up to higher versions will be relatively easy.
Below is the "before" Custom Function done, as you can see, using SFR. We are going to update the name of the fields where the Function name has changed.
Please note that "scriptID" is a CF. Should it be renamed to @scriptID? Vote!
Question 1: What would you name this function?
- scriptParams or @scriptParams?
- helpRequestParam or @helpRequestParam?
- Other?
Question 2: Are there any values with Script scope that you would add to the CF?
As for passing the param (name value pairs) into the HelpRequest, do you prefer Method #1 (line 42) or method #2 (lines 45-46)?
(we would of course use only one)
People might also want to look at this related post and comments...
Thoughts?