GroupRelationInfo ( )

Function stats

Average user rating
46
252
9999
Support
FileMaker 8.5 +
Date posted
16 March 2010
Last updated
17 March 2010
Version
Recursive function
No

Author Info
 Agnès

17 functions

Average Rating 4.6

author_avatar



 

Function overview

Prototype

GroupRelationInfo  ( FileTarget;   TableTarget;   Result )


Parameters

FileTarget  Get ( FileName ) or name of a file open or related file


TableTarget  name of the target occurrence, between quotes or Get ( LayoutTableName )


Result  Field or F or 1 or Table or T or 0 ( default : Table )


Description

Tags:  List Relation RelationInfo  

To retrieve a list of occurrences or fields only for a group of links.
3 parameters, the filename and the target occurrence and the desired result

If result = 0 :
just all Occurrences related directly or indirectly to the selected occurrences of n Occurrences on the application

If result = 1 :
all Fields for the above group Occurrences related directly or indirectly to the selected occurrences

* result = 1 ( returns the list of fields contained in a layout if the occurrence in the same name as a layout )

Carreful :
On the code, you have 25 :
(...)
Trigger = CustomList ( 1 ; 25 ; (...)

> Is the RelationInfo_Max : 10 or 200 or n Occurrences related of max 25 Occurrences related in line :
Occurrence1 <-> Occurrence2 <-> [...] <-> Occurrence25


- You can filter the list with FilterList()
http://www.fmfunctions.com/fid/150
- And you can suggest fields to a user to export only data from an related group.

Examples

Sample input

GroupRelationInfo ( Get ( FileName ) ; Get ( LayoutTableName ) ; 0 )





--------------------------
GroupRelationInfo ( Get ( FileName ) ; "cre_CRE_Table" ; 1 )


Sample output

cre_CRE_Table
cre_TAF_TableAndField
cre_CRE_CustomReport
cre_FTA_FileTarget

--------------------------
cre_CRE_Table::zkv_TargetFile
cre_CRE_Table::zkp_IDCustomExport
cre_CRE_Table::ResultatExport
cre_CRE_Table::zkv_TargetTable
cre_CRE_Table::zc_FileTargetTable
cre_TAF_TableAndField::zkp_IDTableAndField
cre_TAF_TableAndField::zkv_ClefMagique
cre_TAF_TableAndField::ColSpan
cre_TAF_TableAndField::RowSpan
cre_TAF_TableAndField::VerticalAlign
cre_TAF_TableAndField::TextAlign
cre_TAF_TableAndField::zks_IDCustomExport
cre_CRE_CustomReport::zkv_TargetFile
cre_CRE_CustomReport::zkp_IDCustomExport
cre_CRE_CustomReport::ResultatExport
cre_CRE_CustomReport::zkv_TargetTable
cre_CRE_CustomReport::zc_FileTargetTable
cre_FTA_FileTarget::zkp_IDTableAndField
cre_FTA_FileTarget::zkv_ClefMagique
cre_FTA_FileTarget::zks_IDCustomExport
cre_FTA_FileTarget::TableField

 

Function code

//GroupRelationInfo ( FileTarget ; TableTarget ; Result ) v1.6
//Requires CustomList ( Start ; End ; Function )
//--------------------------------------
/*
• FileTarget : Get ( FileName ) or the name of a file open or related file.
• TableTarget : name of the target occurrence, between quotes or Get ( LayoutTableName )
• Result : Field or F or 1 or Table or T or 0 ( default : Table )
> If Result = Table or T or 0, returns a list of all occurrences of tables related to "TableTarget".
> If Result = Field ou F ou 1, returns a list of all fields of occurrences of tables related to "TableTarget" as Table::Field
( returns the list of fields contained in a layout if the occurrence in the same name as a layout )

> RelationInfo_Max : n Occurrences related of max 25 Occurrences related in line :
Occurrence1 <-> Occurrence2 <-> [...] <-> Occurrence25

> ex > GroupRelationInfo ( Get ( FileName ) ; Get ( LayoutTableName ) ; 0 ) And Get ( LayoutTableName ) = cre_CRE_Table
Return :
cre_CRE_Table
cre_TAF_TableAndField
cre_CRE_CustomReport
cre_FTA_FileTarget

=> just all Occurrences related directly or indirectly to cre_CRE_Table of n Occurrences on the application

> ex > GroupRelationInfo ( Get ( FileName ) ; "cre_CRE_Table" ; 1 )
Return :
cre_CRE_Table::zkv_TargetFile
cre_CRE_Table::zkp_IDCustomExport
cre_CRE_Table::ResultatExport
cre_CRE_Table::zkv_TargetTable
cre_CRE_Table::zc_FileTargetTable
cre_TAF_TableAndField::zkp_IDTableAndField
cre_TAF_TableAndField::zkv_ClefMagique
cre_TAF_TableAndField::ColSpan
cre_TAF_TableAndField::RowSpan
cre_TAF_TableAndField::VerticalAlign
cre_TAF_TableAndField::TextAlign
cre_TAF_TableAndField::zks_IDCustomExport
cre_CRE_CustomReport::zkv_TargetFile
cre_CRE_CustomReport::zkp_IDCustomExport
cre_CRE_CustomReport::ResultatExport
cre_CRE_CustomReport::zkv_TargetTable
cre_CRE_CustomReport::zc_FileTargetTable
cre_FTA_FileTarget::zkp_IDTableAndField
cre_FTA_FileTarget::zkv_ClefMagique
cre_FTA_FileTarget::zks_IDCustomExport
cre_FTA_FileTarget::TableField

=> all Fields for the above group

*/
//------------------------------------------------------------*/
// Agnès Barouh - Decembre 2009 - Substitute( filemaker§tictac.fr; §; @ )
//------------------------------------------------------------*/
Let ([

$rc = ¶ ;
$ri_Ta = "Table:" ; $ri_Tp = "::" ;
$ri_TT = FileTarget ;
$ri_CL1 = TableTarget ;
$ri_CL2 = RelationInfo ( $ri_TT; $ri_CL1 ) ;
$ri_CLR = $ri_CL1 ;
R = Case ( Left ( Result ; 1 ) = "F" or Result = 1 ; 1 ; 0 ) ;

Trigger = CustomList ( 1 ; 25 ;
"Case ( Not IsEmpty ( $ri_CL1 ) ;
Let ([
$ri_CL1 = CustomList ( 1 ; ValueCount ( $ri_CL2 ) ;
\"Let ([ V = GetValue ( $ri_CL2 ; [n] ) ; VR = Middle ( V ; 7 ; Length ( V ) ) ];
Case (( PatternCount ( V ;$ri_Ta ) And Not PatternCount ( V ; $ri_Tp ) And Not PatternCount ( $rc & $ri_CLR & $rc ; $rc & VR & $rc )) ; VR ) )\" ) ;
$ri_CL2 = CustomList ( 1 ; ValueCount ( $ri_CL1 ) ; \"RelationInfo ( $ri_TT; GetValue ( $ri_CL1 ; [n] ) )\" ) ;
$ri_CLR = $ri_CLR & $rc & $ri_CL1 ]; \"\" ))" )

];
Choose ( R ; $ri_CLR ;
CustomList ( 1 ; ValueCount ( $ri_CLR ) ;
"Let ([ V = GetValue ( $ri_CLR ; [n] ) ]; V & $ri_Tp & Substitute ( FieldNames ( $ri_TT ; V ) ; $rc ; $rc & V & $ri_Tp ))" )
)
)

// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/252

    Prototype: GroupRelationInfo( FileTarget; TableTarget; Result )
    Function Author: Agnès (http://www.fmfunctions.com/mid/46)
    Last updated: 17 March 2010
    Version: 1.2

*/
// ===================================