tomswell

obtain internal id function not working

Discussion created by tomswell on Jan 12, 2017
Latest reply on Jan 12, 2017 by Malcolm

I downloaded the following function from Brian Dunning site > FileMaker Custom Function:IDFromName ( _Name ; _Type ; _File )

 

/* Type must be either Layout, Script, Table, Value, or, for Fields, supply layout via "Type"

File defaults to current if you don't specify

*/

Let (  [

 

// File defaults to current

_Fn = If ( IsEmpty ( _File ) ; Get ( FileName ); _File );

 

_IDs = Case( _Type = "Layout"; LayoutIDs ( _Fn ) ; _Type = "ValueList" ; ValueListIDs ( _Fn ) ; _Type = "Script" ; ScriptIDs ( _Fn ) ; _Type = "Table" ; TableIDs ( _Fn ) ; FieldIDs ( _Fn ; _Type ) ) ;

 

_N = Case( _Type = "Layout"; LayoutNames ( _Fn )  ; _Type = "ValueList" ; ValueListNames ( _Fn ) ; _Type = "Script" ; ScriptNames ( _Fn ) ; _Type = "Table" ; TableNames ( _Fn ) ; FieldNames ( _Fn ; _Type ) ) ;

 

_p1 = Position ( "¶" & _N & "¶" ; "¶" & _Name & "¶" ; 1 ; 1 ) ;

_n1 = Left (_N; _p1 ) ;

_p2 = ValueCount (_n1 ) ] ;

If ( _p1 ; GetValue ( _IDs ; _p2 ) )

)

 

 

while having appropriate table open

entering this in data viewer yields nothing;

 

IDFromName ( table name::field name ;"Layout"; Get ( FileName))

or

IDFromName ( table name::field name ;"Layout"; "")

 

I'm close  .... what am i doing wrong ?

  not sure how to interpret "Type must be either Layout, Script, Table, Value, or, for Fields, supply layout via "Type"

I wish to create a field $identifier so as to be able to return to the table field on layout i have previously left,

using internal field id an alternative to using field name as reference.

 

... seems there's a lacking FM function Get(ActiveField_Internal_id)

Outcomes