
Function: Compiling using literal source code in the calculation
In FileMaker, multi-line text literals do not contain line separators; they consist of just a single space character.
To work around this,
Create a script step:
Insert Text
. ChooseSelect
, and for target checkVariable
, and name it$$Source
for example. Below the variable, a text field comes up where you can paste in the source code found in "bootstrap.acf". In this way, the text is pasted as-is, and there is not removed any linebreaks from it.Then a second script step,
Set Variable
, and$res
, and the formula isACF_Compile($$Source)
If [ ACF_run("bootstrap_AreWeLoaded") ≠ "Yes" ]
Insert Text ( Select; $$Source; 'package bootstrap "Functions to facilitate..."')
Set Variable [ $res; Value:ACF_Compile( $$Source ) ]
End If
Here is some images:
In this example, we demonstrate how to prepare source code for the "bootstrap" package using the ACF_Compile
function.
In the demo files, you can find a similar statement in the startup script. This is especially helpful when many buttons and scripts rely on the "bootstrap" package. Having it in place from the start simplifies the implementation in a target application.
By following this approach, you can include source code directly in your calculations while ensuring proper handling of line separators, quotes, and backslashes.