如何使用 LotusScript 获取表单的底层视图

发布于 2024-09-25 19:21:23 字数 806 浏览 3 评论 0原文

我是 lotusscript 的新手。我们有一个遗留的莲花笔记/多米诺骨牌系统。我们需要将Lotus Notes中的数据迁移到Oracle中。 Lotus domino 的数据模型与oracle 的数据模型完全不同。因此,我们正在为每个 Lotus Notes 表单 创建一个关系表。我可以使用 Lotusscript 以编程方式访问视图。但我无法使用 LotusScript 获取与 Notes 表单 关联的视图。谁能给出一个代码片段或解释一下 from 和 view 之间的关系吗?我需要迁移与单个表单关联的数据,即使它与多个注释视图连接。

下面的代码片段可以工作吗?

Dim session As New NotesSession
Dim db As NotesDatabase
Dim notesDocumentCollection As NotesDocumentCollection

Set db = session.CurrentDatabase
Set notesDocumentCollection = db.FTSearch( """Form=Help Ticket""", 0)

For i = 1 To notesDocumentCollection.Count    
  Set doc = notesDocumentCollection.GetNthDocument( i )  
  ' process each document 

End Forall

I am a newbie in lotusscript. We have a legacy lotus notes/domino system. We need to migrate the data from lotus notes to oracle. Lotus domino's data model is entirely different than that of oracle's data model. So, we are creating a relational table per Lotus notes form. I can access the views programmaticaly using lotusscript. But I couldn't get the views associated with a Notes form using lotusscript. Could anyone please give a code snippet or explain the relation between from and view? I need to migrate the data associated with a single form even if it is connected with multiple notes views.

Will the following code snippet work?

Dim session As New NotesSession
Dim db As NotesDatabase
Dim notesDocumentCollection As NotesDocumentCollection

Set db = session.CurrentDatabase
Set notesDocumentCollection = db.FTSearch( """Form=Help Ticket""", 0)

For i = 1 To notesDocumentCollection.Count    
  Set doc = notesDocumentCollection.GetNthDocument( i )  
  ' process each document 

End Forall

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

荆棘i 2024-10-02 19:21:23

在 Lotus Notes 中,视图使用选择标准进行操作。这些标准可以引用表格(但不是必须)。例如,假设您创建一个名为“HelpTicket”的表单。然后,可以使用“视图选择公式”选择使用此表单创建的任何文档以在视图中显示,如下所示:

SELECT Form="HelpTicket"

……然后可以添加视图中的列,通过引用所设置的字段从所选文档中提取数据。在帮助票表格上。

我怀疑您对表单/视图关系感到困惑的是围绕迁移数据的想法:表单既是其关联数据的模式定义,也是在逐个文档上呈现该数据的方式基础。理论上,数据可以通过 Notes 中任意数量的表单“定义”来呈现,即数据和呈现是完全分开的,但实际上,表单和引用它的文档之间存在着某种关系。

顺便说一句,可能值得一提的是,Lotus Notes 不是一个关系数据库系统,它可以更容易地描述为基于文档的数据库,或者一种“NoSQL”形式。

现在,回到视图:然后,这些视图通过列、类别和基于基础数据的简单计算来呈现数据(视图列可以简单地引用字段值,也可以通过专有的 Lotus Notes 公式语言对该值执行基本操作) )。

简而言之,您需要迁移的数据就是 Lotus Notes 文档。这些视图有点无关紧要,尽管您可能希望复制它们在报告/可视化所述数据方面提供的内容。

