October 20, 201015 yr I'm trying to populate a global key field with a list of values. The global key field - when populated - will, in turn, populate a portal. I am passing parameters when the script is activated (clicking a button in a portal). I am passing two parameters: 1. Source field: the name of a field in a related table which has the values. 2. Target field: the name of the global key field to be populated. I am passing these as strings, not the field content. Once in the script, I declare these parameters as variables: $_sourceField $_targetField The parameters pass fine and the variables are properly set with the names of the fields. Since I am moving around in a portal, I cannot grab the values until I have landed on a different record in the portal, so I need to gather the actual data inside the script. So, in the script, once I have landed on a particular record in the portal and have committed the records, I declare another variable: $_sourceValues; Value: List ( $_sourceField ). What I would like to do next is use Set Field By Name - Set Field By Name [$_targetField ; $sourceValues] However, the content of $_sourceValues is not a list of values. Instead, it shows in the Data Viewer as a question mark (?). I have tied these two (after $_sourceField has been initially declared) $_sourceField; Value: GetFieldName ( $_sourceField ) and $_sourceField; Value: Evaluate ( GetFieldName ( $_sourceField ) ) but $_sourceValues still comes out as "?". I am thinking that the List () function cannot accept variables. Is this correct? Or, am I missing something in my script/parameters? Thanks.
October 20, 201015 yr The List() function expects a reference to a field - not a string containing the field's name. The difference is not always obvious in Filemaker, but if your source field is Child::Value then: List ( $_sourceField ) evaluates to: List ( "Child::Value" ) and this in turn produces error 106 "Table is missing". Try: List ( GetField ( $_sourceField ) ) or: Evaluate ( "List ( " & $_sourceField & " )" )
October 20, 201015 yr Author Try: List ( GetField ( $_sourceField ) ) or: Evaluate ( "List ( " & $_sourceField & " )" ) Thanks, comment. I thought I was probably passing a string, but I didn't know how to turn it back to the field reference. Both of your examples work great. Thanks again.
Create an account or sign in to comment