> Le 17 mai 2018 à 19:24, Alan Tilson via 4D_Tech <[email protected]> a 
> écrit :
> 
> [...]
> Is there something wrong with this?
> 
> EXECUTE FORMULA("$pField:=->["+tablename+"]"+fieldname)
> ​
> It seems to work and it also seems like it would be fast!

Not sure, it calls the interpreter while a loop does not. Mostly, as Neil said, 
it will fail in compiled mode as EXECUTE FORMULA does not work with $local 
variables:
<http://doc.4d.com/4Dv16R6/4D/16-R6/EXECUTE-FORMULA.301-3548365.en.html>

In your situation, I'd use any mentioned trick (execute formula, loop through 
fields…) to generate hardcode to paste, something like this:
  ++++++
  $code:=""
  for($i;1;$fieldCount)
    $source:=getFieldName(table1;$i)
    $target:=getFieldByName(table2;$source)
    $code:=$code+$target+":="+$source+"\r"
  end for
  set text to pasteboard($code)  //then paste in the method… 
  ++++++
No hidden fields references, surely the fastest. 

-- 
Arnaud de Montard 




**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to