In Lotus Notes, views operate using selection criteria. These criteria can reference forms (but don't have to). For example, say you create a form called "HelpTicket". Any documents created using this form can then be selected for display in a view using a "view selection formula" like so:

SELECT Form="HelpTicket"

… and columns in the view can then be added to pull out data from the selected documents, by referencing the fields laid-out on the HelpTicket form.

Where I suspect you're getting confused with regards the form / view relationship is around this idea of migrating the data: forms are both a schema definition for their associated data, and a way of presenting that data, on a document-by-document basis. Theoretically, data can be presented via any number of form "definitions" in Notes, i.e. data and presentation are quite separate, but in practical terms there is a relationship between a form and the documents that reference it.

As an aside, it's probably worth mentioning that Lotus Notes is not a relational database system, it can be more readily described as a document-based database, or a form of "NoSQL".

Now, back to views: these then present data via columns, categories, and simple calculations based on the underlying data (a view column may either simply reference a field value, or can perform basic operations on that value via the proprietary Lotus Notes formula language).

So, in short, the data you need to migrate are your Lotus Notes documents. The views are kind of irrelevant, although you may wish to replicate what they offer in terms of reporting / visualising said data.

浮华 2024-10-02 19:21:23

我建议您完全避免使用 Lotusscript。听起来您迁移数据后并没有使用这个Notes数据库,所以您唯一需要做的就是将数据取出来。如果您使用 NotesSQL 驱动程序 (http://www.ibm.com/developerworks/lotus/products/notesdomino/notessql/),您可以更轻松地完成此操作。

为数据库配置驱动程序后,只需使用 Excel 或访问连接到数据库并提取数据。然后您可以轻松地正确重新格式化数据,以便将其导入 Oracle 中。

SQL 驱动程序可以基于 Form 提取数据,因此您可以将所有 HelpTicket 文档(及其项目)放入 Access 中的表或 Excel 中的工作表中。

I suggest you avoid using Lotusscript altogether. It doesn't sound like you are using this Notes database after you migrate the data, so the only thing you need to do is get the data out. You can do that a lot easier if you use the NotesSQL driver (http://www.ibm.com/developerworks/lotus/products/notesdomino/notessql/)

Once you've configured the driver for your database, just use Excel or Access to connect to the database and pull the data in. You can then easily reformat the data properly so you can import it into Oracle.

The SQL driver can pull data based on Form, so you can get all HelpTicket documents (and their items) into a table in Access or a sheet in Excel.

爺獨霸怡葒院 2024-10-02 19:21:23

一个较晚的答案,但它可能会对某人有所帮助:当尝试在 Notes 和 SQL 之间分配类似的“术语”时,将 Notes 视图视为 SQL 表、将 Notes 文档视为 SQL 记录以及将 Notes 代理/事件视为 SQL 触发器可能会有所帮助。注释 具有排序列的视图类似于具有 SQL 索引的表。排序后的注释列定义了索引。要“查询”Notes 视图,您可以扫描视图(相当于未索引的 SQL 表扫描),或者执行基于键的查找(选择 y=x 的位置)。本身没有查询优化,您必须选择如何查询视图。这些术语是近似值。注释 视图更像是 SQL 中的物化视图,而其他地方提到的文档是无模式记录,可以包含不同的字段和数据(但通常不会)。

正如其他答案所提到的。通过 Notes-SQL 访问 Notes 数据相当简单,并且对于精通 SQL 的用户来说更“容易理解”。您将获得一个基于 SQL 选择查询的答案表。对于精通 Notes/LotusScript 的用户来说,扫描视图并编写代理以将数据导出为 CSV 值以便稍后导入到 SQL 中非常简单。您甚至可以仅使用内置的视图导出来获取 CSV 数据表,然后将其导入到 SQL 中。

Notes 的一个主要问题是,单个字段或视图列中的数据可能存在“类型问题”,具体取决于开发人员的水平。例如,在一行中,数据可能是真实日期,而在另一行中,它可能表示为“文本日期” - 这可能会阻碍导入例程,除非您处理这种可能性。其他问题包括分隔符和字段长度; Notes 不使用显式字段大小,因此某些字段可能比预期大,并且包含可能会阻碍 SQL 导入的分隔符。还有其他问题需要解决。为了解决很多这样的问题,如果可能的话,为每个要迁移的表单创建一个视图,将每个字段放入视图中,添加公式以清理数据(如果需要)并将每个视图导出为 CSV 并将其视为 SQL桌子。

A late answer, but it may help someone: When trying to allocate similar 'terms' between Notes and SQL, it may be helpful to think of Notes Views as SQL Tables, Notes Documents as SQL Records and Notes Agents/Events as SQL triggers. Notes Views with sorted columns are like tables with SQL indexes. The sorted Notes columns define the index. To 'query' a Notes View, you either scan the view (equiv to an unindexed SQL table scan), or do a key-based lookup (select where y=x). There is no query optimisation as such, you have to choose how to query the view. These terms are an approximation. Notes Views are more like materialised views in SQL and documents as mentioned elsewhere are schemaless records that can contain dissimilar fields and data (but generally they don't).

As the other answers have mentioned. accessing Notes data via Notes-SQL is fairly straightforward and is more 'grokable' to SQL savvy users. You will get a table on answers based on SQL select queries. For Notes/LotusScript savvy users, scanning the views and writing agents to export data as CSV values for import into SQL later is straightforward. You can even just use the built view-exports to get a CSV table of data you can then import into SQL.

One major 'gothcha' with Notes is that the data in a single field or view column may have 'type issues' depending on how good the developer(s) is/was. For instance, in one row a data may be a true-date, and in another row it may be represented as a 'text-date'- This can choke an import routine unless you handle this possibility. Other issues are delimiters and field lengths; Notes doesn't use explicit field sizes and so some fields can be larger than expected and contain delimiter characters than can choke your SQL import. There are other issues to address as well. To address a lot of these issues, if possible, create a view for each form you want to migrate, put every field in the view, add formula to clean the data if necessary and export each view as a CSV and treat it as a SQL table.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文