GlobalList ( )

Function stats

Average user rating
46
232
9999
Support
FileMaker 8.0 +
Date posted
20 July 2009
Last updated
22 July 2009
Version
Recursive function
No

Author Info
 Agnès

17 functions

Average Rating 4.6

author_avatar



 

Function overview

Prototype

GlobalList  ( KeepTable;   ExcludeTable;   KeepGlobal;   ExcludeGlobal;   Attribute;   Option;   View )


Parameters

KeepTable  Filter of Table Occurrences


ExcludeTable  Filter of Table Occurrences


KeepGlobal  Filter of globals fields


ExcludeGlobal  Filter of globals fields


Attribute  Source or Content (or S or C ). Empty, no résult.


Option  1 or Empty, 1 for have type and comment


View  “List” or “Web” or Empty ( saw file example )


Description

Tags:  CustomList List Global Field File  

File Example here :
http://www.tictac.fr/CoinFileMaker/PageGlobalList.html

GlobalList ( KeepTable ; ExcludeTable ; KeepGlobal ; ExcludeGlobal ; Attribute ; Option ; View )v3.1
requires CustomList( start; End; Function )
Not Recursive
------------------------------------

Have a list or content of globalFields for the whole or part of a file.
Keeps global, simple, calculated or not, repeating field or not.

• returns the list of global used: occurrence, types, comments, names and content, for all occurrences selected.
• as filters and options selected results. 3 different formats list.

• If your selected occurrences have the same name as your layout, you only get the overall list are placed on your layout.
• Depending on the size of the file, the calculation may take a long time, it is important of filtering tables and field to maintain and exclude.

1/ Filter parameters of Table Occurrences, KeepTable & ExcludeTable,. Not case sensitive, Empty, one or more as a list..

> KeepTable : Empty or value(s) • Empty : the global list for all occurrences of your file.
• Not Empty : the global list for all occurrences whose name contains one of the values.

> ExcludeTable : Empty or value(s) • Empty : the global list for all occurrences of your file. selected with KeepTable
• Not Empty : excluded from the list overall global for occurrences whose name contains one of the values.

