如何使用DOORS DXL通过关键字查找需求



我为模块A中的每个需求确定了3-5个关键字。每个关键字用逗号分隔。现在我想搜索模块B中的每个需求,看看其中哪些需求的单词与每个关键词匹配。

不确定您到底在寻找什么。您可能需要说明我将要提出的这些解决方案是否都不是您想要的。

如果您试图创建一个只显示当前视图中具有这些关键字的对象的过滤器,您可以通过首先进入过滤器("工具">"过滤器">"定义"(,然后选择显示的过滤器菜单左下角的"高级"按钮来创建高级过滤器。

此时,您可以为筛选器创建自定义规则。我只想为每个单词创建一个单独的规则,定义如下:

Attribute: Object Text
Condition: contains
Value: <insert word here>
Match Case: uncheck
Regular Expression: uncheck

然后选择"添加"按钮将规则添加到"高级选项"中的可用规则列表中。

此时,您可以在可用规则列表中选择多个规则,并可以将这些规则进行"与/或"运算,为所需视图创建自定义筛选器。

因此,如果您正试图创建一个仅包含特定单词的对象的自定义视图,则适用于此。

如果你正在讨论编写DXL代码来自动吐出包含特定单词的需求

Object o
String s
int offset, len
for o in entire (current Module) do
{
if (isDeleted(o)) continue
s = o."Object Text"""
if findPlainText(s, "<insert word here>", offset, len, false)
{
print identifier(o)  // or replace this line with however you want to display object
}
}

希望这会有所帮助。干杯

编辑:

要对逗号分隔的列表执行操作,一次执行一个操作,可以使用while循环和某种搜索功能,一次剪切一个单词。

void processWord (string someWord, Module mTarget, Object oSource)
{
Object oTarget
string objID = identifier(oSource)
for oTarget in mTarget do
{
if (<someWord in oTarget Object Text>) // edit function as necessary to do this
{
if (oTarget."Exists""" == "")
oTarget."Exists" = objID
else
oTarget."Exists" = oTarget."Exists" "," objID
}
}
}
int offset, len
string searchCriteria
Module mSource = read("<path of source module>", true)
Module mTarget = edit("<path of target module>", true)
Object oSource
for oSource in mSource do // can use "for object in entire(m)" for all objects
{
if (oSource != rqmt) continue // create conditions specific to your module here
searchCriteria = oSource."Search Criteria"""
while (findPlainText(searchCriteria, ",", offset, len, false))
{
processWord(searchCriteria[0:offset-1], mTarget, oSource)
searchCriteria = searchCriteria[offset+1:]
}
}
processWord(searchCriteria, mTarget, oSource) // for last value in comma separated list

最新更新