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
*/
// ===================================
/*__LITBR__VariablesFromObjects ( )__LITBR__by Fabrice Nordmann__LITBR__with thanks to Agnès Barouh, Ugo di Luca and Daniele Raybaudi__LITBR____LITBR__v2.2: Sept 2010, fixed another bug with double quotes (thanks Daniele)__LITBR__v2.1: Sept 2007, fixed a bug with carriage returns__LITBR__v2 : no more parameter is needed (was VariableFromObjects ( start ))__LITBR____LITBR__Loads all current named layout objects, since they are fields or webviewers, in named global variables__LITBR____LITBR__i.e. current layout has :__LITBR__field "A", named "field_A" that contains "1",__LITBR__WebViewer named "wv_B" that contains "2",__LITBR__text label named "lbl_C" that contains "3"__LITBR____LITBR__Evaluating this function will result in 3 global variables :__LITBR__$$field_A will contain "1"__LITBR__$$wv_B will contain "2"__LITBR__$$lbl_C will contain "3"__LITBR____LITBR__Among other ways of evaluating this calculation, you can use :__LITBR__- a Set Variable script step [ $temp ; VariablesFromObjects ( ) ]__LITBR__- an unstored calculation field on your layout and defined as = VariablesFromObjects ( )__LITBR__ In this case, you will need to refresh window to load variables.__LITBR__-----------------*/__LITBR____LITBR__Let([__LITBR___objects = LayoutObjectNames ( Get ( FileName ) ; Get ( LayoutName ) ) ;__LITBR___end = ValueCount ( _objects ) ;__LITBR__$$cfVFO_counter = Case ( IsEmpty ( $$cfVFO_counter ) ; 1 ; $$cfVFO_counter > _end ; "" ; $$cfVFO_counter + 1 ) ;__LITBR___objectName = GetValue ( _objects ; $$cfVFO_counter ) ;__LITBR___value = Substitute ( GetLayoutObjectAttribute ( _objectName ; "content" ) ; [ "\"" ; "\\\"" ] ; [ ¶ ; "\¶" ] ) ;__LITBR___textEval = " let ( $$" & _objectname & "=" & Case ( IsEmpty ( _value ) ; "\"\"" ; "\"" & _value & "\"" ) & "; \"\")"__LITBR__];__LITBR__Case (__LITBR__$$cfVFO_counter <= _end ; If ( _objectName <> "VariablesFromObjects" ; Evaluate ( _textEval ) & VariablesFromObjects ( )__LITBR__)__LITBR__))__LITBR____LITBR__// ===================================__LITBR__/*__LITBR____LITBR__ This function is published on FileMaker Custom Functions__LITBR__ to check for updates and provide feedback and bug reports__LITBR__ please visit http://www.fmfunctions.com/fid/103__LITBR____LITBR__ Prototype: VariablesFromObjects( )__LITBR__ Function Author: Fabrice (http://www.fmfunctions.com/mid/37)__LITBR__ Last updated: 02 September 2010__LITBR__ Version: 1.3__LITBR____LITBR__*/__LITBR__// ===================================
Login or register to comment
Create a new account with fmcustomfunctions.com or login to post a comment.