Oct 21, 2016

Executing Python Script based on Marking Selection

Suggested by Tibco

http://bispotfire.blogspot.se/2015/06/executing-python-script-based-on.html


Aug 25, 2016

Selected value in Spotfire multi select property control using JQuery



$("#1f26c088453c4877a82e02b276e6fdf1").val("Select").change(); 

Aug 8, 2016

JQuery to validate Spotfire Multiselect control and limit MultiSelect with JQuery alert

$("#1f26c088453c4877a82e02b276e6fdf1").change(function()
{
var type1= $("#e8b0e6f9534f4e4c9eb263d3696b367c").text();
var type2= $("#1f26c088453c4877a82e02b276e6fdf1 option:selected").text();
var options = $('#1f26c088453c4877a82e02b276e6fdf1 > option:selected');
         if(options.length > 3){
             alert('We currently provide a comparison for three types.  You have selected more than three; therefore you will need to update your selections in order to move forward.');
             return false;
         }

if(type2.indexOf(type1)>-1){

             alert('One of your selections is the same type as your main selection. Please select a different type to compare.');
$('#1f26c088453c4877a82e02b276e6fdf1').val("0");
             return false;
         }

    });




   

Show/hide spotfire controls using JQuery


$("#c8b6b12144864ec5889005c6260a4b08").show();


$("#c8b6b12144864ec5889005c6260a4b08").hide(); 


$("#7ca7ef3c797e494ebddb881bf6008641").click(function()
{
$("#7ca7ef3c797e494ebddb881bf6008641").hide(); 
    });

Aug 5, 2016

Wrap the text in spotfire cross table chart

RXReplace([txt_column],"(.{1,65})( +|$\n?)|(.{1,65})","$1\r\n","g")

Aug 4, 2016

Compare label value with drop down list selected value using JQuery script in Spotfire

$("#ce490455e9f2484eb8554b5d2c8b3e96").change(function()
{
var date1= $("#9593584a2feb42caa8c321d16286a8fa").text();
var date2= $("#ce490455e9f2484eb8554b5d2c8b3e96 option:selected").text();
//var x =$("select[name='#ce490455e9f2484eb8554b5d2c8b3e96'] option:selected").value;

if(date1==date2){
             alert('Same date has been selected to compare');
             return false;
         }
    });

Spotfire Popup message with JS/javascript

Text area:

test




JS script:
$("#ada5d101fe90415aa047b7f47bb2d97e").click(showDialog);

function showDialog(){
   //change the title attribute since we can't in html editor
   $("#dialog").prop({title:'Rapid Security Analyzer Assumptions'}).dialog();
};


Aug 3, 2016

select spotfire lable value in javascript

