You can use data form the following two 4d tables without having to
loop through each of your tables/fields

_USER_CONSTRAINTS

and

_USER_CONS_COLUMNS

. You can find these defined on page 57 or so iof the v_15 sql reference manual

Regards

CHUCK

On Thu, Jan 10, 2019 at 11:01 AM Arnaud de Montard via 4D_Tech
<4d_tech@lists.4d.com> wrote:
>
>
> > Le 8 janv. 2019 à 21:47, Chip Scheide via 4D_Tech <4d_tech@lists.4d.com> 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:4d_tech-unsubscr...@lists.4d.com
> **********************************************************************



-- 
-----------------------------------------------------------------------------------------
 Chuck Miller Voice: (617) 739-0306 Fax: (617) 232-1064
 Informed Solutions, Inc.
 Brookline, MA 02446 USA Registered 4D Developer
       Providers of 4D, Sybase & SQL Server connectivity
          http://www.informed-solutions.com
-----------------------------------------------------------------------------------------
This message and any attached documents contain information which may
be confidential, subject to privilege or exempt from disclosure under
applicable law.  These materials are intended only for the use of the
intended recipient. If you are not the intended recipient of this
transmission, you are hereby notified that any distribution,
disclosure, printing, copying, storage, modification or the taking of
any action in reliance upon this transmission is strictly prohibited.
Delivery of this message to any person other than the intended
recipient shall not compromise or waive such confidentiality,
privilege or exemption from disclosure as to this communication.
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to