lcResult = "<table>" n = afields( laFields ) scan lcRow = "<tr>" for i = 1 to n lcRow = lcRow + "<td>" + transform( eval( laFields[i,1] ) ) + "</td>" endfor lcResult = lcResult + lcRow + "</tr>" endscan lcResult = lcResult + "</table>"So this way the one big string only gets extended once per row of data rather than for every field. The code below shows a really slow way of doing the same thing:
lcResult = "<table>" scan n = afields( laFields ) lcResult = lcResult + "<tr>" for i = 1 to n lcResult = lcResult + "<td>" + lcResult = lcResult + transform( eval( laFields[i,1] ) ) lcResult = lcResult + "</td>" endfor lcResult = lcResult + "</tr>" endscan lcResult = lcResult + "</table>"If you are building lots of strings over several hundred K in size and absolute performance is an issue you might want to look at using a C++ DLL from VFP. There's a couple of examples on my website that show how C++ can really beat the pants off VFP for some string operations.