On May 17, 2018, at 2:00 PM, Alan Tilson wrote:

> Thank you Koen, Dennis & Chip,
> 
> I probably should have said what I was doing...which is that I'm copying
> certain fields from a sister table with some of the same field names. So I
> step though all the sister table fields and load the values (except for the
> first one which is the ID field) into the primary field. So I hate to look
> through all the field names looking for the one I'm to fill even though it
> probably is fast enough.
> 
> Loading the info into arrays seems like a step in the right direction. But
> I just thought of another idea...using EXECUTE FORMULA to load the pointer
> rather than to use the field value.
> 
> Is there something wrong with this?
> 
> EXECUTE FORMULA("$pField:=->["+tablename+"]"+fieldname)
> 
> It seems to work and it also seems like it would be fast!

Yes this works, but it could have an issue when running compiled by using a 
local variable. Might be more “safe” to use “pField” instead of “$pField” for 
the variable name. 

Also this approach is a bit brittle because it relies on a hard coded table 
name and field name. Change either and this code will fail. That is the 
advantage of referencing tables and fields by number. Never a problem with 
changing the name. 

Tim

*****************************************
Tim Nevels
Innovative Solutions
785-749-3444
[email protected]
*****************************************

**********************************************************************
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