OpenCities Map and Map Connections Dialog issues

Hello,

we use the Map Connections Dialog to query and post Oracle data from a configured graphical source.

The workflow looks like: query data > lock for edit > edit > post back.

Since there are cases where we need to edit a bunch of datasets (like 200k+) it takes a long time to query data (particularly when using a fence from a polygon) and much more time to lock these datasets (like more than an hour) until it comes to the real work.

In order to improve the workflow we configured all the where-clauses we need and stored that as an ORAX-file. That works but not with the valid date. For each feature it has the date from ORAX-file-creation stored and when I reload this ORAX-template it shows up the old date but we want to query current state datasets. Is there a way to get that improved, I couldn't find a VBA-based option to operate with Map Connections explorer. I could alter the old date to be current manually but we've got a bunch of features to query and that would take a while.

A second question is whether I may alter the locking type from pessimistic to optimistic (that is greyed out for some reasons) without using the Oracle versioning option. It takes much longer creating a new Oracle version and querying/posting data that way. I know there are data security issues with concurrent data edition but that's not the case here.

Kind Regards,

Maik

  • Maik, regarding the first question about the Orax file and making the Where clause more dynamically.
    For a user I made a VBA with a form where the user enters a search value. The Orax file is updated and the spatial query is executed with a keyin. In this way the user can quickly modify the Where clause in a spatial query without using the Edit Where Clause dialog..
    This example can be modified to change the date to the actual data in the Orax files. 

  • Hello Kees,

    that VBA would help us managing the where clauses. I figured out that we may alter the valid date in one go when changing the date for the datasource (not for each feature). That will update the date value for each feature.

    Editing the ORAX-file manually I could alter the pessimistic option from true to false but that seams to be the dirty way.

    Is your VBA available somewhere?

  • Hi Maik, I will anonymize the VBA first and check the documentation. I will upload this soon.

  • Hi Maik,
     
    The attached ORAX file RekendossierTemplate.orax is used as a template. Below I included the two main functions of the VBA.
    In the subroutine connectAndQueryProject the template ORAX File is located.
    In the function updateOraxXML a Where clause for the attribute Documentcode is modified, and the changes are saved to a new ORAX file (with xDoc.Save (newOraxXML)).
    In the subroutine connectAndQueryProject a spatial connection is made with the modified ORAX file and a spatial query is executed.
     
    I hope this helps
     
     
    Public Sub connectAndQueryProject()
        Dim templateFileNameOraxXML As String
        Dim templatePathOraxXML     As String
        Dim newFileNameOraxXML      As String
        Dim errMsg                  As String
       
        On Error GoTo ErrorHandler
       
        If ActiveWorkspace.IsConfigurationVariableDefined("MS_GEOWSDIR") Then
            templatePathOraxXML = ActiveWorkspace.ExpandConfigurationVariable("$(MS_GEOWSDIR)") & "Data\"
        End If
        templateFileNameOraxXML = templatePathOraxXML & const_templateOrax
        If ActiveWorkspace.IsConfigurationVariableDefined("_USTN_HOMEPREFS") Then
            newFileNameOraxXML = ActiveWorkspace.ExpandConfigurationVariable("$(_USTN_HOMEPREFS)")
            ' Check for spaces because keyin 'gdi connect' fails when filename has spaces.
            If InStr(newFileNameOraxXML, " ") > 0 Then
                If ActiveWorkspace.IsConfigurationVariableDefined("MS_TMP") Then
                    newFileNameOraxXML = ActiveWorkspace.ExpandConfigurationVariable("$(MS_TMP)")
                End If
            End If
        End If
        newFileNameOraxXML = newFileNameOraxXML & "Rekendossier" & g_Documentcode & ".orax"
     
        If FileExists(templateFileNameOraxXML) Then
            If updateOraxXML(templateFileNameOraxXML, newFileNameOraxXML) = True Then
                ShowMessage "Orax file " & newFileNameOraxXML & " created", "", msdMessageCenterPriorityInfo
               
                CadInputQueue.SendKeyin "gdi connect file=" & newFileNameOraxXML & " user=" & const_UserID & " password=" & const_password
                CadInputQueue.SendKeyin "gdi query all feature=" & Chr(34) & "V Matenplan Anno P" & Chr(34) & " feature=" & Chr(34) & "V Matenplan P" & Chr(34) & " applywhere=true"
            End If
        Else
            errMsg = "Template XML file " & templateFileNameOraxXML & " missing"
            CadInputQueue.SendKeyin "gdi connect GRAPHICALSOURCE=Matenplannen_Punten_TBEM password=" & const_password
        End If
        GoTo ExitFunction
          
    ErrorHandler:
        errMsg = "ERROR in connectAndQueryProject: Lib [" & Err.Source & "]" & _
                     " Method [" & Err.Description & "]" & _
                     " Number [" & Format(Err.Number) & "]"
        ShowMessage errMsg, errMsg, msdMessageCenterPriorityError
        Err.Clear
    ExitFunction:
    End Sub
     
    Public Function updateOraxXML(templateOraxXML As String, newOraxXML As String) As Boolean
        Dim oXMLNode    As MSXML2.IXMLDOMNode
        Dim details     As String
        Dim xDoc        As MSXML2.DOMDocument
        Dim oXMLNodeList  As MSXML2.IXMLDOMNodeList
        Dim searchString  As String
       
        On Error GoTo WriteLog_EH
          
        Set xDoc = New MSXML2.DOMDocument
        xDoc.async = False
        xDoc.validateOnParse = False
     
        If xDoc.Load(templateOraxXML) Then
            Set oXMLNodeList = xDoc.selectNodes("//GDIImportCriteria/GDIStorageImportCriteria/GDIClassImportCriteria/WhereCriteria/Expression/RightSideObject/BuiltInType")
            For Each oXMLNode In oXMLNodeList
                If InStr(g_Documentcode, "-") > 0 Then
                    searchString = Replace(g_Documentcode, "-", "*")
                Else
                    searchString = g_Documentcode
                End If
                oXMLNode.firstChild.nodeValue = searchString
     
            Next oXMLNode
            xDoc.Save (newOraxXML)
        Else
           ' The document failed to load.
           Dim strErrText As String
           Dim xPE As MSXML2.IXMLDOMParseError
           ' Obtain the ParseError object
           Set xPE = xDoc.parseError
           With xPE
              strErrText = "Your XML Document failed to load due the following error." & vbCrLf & _
                "Error #: " & .errorCode & ": " & xPE.reason &  "Line #: " & .Line & vbCrLf & _
                "Line Position: " & .linepos & vbCrLf &  "Position In File: " & .filepos & vbCrLf & _
                "Source Text: " & .srcText & vbCrLf & "Document URL: " & .URL
            End With
            MsgBox strErrText, vbExclamation
               
        End If
        updateOraxXML = True
        GoTo ExitFunction:
       
    WriteLog_EH:
        updateOraxXML = False
        details = "Err in updateOraxXML: " & Err.Number & " " & Err.Description & ", XML file: " & templateOraxXML
        ShowMessage "XML file bevat geen documentcode ", details, msdMessageCenterPriorityError
    ExitFunction:
    End Function
     
    Kind regards,
    Kees van Prooijen