python - Exporting DOORS Objects to csv files with dxl wont write all objects? -
i wrote script doors 9.5 looks in doors module specific objects , writes them in csv-file. after specific number of lines stops writing in csv-file , got half of requested objects. i'm using string replacement function found in internet. thats maybe problem or there kind of maximum dxl write in csv files?
would nice if me this, because cant find solution in internet or understand why 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 empty" return "" } // read first char latter comparison -> speed optimization char firstchar = ssearch[0] buffer s = create() int pos = 0, d1,d2; int while (pos < ilen) { char ch = ssource[pos]; bool found = true if (ch != firstchar) {pos ++; s+= ch; continue} (i = 1; < 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") o in m { 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
there no line limit know of output csv.
but see odd in replace function. ssearch
variable \n
far doors concerned 1 character (a carriage return). in following line i=1
:
if (ssource[pos+i] != ssearch[i]) { found = false; break }
ssearch
doesn't have character @ position 1
because string array starts @ 0
.
i think need change loop to:
for (i = 0; < ilensearch; i++)
my guess script failing first time finds object carriage return in it.
let me know if helps, luck!
Comments
Post a Comment