> Le 8 janv. 2019 à 21:47, Chip Scheide via 4D_Tech <[email protected]> a
> écrit :
>
> given a pointer to a table, or a pointer to a field of a table,
> I want to be able, for the current record of this table, to :
Hi Chip,
I use this for foreign keys:
//DB_getForeignKeys (aTable_p)
$parentTable_l:=Table($1)
$FKarray_p:=$2
CLEAR VARIABLE($FKarray_p->)
For ($table_l;1;Get last table number)
Case of
: (Not(Is table number valid($table_l)))
: ($table_l=$parentTable_l)
Else
For ($field_l;1;Get last field number($table_l))
If (Is field number valid($table_l;$field_l))
GET RELATION
PROPERTIES($table_l;$field_l;$destinationTable_l;$destinationField_l)
If ($parentTable_l=$destinationTable_l)
APPEND TO
ARRAY($FKarray_p->;Field($table_l;$field_l))
End if
End if
End for
End case
End for
$0:=Size of array($FKarray_p->)
Primary is easier, just loop through fields of the start table and check if a
relation exists for the current one (as above).
--
Arnaud de Montard
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive: http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************