Hi,
I have written a function which allows me to enable an existing but closed connection to a palo server.
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
Private Function ConnectToPaloServer(server As String) As Boolean
Dim retval As Variant
Dim connectionStatus As Variant
Dim connectionInfo As Variant
Dim nextTry As Boolean
Dim success As Boolean
Dim obj As Jedox_Palo_XlAddin.IPaloEngineCom
Set obj = New Jedox_Palo_XlAddin.ComInterface
On Error GoTo ConnectToPaloServer_Error
'ggf. Verbindung auf "online" stellen
retval = RegValueGet(HKEY_CURRENT_USER, RegKey & server & "\", "connected", connectionStatus)
If connectionStatus <> "true" Then _
retval = RegValueSet(HKEY_CURRENT_USER, RegKey & server & "\", "connected", "true")
obj.ForceServerListUpdate
On Error Resume Next
Do
success = False
nextTry = False
connectionInfo = obj.GetConnectionDataInfo(server)
Select Case Err.Number
Case 0:
If connectionInfo(0) = "" Then
success = True
nextTry = False
Else
retval = MsgBox(connectionInfo(0), vbAbortRetryIgnore)
nextTry = (retval = vbRetry)
End If
Case Else:
retval = MsgBox("Anmeldung am Palo Server fehlgeschlagen.", vbAbortRetryIgnore)
nextTry = (retval = vbRetry)
End Select
Err.Clear
Loop While nextTry
ConnectToPaloServer = success
On Error GoTo 0
Exit Function
ConnectToPaloServer_Error:
Debug.Print "Error " & Err.Number & " (" & Err.Description & ") in procedure ConnectToPaloServer of Modul PaloServerRegistration"
ConnectToPaloServer = False
End Function
|
The trick is very simple. Jedox saves all informations about server connections in registry. You can manipulate every entry such as "connected". Afterwards you have to force palo to requery registry. This should do the the method
ForeceServerListUpdate. But in some cases palo doesn't recongnize the changes. A Palo.Data formula ends in an error and modeller doesn't show the entry.
Has anybody else notice such a behavior?
Regards
Andreas
P.S.: As a christmas gift I provide you my whole VBA module with other usefull functions about palo connections