that approach will break if you change the field name, assuming the
field name is hardcoded.
depending on your needs you can do this (code written in email so...):
this code can be run as needed, at process startup (use process vars),
or it can be run at database startup (use Interprocess vars)
$Table_number:=table(->[table])
$Field_Count:=get last field number(->[table])
array text($Field_Names;$field_Count)
array pointer($Field_ptr;$Field_Count)
array longint($Field_Number;$Field_Count)
for($i;1;$Field_Count)
if (is field number valid($table_number;$i))
$Field_Names{$i}:=field name($Table_number;$i)
$Field_ptr{$i}:=FIeld($Table_number;$i)
$Field_Number{$i}:=$i
end if
end for
Then where you need to get the pointer
$loc:=find in array($Field_Names;$Field_name_to_lookup)
if($loc>0)
$Specific_field_Pointer:=$Field_ptr{$loc}
end if
On Thu, 17 May 2018 12:19:11 -0400, Alan Tilson via 4D_Tech wrote:
> Hello out there,
>
> Is it possible to extract a pointer to a field from the table number or
> pointer and the field name?
>
> I'm loading a field using EXECUTE FORMULA and building the
> [tablename]fieldname into the formula, which serves my purposes but seems
> rather awkward!
>
> Thanks,
> Alan
> **********************************************************************
> 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]
> **********************************************************************
---------------
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing
**********************************************************************
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]
**********************************************************************