FM.field.get.repetition ( )

Function stats

Average user rating
37
305
9999
Support
FileMaker 8.0 +
Date posted
21 April 2011
Version
1
Recursive function
No

Author Info
 Fabrice

70 functions

Average Rating 4.4

author_avatar



 

Function overview

Prototype

FM.field.get.repetition  ( _fullFieldName )


Parameters

_fullFieldName  


Description

Tags:  Dev   Design  

Extracts the repetition number from a full field name, including the repetition number

FM.field.get.repetition ( "table::field[repetition]" ) = repetition

Error is trapped in $$ERROR.CF

Examples

Sample input

FM.field.get.repetition ( "table::field[repetition]" )


Sample output

repetition

 

Function code

/*
FM.field.get.repetition ( _fullFieldName )

by Fabrice Nordmann, 1-more-thing
http://www.1-more-thing.com

Apr 2011

Extracts the repetition number from a full field name, including the repetition number

FM.field.get.repetition ( "table::field[repetition]" ) = repetition


Error is trapped in $$ERROR.CF
*/

Case ( PatternCount ( _fullFieldName ; "::" ) ;
    Let ([
        _fieldname = GetValue ( Substitute ( _fullFieldName ; "::" ; ¶ ) ; 2 ) ;
        _rep = GetAsNumber ( Case (
            Right ( Substitute ( _fieldName ; [ " " ; "" ] ; [ 1 ; "" ] ; [ 2 ; "" ] ; [ 3 ; "" ] ; [ 4 ; "" ] ; [ 5 ; "" ] ; [ 6 ; "" ] ; [ 7 ; "" ] ; [ 8 ; "" ] ; [ 9 ; "" ] ) ; 2 ) = "[]" and Right ( _fieldname ; 2 ) <> "[]" ;
            GetAsNumber ( GetValue ( Substitute ( _fieldName ; "[" ; ¶ ) ; 2 ))
            ))
    ];
    Case ( _rep ; _rep ; 1 )
))


& Let (
    $$ERROR.CF = Case ( EvaluationError ( GetField ( _fullFieldName )) = 102 ; "ERROR 102. FM.field.get.repetition ( " & Quote ( _fullFieldName ) & " ) has thrown an Evaluation Error 102 (field missing)." & Case ( not IsEmpty ( Get ( ScriptName )) ; "¶Script: " & Get ( ScriptName )) & Case ( not IsEmpty ( Get ( ScriptParameter )) ; "¶Parameter: " & Get ( ScriptParameter ))) ; "" )

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

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

    Prototype: FM.field.get.repetition( _fullFieldName )
    Function Author: Fabrice (http://www.fmfunctions.com/mid/37)
    Last updated: 21 April 2011
    Version: 1

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

 

 

 

 

 

 

 

Top Tags

Text Parsing  (31)
List  (28)
Date  (26)
Format  (23)
XML  (22)
Sql  (18)
Dev  (18)
Debug  (15)
Text  (13)
Layout  (13)
Interface  (13)
Variables  (12)
Filter  (11)
Design  (10)
Layout Objects  (8)
Array  (7)