Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The most elegant and readable way (and efficient)
Message
From
11/12/2005 06:43:59
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01076714
Message ID:
01076952
Views:
16
Hi Naomi,
>Anyway, I think gather works quite nice instead of building the replace command (though I considered it as well at first).

I responded to the "efficient" part, since that is mesurable.

For me, abstacting the logic into a string has other "nice" possibilities, for instance easy logging with strtofile(). Elegance is probably largely in the eye of the beholder: Using a scatter - approach I'ld probably just (scetchy pseudo)
scatter name loSource
loEmpty = createobject ("empty")
for lnRun = 1 to aelements(laProp,,,)
  if empty and ...
    addobject(loEmpty, laProp[m.lnRun], eval(laProp[m.lnRun])) && in a loop across the changeworthy properties,  
  endif
next
gather name loEmpty
from this already "pruned" object.

This way might actually be slower than Sergey's way, depending on the speed of addproperty in a loop vs. a single gather operation - not tested <g>. But for me the "elegance" would be in the possibility to log ONLY the resulting changes by iterating over all the properties of the previously "empty" object. As I said, in the eye of the beholder <bg>.

regds

thomas
Previous
Reply
Map
View

Click here to load this message in the networking platform