Error: 'System.MissingMemberException: NoneType object has no attribute ...'
If there is a requirement to access a Data Table or Marking that belongs to an active visualization or is active then write a sample script like the one below:
dataTable = Document.ActiveDataTableReference
marking = Document.ActiveMarkingSelectionReference
The above code may return a NULL object. One of the possible reason is that Text Area is active and since the Text Area does not have a data table, it assigns the active data table to Null. This results in the error:
System.MissingMemberException: 'NoneType' object has no attribute ....It is recommended to use a specified marking/table rather than using active unless there is a good reason for wanting the active table. You may use the DefaultTable/Marking or the marking /table used for a specific visualization. You can use the variable as used in the code shown below where "visual" is a script parameter of the type Visualization:
vc = visual.As[VisualContent]()
dataTable = vc.Data.DataTableReference
marking = vc.Data.MarkingReference
The above will not return Null. You can then use these objects for performing various operations:
Example:
marking.SetSelection(RowSelection(rowsToMark), dataTable)
Instead of:
Document.ActiveMarkingSelectionReference.SetSelection(RowSelection(rowsToMark), dataTable)
Comments
0 comments
Article is closed for comments.