Jump to content

Updating a specific value in a table visualization from a drop-down selection.


Anusha N S

Recommended Posts

Hi,

I've got a use case where I need to update the particular cell value (Replace specific value Transformation) in the table visualization from a drop-down selection document property value.

To replace a particular occurrence of a value in a row), first I've got the markings of the key columns and marking of the cell (value). Then I'veset the Replace specific value Transformation operation.

The code works fine the Analyst but fails to execute in the web player with error (below for reference).

Kindly let me know the root cause for the occurrence of the error when executed the code in Webplayer and please suggest the solution as early as possible.

Also please help me to handle(rowIndexSet.IsEmpty =='false') when no marking is done.

Thanks in advance!!

 

Code snippetas follows:

---------------------------------------------------

from System.Collections.Generic import List

from Spotfire.Dxp.Data import *

from Spotfire.Dxp.Data.Transformations import *

dt =Document.Data.Tables["tablename"]

rowIndexSet=Document.ActiveMarkingSelectionReference.GetSelection(dt).AsIndexSet()

if rowIndexSet.IsEmpty !='false':

markedataID = dt.Columns["col1"].RowValues.GetFormattedValue(rowIndexSet.First)

markedataIssue = dt.Columns["col2"].RowValues.GetFormattedValue(rowIndexSet.First)

markedata = dt.Columns["col3"].RowValues.GetFormattedValue(rowIndexSet.First)

markedataID=int(markedataID)

 

#Replace specific value code begins

dataOperation = dt.GenerateSourceView().OperationsSupportingTransformations[0];

transformations = dataOperation.GetTransformations();

#Replace specific value Transformation

column = DataColumnSignature("col3",DataType.String);

old_value = markedata

new_value = Document.Properties["stat"]

row_id_cols=[DataColumnSignature("col1",DataType.Integer),DataColumnSignature("col2",DataType.String)] #Key columns

row_id_col_values = [markedataID,markedataIssue]#Key columns

transformations.Add(ReplaceSpecificValueTransformation(column, old_value,new_value,row_id_cols, row_id_col_values,True))

dataOperation.ReplaceTransformations(transformations);

 

--------------------------------------------------------

The code works fine the Analyst but fails to execute in the web player with error as below:

-------------------------------

Could not change property.

Could not execute script 'fetchAndReplaceSpecificValue': Failed to execute

at Spotfire.Dxp.Application.Scripting.ScriptService.Execute(ScriptDefinition script, Dictionary`2 scope, InternalLibraryManager internalLibraryManager, NotificationService notificationService)

at Spotfire.Dxp.Application.Scripting.ScriptManager.c__DisplayClass8_0.b__0()

at Spotfire.Dxp.Framework.Commands.CommandHistory.Transaction(Executor executor, Boolean visible, Boolean sticky, Guid stickyGuid, Boolean isHighlight)

at Spotfire.Dxp.Framework.Commands.CommandHistory.Transaction(String displayName, Executor executor)

at Spotfire.Dxp.Framework.DocumentModel.DocumentNode.Transaction(String displayName, Executor executor)

at Spotfire.Dxp.Application.Scripting.ManagedScript.Execute(Dictionary`2 environment)

at Spotfire.Dxp.Application.Scripting.PropertyChangedScriptEventHandler.c__DisplayClass8_0.b__0()

at Spotfire.Dxp.Application.Scripting.PropertyChangedScriptEventHandler.c__DisplayClass8_1.b__2()

at Spotfire.Dxp.Framework.Commands.CommandHistory.CommitOutermostTransaction(Object busyProof, Boolean oldHiding, Boolean sticky, Guid stickyGuid, Boolean isHighlight)

at Spotfire.Dxp.Framework.Commands.CommandHistory.OutermostTransactionHandle.PerformCommit()

at Spotfire.Dxp.Framework.Commands.CommandHistory.OutermostTransactionHandle.Dispose(Boolean disposing)

at Spotfire.Dxp.Framework.Commands.CommandHistory.Transaction(Executor executor, Boolean visible, Boolean sticky, Guid stickyGuid, Boolean isHighlight)

at Spotfire.Dxp.Framework.Commands.CommandHistory.Transaction(String displayName, Executor executor)

at Spotfire.Dxp.Framework.DocumentModel.DocumentNode.Transaction(String displayName, Executor executor)

at Spotfire.Dxp.Application.Visuals.HtmlTextArea.InteractWithControl(String id, Action`1 interaction)

 

---------------------------------------

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...