Search the Community
Showing results for tags 'custom functions'.
Found 4 results
As most people here probably know, the Let ( ) function can be used to define a Local variable. As such, it is possible to build a custom function that defines such a variable, and it is further possible to set said variable to a value including itself. An example would be the following custom function, ErrorList, consisting of the following calculation: Let ( $ErrorList = List ( $ErrorList ; Get ( LastError ) ) ; "" ) If a Set Variable script step sets the same variable as a custom function like the one above, e.g. Set Variable [ $ErrorList ; Value: ErrorList ] …the script step will run appropriately, so long as the contradictory variable—in this case, $ErrorList—is not yet defined. However, once this variable has been defined, executing the preceding script step will cause FileMaker 14 (and perhaps other versions) to suffer an Error #1213 and crash the application. The workaround for this behavior is to have the Set Variable script step set a dummy variable, e.g. Set Variable [ $x ; Value: ErrorList ] Even if $x is not referenced anywhere, having a script call the ErrorList function passes the variable $ErrorList to the script’s own context, thus allowing its value to be accessed by later steps in the same script (including subsequent calls to the ErrorList function itself). In FileMaker 15, this behavior has been changed: local variables defined within a custom function are now valid only within the scope of the function itself, including any recursions. While this alleviates the problem of application crashes, it also results in unexpected behavior when scripts written in earlier versions of FileMaker rely on custom functions to set local variables. When migrating to FileMaker 15, each affected script step must be updated to set the target variable explicitly instead of relying on the custom function to do the work. In other words, the code: Set Variable [ $ErrorList ; Value: ErrorList ] …which proved fatal in FileMaker 14, is now required grammar for FileMaker 15: FileMaker 15 believes that what happens in the function stays in the function, instead returning the result of the calculation to the variable defined in the Set Variable script step. The FileMaker 14 grammar, Set Variable [ $x ; Value: ErrorList ] …thus sets $x to the intended value of $ErrorList while leaving the value of $ErrorList as null. Unfortunately, this cannot work effectively in a mixed-installation environment: the FileMaker 14 grammar leaves FileMaker 15 clients with unintended null values; the FileMaker 15 grammar causes FileMaker 14 to crash. When upgrading all users to FileMaker 15 is not feasible, the best workaround is to use the FileMaker 14 grammar, then once all relevant script steps are complete, check the value of the intended variable (e.g. $ErrorList) and, if empty, set it to the value of the dummy variable (e.g. $x). ErrorTest.fmp12
ThesisDesign posted a topic in Calculation Engine (Define Fields)Hi there I am on the hunt for a function or calculation that will operate like the native Extend () function but I need it to grab the data from another related REPEATING field instead for a non-repeating field which is the limit of the Extend () function. To give a bit of background on what I am doing, I have built a responsive image grid and a responsive notes grid very akin to the Facebook interface. I am at the finish line. The last thing I need to do is add "Edit" and "Delete" options to the bottom of each repetition in the portal (like a Facebook post). All other items in the grid are populated using the extend function and it works as it should of course because they are non-repeating unique data points. The structure is simple. I have a Contact table, a notesdisplayrows table, and a notes table. All data points are calculated in the displayrows table. Example: GetNthRecord (Extend(CONTACTS_NOTESGRID::ID); Get(CalculationRepetitionNumber)) However, where the "Edit" and "Delete" options are concerned I need something that will grab both the 1st and 2nd repetition of a field so that they will display as lower menu options for each repetition (I.e. Facebook). I currently have a repeating field in the notes (notesgrid) table and the 1st rep is "Edit" and the 2nd rep is "Delete". Any suggestions?
I am interested in creating a custom function that would allow a user to apply a function to every value in a list. It would look something like this: applyFunction2List ( myList ; "function" ) ... where 'myList' is a text field with return-delimited values, and "function" is a text expression of a user-specfied function. For example, applyFunction2List ("1¶2¶3" ; "[value] * 2" ) would return: "2¶4¶6" I've tried working and modifying CustomFunction() and SubstituteManyWithCalclation(), without much success, but I admit I'm baffled by recursive functions. Any tips would be appreciated.
Hello Everyone; here is another 4 part series in the article written by FMweetbicks using a custom function to truncate a list. here is the article: Simple Truncated Displaying of Long Lists (+more) And here are my videos. enjoy, -ian LINKS: Archive.zip