VariablesFromObjects ( )

Function stats

Average user rating
37
103
9999
Support
FileMaker 8.5 +
Date posted
05 December 2008
Last updated
02 September 2010
Version
Recursive function
Yes

Author Info
 Fabrice

76 functions

Average Rating 4.4

author_avatar



 

Function overview

Prototype

VariablesFromObjects  (  )


Parameters

No parameters for this function.


Description

Tags:  Variables   Layout Objects   Layout   Debug  

Loads all current named layout objects, since they are fields or webviewers, in named global variables

i.e. current layout has :
field "A", named "field_A" that contains "1",
WebViewer named "wv_B" that contains "2",
text label named "lbl_C" that contains "3"

Evaluating this function will result in 3 global variables :
$$field_A will contain "1"
$$wv_B will contain "2"
$$lbl_C will contain "3"

Among other ways of evaluating this calculation, you can use :
- a Set Variable script step [ $temp ; VariablesFromObjects ( ) ]
- an unstored calculation field on your layout and defined as = VariablesFromObjects ( )
In this case, you will need to refresh window to load variables.

Examples

Sample input

if current layout has :
field "A", named "field_A" that contains "1",
WebViewer named "wv_B" that contains "2",
text label named "lbl_C" that contains "3"


Sample output

Evaluating this function will result in 3 global variables :
$$field_A will contain "1"
$$wv_B will contain "2"
$$lbl_C will contain "3"

 

Function code

/*
VariablesFromObjects ( )
by Fabrice Nordmann
with thanks to Agnès Barouh, Ugo di Luca and Daniele Raybaudi

v2.2: Sept 2010, fixed another bug with double quotes (thanks Daniele)
v2.1: Sept 2007, fixed a bug with carriage returns
v2 : no more parameter is needed (was VariableFromObjects ( start ))

Loads all current named layout objects, since they are fields or webviewers, in named global variables

i.e. current layout has :
field "A", named "field_A" that contains "1",
WebViewer named "wv_B" that contains "2",
text label named "lbl_C" that contains "3"

Evaluating this function will result in 3 global variables :
$$field_A will contain "1"
$$wv_B will contain "2"
$$lbl_C will contain "3"

Among other ways of evaluating this calculation, you can use :
- a Set Variable script step [ $temp ; VariablesFromObjects ( ) ]
- an unstored calculation field on your layout and defined as = VariablesFromObjects ( )
In this case, you will need to refresh window to load variables.
-----------------*/

Let([
_objects = LayoutObjectNames ( Get ( FileName ) ; Get ( LayoutName ) ) ;
_end = ValueCount ( _objects ) ;
$$cfVFO_counter = Case ( IsEmpty ( $$cfVFO_counter ) ; 1 ; $$cfVFO_counter > _end ; "" ; $$cfVFO_counter + 1 ) ;
_objectName = GetValue ( _objects ; $$cfVFO_counter ) ;
_value = Substitute ( GetLayoutObjectAttribute ( _objectName ; "content" ) ; [ "\"" ; "\\\"" ] ; [ ¶ ; "\¶" ] ) ;
_textEval = " let ( $$" & _objectname & "=" & Case ( IsEmpty ( _value ) ; "\"\"" ; "\"" & _value & "\"" ) & "; \"\")"
];
Case (
$$cfVFO_counter <= _end ; If ( _objectName <> "VariablesFromObjects" ; Evaluate ( _textEval ) & VariablesFromObjects ( )
)
))

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

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

    Prototype: VariablesFromObjects( )
    Function Author: Fabrice (http://www.fmfunctions.com/mid/37)
    Last updated: 02 September 2010
    Version: 1.3

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

 

 

 

 

 

 

 

Top Tags

Text Parsing  (33)
List  (32)
Date  (28)
XML  (26)
Format  (23)
Sql  (22)
Dev  (20)
Debug  (17)
Layout  (15)
Interface  (15)
Text  (14)
Variables  (12)
Filter  (11)
Layout Objects  (11)
Design  (10)
Array  (8)