Labels

Set document properties from marked records


from Spotfire.Dxp.Data import DataValueCursor

myLatCursor = DataValueCursor.CreateFormatted(Document.Data.Tables["mydatatable"].Columns["latitude"])
myLongCursor = DataValueCursor.CreateFormatted(Document.Data.Tables["mydatatable"].Columns["longitude"])

markedRows = Document.Data.Markings["Marking"].GetSelection(Document.Data.Tables["mydatatable"]).AsIndexSet()
for row in Document.Data.Tables["mydatatable"].GetRows(markedRows, myLatCursor):
 Document.Properties['refLat'] = myLatCursor.CurrentValue

for row in Document.Data.Tables["mydatatable"].GetRows(markedRows, myLongCursor):
 Document.Properties['refLong'] = myLongCursor.CurrentValue

This script can be used to set 1 or more document properties from a marked record. If more than one are marked, it uses the last one in the stack. The example above sets the "refLat" and "refLong" properties from the "mydatatable" datatable, which has Latitude and Longitude columns. This script was used in the "Visualizing the radius around a point on a map" article as seen on the Tips & Tricks blog.

4 comments:

  1. I like this post because it is informative and helpful to all readers. I would like to revisit this post. Welcome to the njpropertyrecords! NJ Tax Maps information you about NJ Tax Maps and map searches.

    ReplyDelete
  2. I used this script to set document properties from a marked record. However after script executes the record is unmarked. How can I keep the record marked?

    Thanks so much!!

    Steve

    ReplyDelete
  3. I really appreciate your professional approach.These are pieces of very useful information that will be of great use for me in future.
    មាន់ជល់អនឡាញ

    ReplyDelete