Jump to content

How to display Blob from table as Image in text area


Michael Kalada 2

Recommended Posts

I have a SQL table that stores images as VARBINARY(MAX). When I bring the data into spotfire through infolinks it comes as blob, no option to bring it in as binary is available

The image displays in a table visualization fine, though its small and increasing the row height doesnt enlarge the picture

I'd like to store the value from the table in a document property so it can be displayed in a text area via label but all the scripts that show how to do this are taking images from a network drive. For examplehttps://community.spotfire.com/wiki/how-load-image-file-and-display-document-property-tibco-spotfirer-using-ironpython-scripting

Problem is security team wont allow the web player access to network drives.

If i create a binary document property and then try to update it from the table value I get a "value argument has incompatible data type" error.

 

How can I take the value from the table and display it as image in a text area

 

Sample dxp version 10 attached

Link to comment
Share on other sites

In the attached analysis, the column type is Binary.

Similar to the wiki article you shared, you can use the below script to read the binary column values and set it to a document property of type binary and show it in the text area.

from Spotfire.Dxp.Data import *

 

table = Document.ActiveDataTableReference;

binaryColumn = table.Columns["ImageBinary"];

cursor = DataValueCursor.Create[binaryLargeObject](binaryColumn);

for row in table.GetRows(cursor):

value=cursor.CurrentValue

print cursor.CurrentValue

Document.Properties["test"]=value

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...