michele Posted April 1, 2002 Share Posted April 1, 2002 I'd like to find a way of using a script step that would have the same effect as "go to field" but without having to specify which field to go to. The name of the field to go to would be in a global. In the same way you can specify this in "go to record" This would save me about 70 scripts... Any idea how I can do this? As I'm at it, I'd also like to use "set field" in the same way - the field to be set is the one which's name is in a global. This must be a tough (or impossible) one, but I really hope a genius among you knows how to do what I'm asking for in filemaker 5.0., well I don't even know if it's possible in 5.5, is it? Thankyou for reading and eventually answering my question. Link to comment Share on other sites More sharing options...
Steven H. Blackwell Posted April 1, 2002 Share Posted April 1, 2002 In FileMaker Pro 5.5 you can modify the "GetField" ScriptMaker step to do some of this. HTH Old Advance Man Link to comment Share on other sites More sharing options...
michele Posted April 17, 2002 Author Share Posted April 17, 2002 Very nice...thanks. Link to comment Share on other sites More sharing options...
Newbies FW Posted April 17, 2002 Newbies Share Posted April 17, 2002 michele, It's certainly possible, and not too tough. Heres one way to do it: I set up a test file with 5 data fields field1 (text) field2 (text) field3 (text) field4 (text) field5 (global text) and 3 script function fields loop stop (global text) field count (global number) loop count (global number) The following script will enter "Strawberry" into whichever of field1 - field4 that you specify in field5. The script exits if field5 is left blank or the contents of field5 does not match any of the field names on the layout (based on the tab order you have set for the layout). ---------------- #Do Nothing if field5 is empty If["IsEmpty(field5)"] Exit Script End If #Count the fields on the current layout Exit Record/Request Go to Next Field Set Field["Loop Stop", "Status(CurrentFieldName)"] Set Field["field count", "0"] Loop Go to Next field Set Field["field count", "field count + 1"] Exit Loop If["Status(CurrentFieldName) = loop stop"] End Loop #Find the field specified in the global field Set Field["loop count", "0"] Exit Record/Request Loop Go to Next field Set Field["loop count", "loop count + 1"] Exit Loop If["Status(CurrentFieldName) = filed5 or field count = loop count"] End Loop #If the selected field's name matches the data in the global, set that field with whatever data you need. If["Status(CurrentFieldName) = field5"] Set Field[""Strawberry""] End If Exit Record/Request ----------------------- You could set this up as a "Go to Field" script and just call it from any other scripts that need this type of function. Link to comment Share on other sites More sharing options...
Gogargirl Posted April 17, 2002 Share Posted April 17, 2002 There's a different way to do this that doesn't need the loop/count structure, or script function fields. It works in 5.0 and uses PatternCount and the FieldNames design function to test if the field name in Field5 exists on your layout: If[PatternCount(FieldNames("YourDbaseName.fp5" , "YourLayoutName"), Field5) = 0 or IsEmpty(Field5)] Exit Script Else Go to Field [the first in your tab order of those to be tested] Loop Exit Loop If [ Status(CurrentFieldName) = Field5] Go to Next Field End Loop Set Field ["Strawberry"] End If Go to Field[ ] BTW, the first time I used the FieldNames function, I just couldn't get it to work. Turns out you must include the ".fp5" suffix in the dbase name. The Help file uses a sample name "Customers" without the suffix and doesn't make this clear. HTH Link to comment Share on other sites More sharing options...
Newbies FW Posted April 17, 2002 Newbies Share Posted April 17, 2002 I was hoping somebody would come along and show a nice, clean way to do it. Gotta remember those design functions [ April 17, 2002, 10:50 AM: Message edited by: fwl ] Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 8238 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now