This document (including, without limitation, any product roadmap or statement of direction data) illustrates the planned testing, release and availability dates for Spotfire products and services. It is for informational purposes only and its contents are subject to change without notice. Planning to implement - generally 6-12 months out. Likely to Implement - generally means 12-18 months out.
Copyright © 2014-2023 Cloud Software Group, Inc. All Rights Reserved.
Cloud Software Group, Inc. ("Company") follows the EU Standard Contractual Clauses as per the Company's Data Processing Agreement.
Terms of Use |
Privacy Policy |
Trademarks |
Patents |
Contact Us
Perfect! It used to be a hassle to have to provide all the parameters before through the Insert JavaScript dialog. Now I can have a JavaScript with multiple parameters and leave them blank those without being forced to enter them.
Scripts in a text area are globally accessible in a way that your question implies. These scripts are wrapped inside an IIFE (https://developer.mozilla.org/en-US/docs/Glossary/IIFE) and is therefore run once and then disposed. If you want to create a global function as the one in the example below this can easily be done manually.
This script snippet adds a global function multiply, with a configurable parameter 'defaultvalue' when the text area script is invoked. This will be accessible globally as it is stored on the global window object. Note that all JavaScript parameters are strings, hence the parseInt. These parameters are also added when the text area is being initially rendered.
When creating a JavaScript on a text area and you want the user to provide some parameters, for example the background color or a masthead that is going to be used across many pages. If you add a JavaScript parameter, say bgColor and you use this script everywhere, then you need to add the background color on all scripts. Otherwise the script engine from Spotfire complains about a "required parameter". If no parameter is specified, then just take a default value.
In other words, it would be nice to be able to implement the following code:
function multiply(a, b = 1) {
return a * b;
}
console.log(multiply(5, 2));
// expected output: 10
console.log(multiply(5));
// expected output: 5
Please provide more details.