I wrote a script for DOORS 9.5 that looks in a DOORS module for specific Objects and writes them in a csv-file. However after a specific number of lines it stops writing in the csv-file and i got only half of my requested Objects. I'm using a String replacement function that i found in the internet. So thats maybe the problem or is there some kind of maximum for dxl to write in csv files?
Would be very nice if anyone could help me with this, because i cant find any solution for this in the internet or understand why this wont work.
// 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