Date Posted:
Product: TIBCO Spotfire®
Product: TIBCO Spotfire®
Problem:
How to set preferences from the command line in TIBCO Spotfire
Solution:
Starting with TIBCO Spotfire 10.9, preferences for a group can be set using the command line (CLI) config tool. This is required in cases when you are looking to set the preferences for multiple groups through a script instead of manually setting the same preferences for each group. This is achieved using the "set-preference" command. More information on command parameters can be seen here.
In this example, the Administrator group preference will be set for the BarChart category "LabelOrientation" (Tools > Administration Manager > Preferences for BarChart category > LabelOrientation). The value for the preference that needs to be set has to be in base64 encoded format.
Step 1: Get the base64 encoded value for the preference value
To get the correct base64 value, you can follow either of the approach:
Option 1: CLI Approach
Use the "show-preference" command in the CLI to get the preference value (Go to Spotfire Server machine > Launch cmd > cd to <Spotfire Installation Path>/spotfire-bin). Note here that type will be in the form of version and preference name.
config show-preference --group=Administrator --category=BarChart --type=1.0###BarChartPreferences --name=LabelOrientationOutput of above command:
PreferenceKeycategoryName=BarChart,name=LabelOrientation,typeName='1.0###BarChartPreferences' of type Raw for group Administrator[fed6b2b0-a9e1-11da-8ed2-0010ac110222] have the value:
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48Um9vdCB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hLWluc3RhbmNlIiB4bWxuczp4c2Q9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hIiB4bWxucz0iaHR0cDovL3d3dy5zcG90ZmlyZS5jb20vc2NoZW1hcy9Eb2N1bWVudDEuMC54c2QiIFNjaGVtYVZlcnNpb249IjEuMCI+PE9iamVjdCBJZD0iMSI+PFR5cGU+PFR5cGVPYmplY3QgSWQ9IjIiIEFzc2VtYmx5TmFtZT0iU3BvdGZpcmUuRHhwLkFwcGxpY2F0aW9uLCBWZXJzaW9uPTQ1LjAuMTQ3MDguNTIzNywgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03ODk4NjE1NzZiZDY0ZGM1IiBGdWxsVHlwZU5hbWU9IlNwb3RmaXJlLkR4cC5BcHBsaWNhdGlvbi5WaXN1YWxzLkxhYmVsT3JpZW50YXRpb24iPjxOb25TeXN0ZW1UeXBlSW5mbz48UGVyc2lzdGVuY2VWZXJzaW9uIE1ham9yPSIyIiBNaW5vcj0iMCIgLz48QmFzZVR5cGU+PFR5cGVPYmplY3QgSWQ9IjMiIEFzc2VtYmx5TmFtZT0ibXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5IiBGdWxsVHlwZU5hbWU9IlN5c3RlbS5FbnVtIiAvPjwvQmFzZVR5cGU+PC9Ob25TeXN0ZW1UeXBlSW5mbz48L1R5cGVPYmplY3Q+PC9UeXBlPjxGaWVsZHM+PEZpZWxkIE5hbWU9InZhbHVlX18iPjxJbnQgVmFsdWU9IjEiIC8+PC9GaWVsZD48L0ZpZWxkcz48L09iamVjdD48L1Jvb3Q+
Option 2: Database Approach
Execute the below script on TIBCO Spotfire database to get a list of preferences set:
select Groups.DISPLAY_NAME, Keys.CATEGORY_NAME, Keys.CLASS_TYPE, Keys.PREFERENCE_NAME, Values.PREFERENCE_VALUE, Values.LAST_MODIFIED from PREFERENCE_VALUES Values inner join PREFERENCE_KEYS Keys on Values.PREFERENCE_ID = Keys.PREFERENCE_ID inner join GROUPS Groups on Values.GROUP_ID = Groups.GROUP_ID
Once the value is retrieved in base64 format, proceed with below steps.
Step 2: Apply the preference value
1. Set preference from CLI for Administrator group. Copy the value retrieved from the above steps. The value type needs to be raw here as we are simply selecting value from dropdown instead of string (where we enter string value):config set-preference --group=Administrator --category=BarChart --type=1.0###BarChartPreferences --name=LabelOrientation --value-type=raw --value=PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48Um9vdCB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hLWluc3RhbmNlIiB4bWxuczp4c2Q9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hIiB4bWxucz0iaHR0cDovL3d3dy5zcG90ZmlyZS5jb20vc2NoZW1hcy9Eb2N1bWVudDEuMC54c2QiIFNjaGVtYVZlcnNpb249IjEuMCI+PE9iamVjdCBJZD0iMSI+PFR5cGU+PFR5cGVPYmplY3QgSWQ9IjIiIEFzc2VtYmx5TmFtZT0iU3BvdGZpcmUuRHhwLkFwcGxpY2F0aW9uLCBWZXJzaW9uPTQ1LjAuMTQ3MDguNTIzNywgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj03ODk4NjE1NzZiZDY0ZGM1IiBGdWxsVHlwZU5hbWU9IlNwb3RmaXJlLkR4cC5BcHBsaWNhdGlvbi5WaXN1YWxzLkxhYmVsT3JpZW50YXRpb24iPjxOb25TeXN0ZW1UeXBlSW5mbz48UGVyc2lzdGVuY2VWZXJzaW9uIE1ham9yPSIyIiBNaW5vcj0iMCIgLz48QmFzZVR5cGU+PFR5cGVPYmplY3QgSWQ9IjMiIEFzc2VtYmx5TmFtZT0ibXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5IiBGdWxsVHlwZU5hbWU9IlN5c3RlbS5FbnVtIiAvPjwvQmFzZVR5cGU+PC9Ob25TeXN0ZW1UeXBlSW5mbz48L1R5cGVPYmplY3Q+PC9UeXBlPjxGaWVsZHM+PEZpZWxkIE5hbWU9InZhbHVlX18iPjxJbnQgVmFsdWU9IjEiIC8+PC9GaWVsZD48L0ZpZWxkcz48L09iamVjdD48L1Jvb3Q+
2. Go to TIBCO Spotfire Analyst > Tools > Administration Manager > Preferences tool to check if preference is set. Click on Administrator group in Preferences, you will see LabelOrientation is now set to vertical.
Note:
- If any of the values for parameters like type,value-type etc. are invalid, it will not show error and that preference would be created. Same can be seen in Preference Values table in TIBCO Spotfire database.
- If an invalid value (in base64 encoded format) for the valid preference is set using CLI command, then the installed Analyst client will crash/disappear on clicking that preference from Tools > Administration Manager > Preferences. This bug will be fixed in future release.
Comments
0 comments
Article is closed for comments.