AnsweredAssumed Answered

Calculated value of object name in Go To Object script step returns Error 116

Question asked by macrolide on Mar 10, 2014
Latest reply on Mar 10, 2014 by macrolide

Title

Calculated value of object name in Go To Object script step returns Error 116

Post

     A custom function called UI_Tab_Selection returns a value (corresponds to the names of tabs on a layout) from a List of values supplied to it. 

UI_Tab_Selection (subjectID ; topicID ; subtopicID ; moduleID ; List_of_TabNames ) // returns a value from List_of_TabNames

     The custom function is defined as

Let ( [
     i=Case (
        moduleID>0;            4;// moduleID isset
        subTopicID>0;          3;// subTopicID isset
        topicID>0;             2;
        subjectID>0;           1;
                               1 // case-default
             );

     tabSelection=MiddleValues(TabList;i;1)
       ]; 

tabSelection )

      

     The function is invoked using parameters as:
UI_Tab_Selection ( gl_SubjectID ; gl_TopicID ; gl_SubTopicID ; gl_ModuleID ; List("subject";"topic";"subtopic";"module") )

     The prefix "gl" for fieldNames is to indicated that it is a global field. These fields are used to capture the primary key values of rows from a portal the user selects on a layout. Scripts on the portal row enforces the user to select first from the "Subject" portal, then "Topic" portal, "Subtopic" portal and lastly "Module" portal.

     For example, using the following values returned the following results with the function in data-viewer

UI_Tab_Selection ( 0 ;0 ; 0 ; 0 ; List("subject";"topic";"subtopic";"module") )//=> "subjectUI_Tab_Selection ( 3 ;12 ; 0 ; 0 ; List("subject";"topic";"subtopic";"module") )//=> "topic"


     I tried to use this function in a in a Go To Object script step to switch between tabs of a tab control on a layout. Tabs of the tab control were given object names using the inspector. The filemaker debugger returned the error 116 (Specified layout object is not present) !!

     A Go-To-Object script step can go to layout objects named "subject", "topic", "subtopic" or "module" when the name of the object is specified as a string. Why doesn't using the return values from the custom function in a Go-to-Object script step do the same thing?

Outcomes