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
I finally found the solution to my problem (I know the replace function was kinda crappy^^).
dxl scripts seem to have an internal timer. When the timer is up, the script will end itself automaticly even when processes are still executed. So my script always stoppt after x seconds and thats the reason i never got all the data in my csv files.
If you have the same problem try pragma runLim,0
. It sets the timer to unlimited. you can also choose a timer by replacing 0 with any number. (For my purpose 2000000 suits the best).
Thx for all answers and the help