我爲DOORS 9.5編寫了一個腳本,它在DOORS模塊中查找特定對象並將它們寫入csv文件中。但是,在特定數量的行停止寫入csv文件後,我只獲得了一半所需的對象。 我正在使用在互聯網上找到的字符串替換功能。所以這可能是問題或者有什麼最大的dxl寫入CSV文件?使用dxl將DOORS對象導出到csv文件將不會寫入所有對象?
如果有人能幫助我,這將是非常好的,因爲我無法找到任何解決方案,在互聯網上或理解爲什麼這不會工作。
// String replacement function
string replace (string sSource, string sSearch, string sReplace)
{
int iLen = length sSource
if (iLen == 0) return ""
int iLenSearch = length(sSearch)
if (iLenSearch == 0)
{
print "search string must not be empty"
return ""
}
// read the first char for latter comparison -> speed optimization
char firstChar = sSearch[0]
Buffer s = create()
int pos = 0, d1,d2;
int i
while (pos < iLen) {
char ch = sSource[pos];
bool found = true
if (ch != firstChar) {pos ++; s+= ch; continue}
for (i = 1; i < iLenSearch; i++)
if (sSource[pos+i] != sSearch[i]) { found = false; break }
if (!found) {pos++; s+= ch; continue}
s += sReplace
pos += iLenSearch
}
string result = stringOf s
delete s
return result
}
Module m = read(modulePath, false)
Object o
string s
string eval
Stream outfile = write("D:\\Python\\Toolbeta\\data\\modules\\test.csv")
for o in m do
{
eval = o."Evaluation Spec Filter"
if(eval == "Evaluation Step Object")
{
s = o."Object Text"
s = replace(s,"\n","\\n")
outfile2 << o."HierarchyNumber" ";" s "\n"
}
}
close outfile