$("#ce490455e9f2484eb8554b5d2c8b3e96").change(function()
{
var effecttivedate1= $("#31ff838711e24ca395dd9311413c298e").text();
alert(effecttivedate1);
}

Aug 1, 2016

Shell script to copy files around

function Copy-AssetLocally([PSObject] $DeploymentParameters)
{
Show-ConfirmationDeployAsset -DeploymentParameters $DeploymentParameters

if (-not (Read-Confirmation)) { return; }

Write-Host "Copy Asset to directory." -ForegroundColor $InfoColor
New-Item -Path $DeploymentParameters.TargetDirectory -ItemType Directory -ErrorAction Ignore

Copy-Directory `
-SourceDirectory $DeploymentParameters.SourceDirectory `
-TargetDirectory $DeploymentParameters.TargetDirectory

Write-Host "Done!" -ForegroundColor $InfoColor
}

Jul 25, 2016

Spotfire Property control validation using python script



Fund=Document.Properties["Fund"]
Document.Properties["FundError"]="";

if Fund<>"Select":
Document.ActivePageReference = Document.Pages[3]
else:
Document.Properties["FundError"]="Please select a fund."

Show/Hide Input Text Box based on Dropdown Selection using Jquery

using Jquery


//Triggering the script if Drop Down selection is varied
$("#163473c4bab648778b3e64c40463e3fc").change(function()

{
    var value = $("#163473c4bab648778b3e64c40463e3fc").val();  //To capture the index
    var vt = $("#163473c4bab648778b3e64c40463e3fc option:selected").text(); //To Capture the  selected text
    if(vt== "Enable")   //If the Drop Down selected value is Enable
    {
        $("#c8b6b12144864ec5889005c6260a4b08").show(); //Making the Input Box visible
    }
    else
    {
        $("#c8b6b12144864ec5889005c6260a4b08").hide(); //Making the Input box element hidden
    }
}
);

Limit multi selectlist values in spotfire using Java script

$("#1f26c088453c4877a82e02b276e6fdf1").change(function()
{
var options = $('#1f26c088453c4877a82e02b276e6fdf1 > option:selected');
         if(options.length > 3){
             alert('You have selected more than three; ');
             return false;
         }
    });

Find test in Spotfire list box property control using python script

a = ['BVI Ltd','sdfdsf','df'];
index = dict((y,x) for x,y in enumerate(a))

try:
a_index = index["BVI Ltd"]
print a_index
except KeyError:
   print "Not found"
else:
   print "found"

Jun 3, 2016

hide Spotfire data table column using python script

from Spotfire.Dxp.Application.Visuals import CrossTablePlot
crossTable = ct.As[CrossTablePlot]()
#toggle height between 100 and 300
crossTable.RowHeaderWidths[0]=0
crossTable.RowHeaderWidths[1]=0

Spotfire BarChart color setting change with python script

from Spotfire.Dxp.Data import DataPropertyClass
from Spotfire.Dxp.Application.Visuals import BarChart
from Spotfire.Dxp.Application.Visuals.ConditionalColoring import Coloring
vc=vis.As[BarChart]()
if Document.Properties["SelectType"]=="All":
   if Document.Properties["AccountName"] == "Exclude Zeros":
        vc.Data.WhereClauseExpression="case when '${SelectType}'='Taxable Income' then ([Total Taxable Income])<>0 when '${SelectType}'='Component Income' and [Group]='O' then ([Value]) <>0 when '${SelectType}'='All' then ([Value]) <>0 end and ([Category] in ($map(\"\'${Components}\'\", \",\")) or  [Category] in (\"Taxable Income\"))"
        vc.YAxis.Expression="sum(Value)"
        vc.ColorAxis.Expression="<[CategoryTest] as []>"
        vc.ColorAxis.Coloring.Apply("Color Scheme")
   else:
       vc.YAxis.Expression="sum(Value)"
       vc.ColorAxis.Expression="<[CategoryTest] as []>"
       vc.Data.WhereClauseExpression="[Category] in ($map(\"\'${Components}\'\", \",\")) or  [Category] in (\"Taxable Income\")"
       vc.ColorAxis.Coloring.Apply("Color Scheme")

elif Document.Properties["SelectType"]=="Taxable Income":
   vc.YAxis.Expression="sum([Total Taxable Income]) as [Taxable Income]"
   vc.ColorAxis.Expression="<[Axis.Default.Names] as []>"
   vc.ColorAxis.Coloring.Apply("Color Scheme")
   #vc.Data.WhereClauseExpression=""
elif Document.Properties["SelectType"]=="Component Income":
   vc.YAxis.Expression="${SelectComponents}"
   vc.ColorAxis.Expression="<[Axis.Default.Names] as []>"
   vc.ColorAxis.Coloring.Apply("Color Scheme")
   #vc.Data.WhereClauseExpression=""

#Cross Table
from Spotfire.Dxp.Application.Visuals import VisualContent
vc1 = viz.As[VisualContent]()
if Document.Properties["SelectType"]=="All":
   vc1.MeasureAxis.Expression="${SelectComponents},Sum([Taxable Income]) as [Taxable Income] "
   if Document.Properties["AccountName"] == "Exclude Zeros":
       vc1.Data.WhereClauseExpression='case when "${SelectType}"="All" then ([Taxable Income]) <>0  OR ($map("([${Components}])", "<>0 Or")<>0 ) end'
   else:
       vc1.Data.WhereClauseExpression=''

elif Document.Properties["SelectType"]=="Taxable Income":
   vc1.MeasureAxis.Expression="Sum([Taxable Income]) as [Taxable Income]"
   if Document.Properties["AccountName"] == "Exclude Zeros":
       vc1.Data.WhereClauseExpression='case when "${SelectType}"="Taxable Income" then ([Taxable Income]) <>0 when "${SelectType}"="Component Income" then ($map("([${Components}])", "<>0 Or")<>0 ) end'
   else:
       vc1.Data.WhereClauseExpression=""
elif Document.Properties["SelectType"]=="Component Income":
   vc1.MeasureAxis.Expression="${SelectComponents}"
   
   if Document.Properties["AccountName"] == "Exclude Zeros":
       vc1.Data.WhereClauseExpression='case when "${SelectType}"="Taxable Income" then ([Taxable Income]) <>0 when "${SelectType}"="Component Income" then ($map("([${Components}])", "<>0 Or")<>0 ) end'
   else:
       vc1.Data.WhereClauseExpression=''
   

Reset Spotfire BarChart Data limit and Axis Value Reset

from Spotfire.Dxp.Application.Visuals import AxisRange
from Spotfire.Dxp.Application.Visuals import VisualContent
vc=vis.As[VisualContent]()
vc.Data.WhereClauseExpression="[Amounts]<>0  and ([Days]< Max([Days]))"
vc.XAxis.ZoomRange = AxisRange.DefaultRange;
vc.YAxis.ZoomRange = AxisRange.(0,200);

Apr 29, 2016

Renaming the column name in SQL without data loss

EXECUTE sp_rename 'SchemaName.TableName.CurrentColumn', 'New Column', 'COLUMN';


Spotfire Interview Questions

https://intellipaat.com/interview-question/spotfire-interview-questions/?utm_source=link%2Fsfiq_MF&utm_medium=posting&utm_campaign=link%2Fsfiq_MF%20posting

Jan 5, 2016

Change Data Table Using Python Script in Spotfire

Change Data Table


##### Change Data table

from Spotfire.Dxp.Application.Visuals import VisualContent

tbl = currentTableVisualization.As[VisualContent]()
newtbl = Document.Data.Tables.Item['Data']
tbl.Data.DataTableReference=newtbl
tbl.AutoConfigure()
tbl.ApplyUserPreferences()