Hi, everyone and happy easter,
Using piclists, you can set them to to Document, so that you can access them from every form. is there somehow a possibility to make the same with functions?
i have several function, which I need to use in several forms. actually I copy them to each script I need it in. Is there some way to declare it onetime and use from every script?
Greetings 🐣
Steve
Yes, there’s the runScriptNamed('common functions') command. This will execute the named script. If such a script only contains functions and definitions, then they will be directly accessible from you script. But if the script contains a function call, it would be executed too.
To prevent that, I use following structure at the end of the file:
if (!scriptName == "common functions"){
// function call to entry point of script
main();
} else {
console.log("Script " + scriptName + " loaded");
}
For a document script use document.runScriptNamed('common functions') and for a form script use document.getFormNames('script form').runScriptNamed('common functions').
As you see, you can put scripts in a common form where you can pull them from. I do this with my scriptHandler helpers.
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks