August 3, 200421 yr So this might be a bit hard to explain but let me give it a go. I have a search interface in which you type the text you're searching for in a global field called "g_SearchText" and there's another global field (formatted as a pull down menu) called "g_SearchCriteria" where the user chooses in which field they will be searching. Now, in scripting the search I am trying to use the SetField function to put together a find based on the user's request. The function looks like this: SetField["g_SearchCriteria" , "g_SearchText"] Here is the problem that arises: When I use the SetField function to put the text from g_SearchText into the appropriate field, the function wants to set g_SearchCriteria rather than the field specified by g_SearchCriteria. Does that make sense? If not, I can post an attachment cuz this is really bugging me.
August 3, 200421 yr You cannot dynamically determine the field to set in a Set Field step. It must be explicit. However, you could test the field and set the appropriate one, such as If [g_SearchCriteria = "field1"] Set Field [field1, "data"] Else If [g_SearchCriteria = "field2"] Set Field [field2, "data"] ... End If End If
August 3, 200421 yr You can get field data from a variable field name (with GetField), but there is no way to Set a variable field name (no SetField [ TextString , Calc ]). You can use a series of If statements in your scripting to set the correct one: If [ g_SearchCriteria = "Name" ] Set Field [ Name ; g_SearchText ] Else If [ g_SearchCriteria = "Age" ] Set Field [ Age ; g_SearchText ] End If ...
Create an account or sign in to comment