IBM DOORS DXL 脚本,用于搜索需求文本中的 ID,然后将其链接到具有相同 ID 的另一个模块

问题描述 投票:0回答:1

我是 DOORS DXL 脚本编写的新手,我在尝试编写的脚本方面遇到了一些问题。我想实现以下目标: 我们有两个 DOORS 模块:源模块和目标模块。您需要根据特定条件在这些模块中的特定对象之间创建链接。 需要实现什么:

在源模块中: 查看每个对象的“System Req”属性。 搜索以“ONESYS”开头并以一些随机数字(多于一位数字)结尾的字符串。 在目标模块中: 在“原始 ID”属性中搜索源模块中找到的字符串。 链接: 当源模块中的“ONESYS”字符串与目标模块中的“原始 ID”之间发现匹配时,在这两个对象之间创建链接。 链接应在指定的链接模块中创建。 该过程应该是自动化且高效的,能够处理具有许多对象的大型模块。 目标是自动执行基于“ONESYS”标识符识别两个模块之间相关对象并创建适当链接的过程,从而在源模块和目标模块之间建立可追溯性。 我有以下脚本,但出现错误,指示 (->)、exists 和 if 的参数不正确。我使用 DOORS 9.6,我一直在看手册,但仍然很困难。我非常感谢您的反馈和帮助。

Module sourceModule = current
Module targetModule = module("Target Module Name") 
Module linkModule = module("Link Module Name") 
//search phrase inside the attribute text ending with more than one digit numbers 
Regexp reOneSys = regexp "ONE_SYS\_\[0-9\]{2,}"
// Create a Skip list to store target module's "Original ID" and corresponding objects
Skip targetIDs = create()
for Object trgObj in targetModule do {
    string originalID = trgObj."Original ID"
    if (!null originalID) {
        put(targetIDs, originalID, trgObj)
    }
}
int createdLinks = 0
// Iterate through source module objects
for Object srcObj in sourceModule do {
    string sysReq = srcObj."System Req"
    if (!null sysReq) {
        // Find all matches of "ONE_SYS\_" pattern in the System Req
        int startPos = 0
        while (reOneSys sysReq\[startPos:\]) {
            string matchedID = sysReq\[match 0\]
            
            // Look for the matched ID in the target module
            Object trgObj
            if (find(targetIDs, matchedID, trgObj)) {
                // Create link if it doesn't exist
                if (!exists(srcObj-\>linkModule-\>trgObj)) {
                    srcObj-\>linkModule-\>trgObj
                    createdLinks++
                }
            }
            startPos = end 0 + startPos
        }
    }
}
// Print results to DOORS database window
print "Process completed. " createdLinks " links created.\\n"

提到了问题和我迄今为止尝试过的方法。

ibm-doors
1个回答
0
投票

我想知道我们能否解决这个问题 我想知道我们是否可以解决这个问题

© www.soinside.com 2019 - 2024. All rights reserved.