[BM SS4] What happens to User Data Linkages?

I've got a regular MicroStation drawing with shape elements that include a User Data Linkage that points back to an Oracle table. What happens to that linkage when I open that drawing in Map Enterprise, and use the "Promote" tools to convert that simple shape into a native feature residing in a SQL*Server database? Is it lost? Is there any way to "capture" that linkage? The MSLINK value is the record ID of the Oracle data that I would want to insert into the data columns of the SQL*Server spatial table. We've got many shapes, so I'm hoping there is some automated process that can be set up to "preserve" that linkage information so it can be used to ensure the right record from Oracle is associated with the right record in SQL*Server.

Thanks,

Bruce

  • Awesome !! I can't wait to look at this and give it a try. If I understand correctly, one would first "Promote" the graphics to a feature (which inserts them into the spatial database) then run this modified example to read/extract the database linkage value (MSLINK in my case) and have it written to the desired database table column, thus preserving that data. Then it's a simple matter of SQL update statements to get the rest of the data loaded into the spatial table columns ....
  • Bruce,

    During the "Promote" process the database linkages should be preserved and remain available on the elements. However database linkage information is not automatically available on the feature instance or inserted into the spatial database during a post operation. The good news is that with a few lines of VBA code the polygon features can be located and database MSLINK values can be copied to a business property that when posted to the spatial database would "preserve" the Oracle association.

    database_links1.mvba

    Attached is the complete MVBA example but the key portions of the code are shown below. Please note that you will have to update the database linkage type, database entity number and XFM business property name for your spatial feature class to accommodate your specific needs.

    Perform Locate Operation (for file, fence or selection set processing of specific feature class(es))

    Private Sub performLocateOperation()
    
        Dim oLocateOp As New locateOp
        
        oLocateOp.ClearHilited = True
        oLocateOp.IncludeOnlyFeatures = True
        oLocateOp.IncludeFeatureName "MyPolygonFeature1"
        
        If ActiveDesignFile.Fence.IsDefined = True Then
            
            oLocateOp.Mode = LocateOpMode.locateOpModeFence
            oLocateOp.AutoAcceptFence = True
        
        ElseIf ActiveModelReference.AnyElementsSelected Then
            
            Dim selectionSetValue As New InputValue
            
            selectionSetValue.SetTypeAndValue ValueType_VALUE, "1"
            oLocateOp.UseSelectionSet = selectionSetValue
            oLocateOp.AutoAcceptSelectionSet = True
            oLocateOp.Mode = LocateOpMode.locateOpModeIdentify
        
        Else
            
            oLocateOp.Mode = LocateOpMode.locateOpModeScan
            oLocateOp.AutoAcceptScanFile = True
        
        End If
               
        CmdMgr.StartLocateOperation oLocateOp, New clsLocateFeatureOp
    
    End Sub

    Process Located Feature Instances (copy MSLINK value from database link to XFM business property)

                With fe.Current
                
                    If .GetFeatureDefinition.IsCollection Then
                        
                        Dim index As Long
                        
                        For index = 0 To (.SubFeatureCount - 1)
                            
                            Dim oSubFeature As feature
                            
                            Set oSubFeature = .GetSubFeature(index)
                            
                            With oSubFeature
                            
                                If .GeometryType = GEOMETRYTYPE_Polygon Then
                                    
                                    Dim databaseLinks() As databaseLink
                                    
                                    If .Geometry.IsGraphical Then
                                        
                                        databaseLinks = .Geometry.GetDatabaseLinks _
                                        (msdDatabaseLinkageOdbc, cDatabaseLinkEntitynum) mslinkValue = databaseLinks(0).Mslink End If End If End With Next End If .SetProperty cDatabaseLinkColumnName, Str(mslinkValue) .Write (False) End With

    Regards,

    Jeff Bielefeld [Bentley]