>Hi,
>
>Sergey's way is probably efficient enough, but on the asssumption that oodles
>of records might have to be modified, I'ld prepare a replace-string
>pseudo code
>
>for every field in both tables and not in exclude list
> tcRep = iif(empty(tcRep), "" ,tcRep + ", ") + fieldname + " with iif(empty(target.fieldname) and !empty(source.fieldname), source.fieldname, target.fieldname)"
>
>and later call
>replace all &tcRep for seek(target.PK, SourceAlias, SourceTag)
>
>which makes just one call to makroexpansion for the whole table.
>Since the whole processing of empty fields is handed off to the runtime,
>it should be faster than checking in a vfp loop after positioning via code.
>
>Also, it is immune against tables with different fcount() and so on -
>but requires same field names and is a bit more work. depends on your data <g>.
>
>
>
>my 0.02 EUR
>
>thomas
Thomas,
Then adding another 0.01 EUR wouldn't hurt:)
I agree building a string and doing a single pass would be better but I actually see danger in both approaches. Empty() function that is:)
-Field(s) might be supporting null
-Field type might be dangerous for this logic < g > ie: a logical. Is .f. empty or .t. then:)
If these problems were not an issue Max() might be used as a shortcut with most datatypes:
tcRep = iif(empty(tcRep), "" ,tcRep + ", ") + fieldname + " with iif(empty(target.fieldname) and !empty(source.fieldname), source.fieldname, target.fieldname)"
tcRep = iif(empty(tcRep), "" ,tcRep + ", ") + fieldname + " with max(source.fieldname, target.fieldname)"
Cetin