门DXL过滤器,
问题描述:
我有以下snip的dxl代码, 我想复制的对象ID与过滤器F3上。 : 我不知道我在做什么错了,它给了我(ID)的所有对象。门DXL过滤器,
string Id
int x=0;
int y=0;
Id = o."SourceID"
Filter f0 = hasNoLinks(linkFilterIncoming, "*")
Filter f1=attribute "_TraceTo" == "System"
Filter f2 = attribute "Object Type" == "requirement"
Filter f3 = f1&&f2&&f0
addFilter(m,f3,x,y)
print x ":\t" fullName(module(m)) "\n"
wOutKLHUntraced << Id "\t" fullName(module(m)) "\n"
答
首先,你需要添加语句filtering on
添加过滤器后,使得应用滤镜。然后过滤的对象将是唯一可见的。
然后,您在脚本中设置了“Id”方式太早。在第4行,“o”被设置为 的一些对象,我不知道哪一个,但肯定不会是你的过滤器 的结果。相反,声明filtering on
后,添加语句
Object o = first m // the first object that is now visible
Id = o."SourceID"
答
我的脚本运行良好,但给出了不同的结果:因为我在运行此脚本循环大约30模块: 就是我设置的地方错了过滤器?
Stream TbdUntraced;
string s
string d
Object o
string trac
int numReqs = 0;
string IdNum
string untraced
int x=0;
int y=0;
int a =0;
for o in m do
{
ensureInLinkedModulesLoaded(o,S_SATISFIES);
s = o."Object Type"
string Id
string Topic
Topic = o."_Topic"
numReqs++;
Filter f0 = hasNoLinks(linkFilterIncoming, "*")
Filter f1 = contains(attribute "_TraceTo", "TBD", false)
Filter f2 = attribute "Object Type" == "requirement"
Filter f3 = attribute "MMS5-Autoliv_Supplier_Status" == "agreed"
Filter f4 = attribute "MMS5-Autoliv_Supplier_Status" == "partly agreed"
Filter f7 = f0&&f2&&(f3||f4)&&f1
addFilter(m,f7,x,y)
filtering on
d = o."MMS5-Autoliv_OEM_Status"
Id = o."SourceID"
Topic = o."_Topic"
print x ":\t" name(module(m)) "\n"
TbdUntraced << Id "\t" Topic "\t"name(module(m)) "\n"
}
感谢迈克,过滤,做到了! – user3285192
嗨,我的脚本运行良好,但总是五个不同的结果:因为我在一个约30个模块的for循环中运行此脚本: – user3285192