Example : GlobalList( "z_"; “_ctc_¶z_s” ; ... :
Returns a list of all global for occurrences containing "z_" in their name, but not containing "_ctc_" or "z_s"

2/ Filter parameters of globals , KeepGlobal & ExcludeGlobal. Not case sensitive, Empty, one or more as a list..

> KeepTable : Empty or value(s) • Empty : the global list for all occurrences previously selected.
• Not Empty : List only the global whose name contains one of the values for occurrences previously selected.

> ExcludeTable : Empty or value(s) • Empty : the global list selected with KeepGlobal
• Not Empty : excluded from the list overall global whose name contains one of the values for occurrences previously selected.

Example : GlobalList( "z_"; “_ctc_¶z_s” ; "zkv_¶zki_"; "zkv_g"; ... :
Returns a list of all global whose name contains "zkv_" or "zki_" but not containing "zkv_g" for occurrences previously selected.

3/Parameters result, Attribute, Option & View :

> Attribute : Source or Content (or S or C ). Empty, no résult.
• Source : list of occurrences selected with global field name selected :
NameTable1¶NameTable1::GlobalName1¶NameTable1::GlobalName2, if not global, returns "-NoGlobalFound-"
• Content : Add in the list the content for each global selected, if the content is empty, returns "-Empty-"

> Option : 1 or Empty
• “1” : add in the list , type and field comments for each global selected.

> View : “List” or “Web” or Empty
• Empty : List without “mise en page” (with • and ——)
• “List” : List with "mise en page".
• “Web” : List in table format, readable in a Web Viewer or exported, including HTML

Example :
GlobalList( "z_"; “_ctc_¶z_s” ; "zkv_¶zki_"; "zkv_g"; “Source” ; “1” ; “List” )
GlobalList( "z_"; “_ctc_¶z_s” ; "zkv_¶zki_"; ""; “Content” ; “1” ; “Web” )

Examples

Sample input

GlobalList( "z_"; “_ctc_¶z_s” ; "zkv_¶zki_"; "zkv_g"; “Source” ; “1” ; “List” )
-----------------
GlobalList( "z_"; “_ctc_¶z_s” ; "zkv_¶zki_"; ""; “Content” ; “0” ; “Web” )


Sample output

List of globalFields
name & type & comment
-----------------
List of globalFields
name & type & comment & content. table
[saw file example please]

 

Function code

// GlobalList ( KeepTable ; ExcludeTable ; KeepGlobal ; ExcludeGlobal ; Attribute ; Option ; View )v3.1
// requires CustomList( start; End; Function )
//------------------------------------
/*
Have a list or content of globalFields for the whole or part of a file.
Keeps global, simple, calculated or not, repeating field or not.

• returns the list of global used: occurrence, types, comments, names and content, for all occurrences selected.
• as filters and options selected results. 3 different formats list.

• If your selected occurrences have the same name as your layout, you only get the overall list are placed on your layout.
• Depending on the size of the file, the calculation may take a long time, it is important of filtering tables and field to maintain and exclude.

1/ Filter parameters of Table Occurrences, KeepTable & ExcludeTable,. Not case sensitive, Empty, one or more as a list..

> KeepTable : Empty or value(s) • Empty : the global list for all occurrences of your file.
• Not Empty : the global list for all occurrences whose name contains one of the values.

> ExcludeTable : Empty or value(s) • Empty : the global list for all occurrences of your file. selected with KeepTable
• Not Empty : excluded from the list overall global for occurrences whose name contains one of the values.

Example : GlobalList( "z_"; “_ctc_¶z_s” ; ... :
Returns a list of all global for occurrences containing "z_" in their name, but not containing "_ctc_" or "z_s"

2/ Filter parameters of globals , KeepGlobal & ExcludeGlobal. Not case sensitive, Empty, one or more as a list..

> KeepTable : Empty or value(s) • Empty : the global list for all occurrences previously selected.
• Not Empty : List only the global whose name contains one of the values for occurrences previously selected.

> ExcludeTable : Empty or value(s) • Empty : the global list selected with KeepGlobal
• Not Empty : excluded from the list overall global whose name contains one of the values for occurrences previously selected.

Example : GlobalList( "z_"; “_ctc_¶z_s” ; "zkv_¶zki_"; "zkv_g"; ... :
Returns a list of all global whose name contains "zkv_" or "zki_" but not containing "zkv_g" for occurrences previously selected.

3/Parameters result, Attribute, Option & View :

> Attribute : Source or Content (or S or C ). Empty, no résult.
• Source : list of occurrences selected with global field name selected :
NameTable1¶NameTable1::GlobalName1¶NameTable1::GlobalName2, if not global, returns "-NoGlobalFound-"
• Content : Add in the list the content for each global selected, if the content is empty, returns "-Empty-"

> Option : 1 or Empty
• “1” : add in the list , type and field comments for each global selected.

> View : “List” or “Web” or Empty
• Empty : List without “mise en page” (with • and ——)
• “List” : List with "mise en page".
• “Web” : List in table format, readable in a Web Viewer or exported, including HTML

Example : GlobalList( "z_"; “_ctc_¶z_s” ; "zkv_¶zki_"; "zkv_g"; “Source” ; “1” ; “List” )
GlobalList( "z_"; “_ctc_¶z_s” ; "zkv_¶zki_"; ""; “Content” ; “1” ; “Web” )
*/
//-------------------------------------------------------*/
// Agnès Barouh - Juin 2009 - Substitute( filemaker§tictac.fr; §; @ )
// File example : http://www.tictac.fr/CoinFileMaker/PageGlobalList.html
//-------------------------------------------------------*/


Let([
$gl_KT = Upper( KeepTable );
$gl_ET = Upper( ExcludeTable );
$gl_KG = Upper( KeepGlobal );
$gl_EG = Upper( ExcludeGlobal );
$gl_AT = Left( Attribute; 1 ) ;
$gl_OP = Option;
$gl_VW = View;

$rc = ¶; $gl_o = "["; $gl_f = "]"; $gl_Fie = "::" ; $gl_FieF = "</:|:>" ; $null = "" ; $gl_BR = "<br />" ;
$gl_k = "kkeepp"; $gl_n = "nnonee";
$gl_Tab = "<glaTab>"; $gl_TabF = "</glaTab>" ;
$gl_Typ = "<glaTyp>" ; $gl_Con = "<glaCon>" ;
$gl_Com = "<glaCom>" ; $gl_ComF = "</glaCom>" ;
$gl_Glob = "Global" ; $gl_Stor = "StoredCalcUnindexed" ;
$gl_FI = Get ( FileName ) ;

$gl_FirstList = TableNames( $gl_FI );

/* Table */ $gl_keepT = Case( IsEmpty( $gl_KT & $gl_ET ); $gl_FirstList;
Let([
$gl_List = Substitute( Upper( $gl_FirstList ) ; [ $rc ; $rc & "glarc" ] );
$gl_Count = ValueCount( $gl_ET )+0;
$gl_Val = Case( not IsEmpty( $gl_ET ) ; $gl_ET & ¶ ) & ¶ & $gl_KT ;
Trigger = CustomList( 1; ValueCount( $gl_Val );
"Let([V = GetValue( $gl_Val; [n] ); $gl_List = Substitute( $gl_List; V; Case(([n]+0) ≤ $gl_Count; $gl_n ; $gl_k ))]; $null)" ) ;
$gl_List = Substitute( $gl_List ; "glarc" ; "" )
]; Case( IsEmpty( $gl_KT );
FilterValues($gl_FirstList; $gl_List);
CustomList( 1; ValueCount( $gl_List );
"Let([V = GetValue( $gl_List; [n] )]; Case( PatternCount( V; $gl_k ) And not PatternCount( V; $gl_n ); GetValue( $gl_FirstList; [n] )))"))));

$gl_CountE = ValueCount( $gl_EG );
$gl_CountK = ValueCount( $gl_KG );

/* Field */ $gl_keepF = CustomList( 1; ValueCount( $gl_keepT );
"Let([
$OT = GetValue( $gl_keepT; [n] );
$gl_FL = FieldNames( $gl_FI ; $OT );
$gl_FLM = Substitute( Upper( $gl_FL ) ; [ $gl_Fie ; $gl_n ] );
trigger = CustomList( 1; $gl_CountE ; \"Let([ V = GetValue( $gl_EG; [n] ); $gl_FLM = Substitute( $gl_FLM ; V ; $gl_n )];$null)\") ;
$gl_FL = FilterValues( $gl_FL ; $gl_FLM );
$gl_FLM = Substitute( Upper ( $gl_FL ) ; [ $rc ; $rc & \"glarc\"] ) ;
trigger = CustomList( 1; $gl_CountK ; \"Let([ V = GetValue( $gl_KG; [n]); $gl_FLM = Substitute( $gl_FLM ; V ; $gl_k )];$null)\") ;
$gl_FLM = Substitute ( $gl_FLM ; [$gl_k ; \"\"] ; [ \"glarc\" ; \"\"] );
$gl_tou = Case ( $gl_CountK < 1 ; $gl_FL; CustomList( 1; ValueCount( $gl_FLM ); \"Let([ V = GetValue( $gl_FL; [n] )]; Case( V <> GetValue( $gl_FLM; [n] ); V ))\")) ;
Re = CustomList( 1; ValueCount( $gl_Tou );
\"Let([ V = $OT & $gl_Fie & GetValue( $gl_Tou; [n] ); TypeAll = FieldType( $gl_FI ; V ); G = LeftWords( TypeAll; 1 ); Ite = RightWords( TypeAll; 1 ) + 0 ;
$gl_Res = Case( G = $gl_Glob ; V; Case( G & MiddleWords( TypeAll; 3; 1 ) = $gl_Stor ; EvaluationError( Evaluate( V ))) = 0; V )
]; Case( not IsEmpty( $gl_Res ); Case( $gl_OP = 1; $gl_Typ & TypeAll & $gl_Com & Substitute( FieldComment( $gl_FI ; V ) ; $rc ; $gl_BR ) & $gl_ComF & $rc )
& Case( Ite = 1 ; $gl_Res ; CustomList( 1; Ite; \"\"$gl_Res & $gl_o & [n] & $gl_f \"\") )))\")
]; $gl_Tab & TextStyleAdd( $OT ; Bold ) & $gl_TabF & $rc & Re )");

$gl_Result = Case( $gl_AT = "S"; $gl_keepF;
$gl_AT = "C"; CustomList( 1; ValueCount( $gl_keepF );
"Let([
V = GetValue( $gl_keepF; [n] );
Test = PatternCount( V; $gl_Fie ) and not PatternCount( V; $gl_Typ ); T = Case( Test > 0; Evaluate( V ))
]; Case( Test < 1; V ; V & $gl_Con & Case( IsEmpty( T ); \"-Empty-\"; Substitute( T ; [$rc ; $gl_BR ] ; [ $gl_Fie ; $gl_FieF ]))))")) ;

$gl_keepF = "" ; $gl_FirstList = "" ; $gl_List = "" ; $gl_keepT = "" ; $gl_FL = "" ; $gl_FLM = "" ; $gl_OT = "" ; $gl_Res = "" ;

R = Case( IsEmpty( View ) ;
Substitute( $gl_Result ; [$gl_Tab ; "" ] ; [$gl_TabF ; ""] ; [$gl_Typ ; ""] ; [$gl_Com ; "¶"] ; [$gl_ComF ; ""] ; [$gl_Con ; "¶"] ; [$gl_BR ; ¶ ] ) ;

View = "List";
Substitute( $gl_Result ; [$gl_Tab ; "——————————————————¶" & TextStyleAdd ( TextColor ( "•" ; RGB ( 255 ; 100 ; 0 ) ) & " Table" ; Bold ) & " : " ] ; [$gl_TabF ; ""] ;
[$gl_Typ ; "——————————————————¶• Type : "] ; [$gl_Com ; "¶• Comment : "] ; [$gl_ComF ; ""] ; [$gl_Con ; "¶• Content : "] ; [$gl_BR ; ¶ ] ; [$gl_FieF ; "::"] ) ;
View = "Web";
Let([
WebEnTete = "<html><style type=\"text/css\">
body { background-color: #E9E8E6;}
table { margin: auto; background-color: #EEEEEE; border: 4px outset #636375; border-collapse: collapse; }
th { background-color: #636375; color: #EEEEEE; font-size: 11px; }
td, th { height: 25px; vertical-align: Midde; border: 1px solid black; font-family: Verdana, Arial, Helvetica, Times, serif; text-align: Left; padding: 5px; font-size: 10px; }
</style> <body><table border=1>
<tr><th colspan = 7>Globals from file : " & $gl_FI & "</th></tr>
<tr><th width = 20px>n°</th><th>Occurrences</th>" &
Case( $gl_OP = 1 ; "<th>GlobalType</th><th>GlobalComment</th>" ) &
"<th width = 20px>n°</th><th>GlobalName</th>" &
Case( $gl_AT = "C" ; "<th>GlobalContent</th>" ) & "</tr>" ;
WebEnFin = "</table></body></html>" ;

$gl_Row = "<td rowspan=" ; $gl_RowE = ">" ;
$gl_TdL = "<td>" ; $gl_TdR = "</td>" ;
$gl_TrL = "<tr>" ; $gl_TrR = "</tr>" ;
$gl_Num = "<gla_Num>" ;

$gl_Web = Substitute( $gl_Result & $gl_Tab ; [$gl_TabF & $rc ; Case( $gl_OP = 1 ; "</td>" ; "</td><td>1</td><td>" )] ; [$gl_TabF ; Case( $gl_OP = 1 ; "</td>" ; "</td><td>1</td><td>" )] ;
[ $gl_Com ; "</td>" & $gl_Com ] ;[$gl_ComF & $rc ; "</td><td><gla_Num></td><td>"] ) ;

Web = Case( $gl_OP = 1 ;
CustomList( 1 ; PatternCount( $gl_Web ; $gl_Tab ) - 1 ;
"Let([ PosL = Position( $gl_Web ; $gl_Tab ; 1 ; [n] ) ;
$gl_Ex = Middle( $gl_Web ; PosL ;(Position( $gl_Web ; $gl_Tab ; 1 ; [n] + 1 )) - PosL ) ;
NField = PatternCount( $gl_Ex ; $gl_Fie ) ;
NType = PatternCount( $gl_Ex ; $gl_Typ ) ;
$gl_ExT = Substitute( $gl_Ex ; [$gl_Tab ; $gl_Row & NField & $gl_RowE ] ; [$gl_Typ ; $rc & $gl_Typ ]) ;
$gl_Xml = CustomList( 1 ; NType ; \"Let([
V = $gl_ExT & $rc & $gl_Typ ;PosL = Position( V ; $gl_Typ ; 1 ; [n] ) ; ExTy = Middle( V ; PosL ; Position( V ; $gl_Typ ; 1 ; [n] + 1 ) - PosL - 1 ) ; NFieldB = PatternCount( ExTy ; $gl_Fie )
]; Case( [n] > 1 ; $gl_TrL ) & Substitute( ExTy ; [$gl_Typ ; $gl_Row & NFieldB & $gl_RowE] ; [$gl_Com ; $gl_Row & NFieldB & $gl_RowE & $gl_Com ] ))\") ;
TF = CustomList( 1 ; ValueCount( $gl_Xml ) ;
\"Let([ V = GetValue( $gl_Xml ; [n] ) ]; Case( PatternCount( V ; $gl_Fie) And Not PatternCount( V ; $gl_TdL ) ; $gl_TrL & $gl_TdL & [n] & $gl_TdR & $gl_TdL & V & $gl_TdR & $gl_TrR ; Substitute( V ; $gl_Num ; [n] ) & $gl_TdR ))\" )
]; $gl_TrL & $gl_Row & NField & $gl_RowE & [n] & $gl_TdR & GetValue( $gl_ExT ; 1 ) & TF & Case( Nfield < 1 ; $gl_TdL & $gl_TdR ) & $gl_TrR )" )
;
CustomList( 1 ; PatternCount( $gl_Web ; $gl_Tab ) - 1 ;
"Let([ PosL = Position( $gl_Web ; $gl_Tab ; 1 ; [n] ) ;
$gl_Ex = Middle( $gl_Web ; PosL ; Position( $gl_Web ; $gl_Tab ; 1 ; [n] + 1 ) - PosL ) ;
NField = PatternCount( $gl_Ex ; $gl_Fie ) ;
$gl_ExT = Substitute( $gl_Ex ; [$gl_Tab ; $gl_Row & NField & $gl_RowE] ) ;
T = Case( NField < 2 ; $gl_ExT & $gl_TdR ; GetValue( $gl_ExT ; 1 ) & $gl_TdR & $rc & CustomList( 2 ; NField ; \"$gl_TrL & $gl_TdL & [n] & $gl_TdR & $gl_TdL & GetValue( $gl_ExT ; [n] ) & $gl_TdR & $gl_TrR\" ))
]; $gl_TrL & $gl_Row & NField & $gl_RowE & [n] & $gl_TdR & T )" )
)
];
WebEnTete & Substitute( Web ; [$gl_Com & "</td>" ; "-NoComment-</td>"] ; [$gl_Com ; ""] ; [$gl_Con ; "</td><td>"] ; [$gl_FieF ; "::"] ;
["<td></td>" ; "<td colspan=\"" & Case ( $gl_OP = 1 and $gl_AT = "C" ; 5 ; $gl_OP = 1 and $gl_AT = "S" ; 4 ; $gl_AT = "C" ; 2 ) & "\">" & "-NoGlobalFound-</td>"] ) & WebEnFin
)) ;
$gl_Result = "" ; $gl_Web = ""
];
R
)

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

    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/232

    Prototype: GlobalList( KeepTable; ExcludeTable; KeepGlobal; ExcludeGlobal; Attribute; Option; View )
    Function Author: Agnès (http://www.fmfunctions.com/mid/46)
    Last updated: 22 July 2009
    Version: 1.4

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

 

Comments

Agnès
20 July 2009



Carrefull : to gain speed, you really filter tables (with KeepTable ), and have good naming rules
(Edited by Agnès on 25/07/09 )
  General comment