Warning when upgrading to Spotfire 10

TIBCO has deprecated the JQueryUI Javascript library in the latest Spotfire 10.0 release

TIBCO Community pages show us how to use JQuery properly

Write to file

from System.IO import Path, StreamWriter
from Spotfire.Dxp.Application.Visuals import CrossTablePlot

#targetFileName = "\\\\company.com\\your\\folder\\test.txt"
#targetFileName = "C:\\temp\\test.txt
targetFileName = Path.GetTempFileName()

#Write to file 
writer = StreamWriter(targetFileName,True) #True to append
aLine = "|".join(("str1","str2","str3"))

print targetFileName
print aLine

Note: If using writing to a network folder from Webplayer, make sure the folder has proper permissions for the service account running Webplayer. To check what service account webplayer is using, add these lines to output the result in a Text Area Spotfire Label Control.

#Include dependencies
from System.Security.Principal import NTAccount
from System.IO.File import GetAccessControl

#get owner
owner = GetAccessControl(targetFileName).GetOwner(NTAccount);

#store owner in an existing "whoami" string Document Property  
Document.Properties["whoami"] = str(owner)


The Alexu Boy said...

Is there any way I can read from a file? Using a similar script?

Jose Leviaguirre said...
This comment has been removed by the author.
Jose Leviaguirre said...

checkout this post that writes and reads a file


S Saha said...

Hi Jose,

I'm trying to get input from the users through the input fiekd ( e.g. Text Area -> Property Control -> Input field multiple line) and then write it to a file as you mentioned above.

Can you please help me how to do that? In fact how to assign a value to str1 in the above programming from " Input field".

S Saha

Jose Leviaguirre said...

Hello Sasha,

I guess you could replace the following line:

aLine = "|".join(("str1","str2","str3"))


aLine = Document.Properties["yourMultilineDocPropHere"]