将(实时)数据从 IBM Domino 数据库中提取到 rails 应用程序中
Extracting (live) data out of IBM Domino database into rails application
我有一些 Lotus Domino 数据库(IBM Notes 背后的数据库)存储了我的数据。
在我的 rails 应用程序中,我想分析数据以制作实时报告。
我的第一个想法是借助 Notes 中的代理导出数据,但它似乎效率很低,如果我想实时报告也无济于事。
有没有人有使用 Domino 数据库进行报告的经验?and/or 知道我如何(接近)我需要的东西吗?
您可以像 Pe Henrik 所说的那样使用 Domino Access Services。
您还可以编写自己的 API/function,它将 return 请求的数据作为 JSON(如果在不同的服务器上,则为 JSONP)。我在这里发过帖子:
http://blog.texasswede.com/calling-a-notes-web-agent-from-another-server-using-jsonp/
我也有两个介绍这个主题:
http://blog.texasswede.com/mwlug-2015/ and http://blog.texasswede.com/my-connect-2016-presentation-demo-database/
这些链接中还有示例代码。
但是创建一个向外部 Web 应用程序提供数据的 Lotusscript 代理并不难。
这是我的 Lotusscript class 可以帮助你 return JSON:
%REM
Library Class.JSON by Karl-Henry Martinsson
Created Oct 9, 2014 - Initial version
Updated Nov 6, 2015 - Added JSONP support
Description: Class to generate simple JSON from values
%END REM
Option Public
Option Declare
Class JSONdata
Private p_json List As String
Public Sub New()
'*** Set default value(s)
me.p_json("ajaxstatus") = ""
End Sub
%REM
Property Set success
Description: Set success to true or false
%END REM
Public Property Set success As Boolean
If me.success Then
Call me.SetValue("ajaxstatus","success")
Else
Call me.SetValue("ajaxstatus","error")
End If
End Property
%REM
Property Get success
Description: Not really used...
%END REM
Public Property Get success As Boolean
If me.p_json("ajaxstatus") = |"success"| Then
me.success = True
Else
me.success = False
End If
End Property
%REM
Sub SetMsg
Description: Set msg item
%END REM
Public Sub SetMsg(message As String)
Call me.SetValue("msg",message)
End Sub
Public Sub SetErrorMsg(message As String)
Call me.SetValue("errormsg",message)
me.success = False
End Sub
Public Sub SetValue(itemname As String, value As String)
Dim tmp As String
Dim delimiter As String
'*** Check for quote (double and single) and fix value if needed
tmp = Replace(value,Chr$(13),"<br>")
tmp = FullTrim(Replace(tmp,Chr$(10),""))
If InStr(tmp,|"|)>0 Then
If InStr(tmp,|'|)>0 Then
tmp = Replace(tmp,|"|,|"|)
delimiter = |"|
Else
delimiter = |'|
End If
Else
delimiter = |"|
End If
'*** Store value with delimiter in list
me.p_json(itemname) = delimiter & tmp & delimiter
End Sub
Public Sub SetData(itemname As String, value As String)
'*** Store value in list
me.p_json(itemname) = value
End Sub
%REM
Function GetJSON
Description: Return a JSON object as text
%END REM
Function GetJSON As String
Dim json As String
'*** Opening curly braces + CR
json = "{" + Chr$(13)
'*** Loop through all list elements and build JSON
ForAll j In me.p_json
json = json + |"| + ListTag(j) + |":| + j + "," + Chr$(13)
End ForAll
'*** Remove the comma after the last item
json = Left$(json,Len(json)-2) + Chr$(13)
'*** Add closing curly bracket and return JSON
json = json + "}"
GetJSON = json
End Function
%REM
Sub SendToBrowser
Description: Print JSON to browser, with correct MIME type
%END REM
Public Sub SendToBrowser()
'*** MIME Header to tell browser what kind of data we will return (JSON).
'*** See http://www.ietf.org/rfc/rfc4627.txt
Print "content-type: application/json"
Print me.GetJSON
End Sub
%REM
Sub SendJSONPToBrowser
Description: Print JSONP to browser, with correct MIME type
%END REM
Public Sub SendJSONPToBrowser(callbackFunction As String)
'*** MIME Header to tell browser what kind of data we will return (Javascript).
'*** See http://www.rfc-editor.org/rfc/rfc4329.txt
Print "content-type: application/javascript"
Print callbackFunction + "(" + me.GetJSON + ")"
End Sub
End Class
我有一些 Lotus Domino 数据库(IBM Notes 背后的数据库)存储了我的数据。 在我的 rails 应用程序中,我想分析数据以制作实时报告。
我的第一个想法是借助 Notes 中的代理导出数据,但它似乎效率很低,如果我想实时报告也无济于事。
有没有人有使用 Domino 数据库进行报告的经验?and/or 知道我如何(接近)我需要的东西吗?
您可以像 Pe Henrik 所说的那样使用 Domino Access Services。 您还可以编写自己的 API/function,它将 return 请求的数据作为 JSON(如果在不同的服务器上,则为 JSONP)。我在这里发过帖子: http://blog.texasswede.com/calling-a-notes-web-agent-from-another-server-using-jsonp/ 我也有两个介绍这个主题: http://blog.texasswede.com/mwlug-2015/ and http://blog.texasswede.com/my-connect-2016-presentation-demo-database/ 这些链接中还有示例代码。
但是创建一个向外部 Web 应用程序提供数据的 Lotusscript 代理并不难。
这是我的 Lotusscript class 可以帮助你 return JSON:
%REM
Library Class.JSON by Karl-Henry Martinsson
Created Oct 9, 2014 - Initial version
Updated Nov 6, 2015 - Added JSONP support
Description: Class to generate simple JSON from values
%END REM
Option Public
Option Declare
Class JSONdata
Private p_json List As String
Public Sub New()
'*** Set default value(s)
me.p_json("ajaxstatus") = ""
End Sub
%REM
Property Set success
Description: Set success to true or false
%END REM
Public Property Set success As Boolean
If me.success Then
Call me.SetValue("ajaxstatus","success")
Else
Call me.SetValue("ajaxstatus","error")
End If
End Property
%REM
Property Get success
Description: Not really used...
%END REM
Public Property Get success As Boolean
If me.p_json("ajaxstatus") = |"success"| Then
me.success = True
Else
me.success = False
End If
End Property
%REM
Sub SetMsg
Description: Set msg item
%END REM
Public Sub SetMsg(message As String)
Call me.SetValue("msg",message)
End Sub
Public Sub SetErrorMsg(message As String)
Call me.SetValue("errormsg",message)
me.success = False
End Sub
Public Sub SetValue(itemname As String, value As String)
Dim tmp As String
Dim delimiter As String
'*** Check for quote (double and single) and fix value if needed
tmp = Replace(value,Chr$(13),"<br>")
tmp = FullTrim(Replace(tmp,Chr$(10),""))
If InStr(tmp,|"|)>0 Then
If InStr(tmp,|'|)>0 Then
tmp = Replace(tmp,|"|,|"|)
delimiter = |"|
Else
delimiter = |'|
End If
Else
delimiter = |"|
End If
'*** Store value with delimiter in list
me.p_json(itemname) = delimiter & tmp & delimiter
End Sub
Public Sub SetData(itemname As String, value As String)
'*** Store value in list
me.p_json(itemname) = value
End Sub
%REM
Function GetJSON
Description: Return a JSON object as text
%END REM
Function GetJSON As String
Dim json As String
'*** Opening curly braces + CR
json = "{" + Chr$(13)
'*** Loop through all list elements and build JSON
ForAll j In me.p_json
json = json + |"| + ListTag(j) + |":| + j + "," + Chr$(13)
End ForAll
'*** Remove the comma after the last item
json = Left$(json,Len(json)-2) + Chr$(13)
'*** Add closing curly bracket and return JSON
json = json + "}"
GetJSON = json
End Function
%REM
Sub SendToBrowser
Description: Print JSON to browser, with correct MIME type
%END REM
Public Sub SendToBrowser()
'*** MIME Header to tell browser what kind of data we will return (JSON).
'*** See http://www.ietf.org/rfc/rfc4627.txt
Print "content-type: application/json"
Print me.GetJSON
End Sub
%REM
Sub SendJSONPToBrowser
Description: Print JSONP to browser, with correct MIME type
%END REM
Public Sub SendJSONPToBrowser(callbackFunction As String)
'*** MIME Header to tell browser what kind of data we will return (Javascript).
'*** See http://www.rfc-editor.org/rfc/rfc4329.txt
Print "content-type: application/javascript"
Print callbackFunction + "(" + me.GetJSON + ")"
End Sub
End Class