hall312 Posted October 14, 2008 Posted October 14, 2008 I am trying to use a notes separator script in several different notes fields throughout the database. I would like to use If, Else If script to allow the script to be written only once. Here is what I've got. New to databases. Any help? If [FieldType ("Test.fp7" ; "Customer::Notes")] Go to Field [Layout::Notes] Else If [FieldType ("Test.fp7" ; "Service::Notes")] Go to Field [service::Notes] Set Selection [start Position: 0; End Position; 0] Insert Text [" "] Set Selection [start Position: 0; End Position; 0] Insert Calculated Result [misc. formula] End If Where does the Else fit in? I've tried various spots and just can't get it to work. Thanks.
aldipalo Posted October 14, 2008 Posted October 14, 2008 Take a look at this video: http://www.filemakermagazine.com/articles/methods-for-taking-notes.html
hall312 Posted October 14, 2008 Author Posted October 14, 2008 (edited) Neat technique, but I'm still learning the basics first. So if anyone could help on the If, and Else if. Edited October 14, 2008 by Guest
comment Posted October 14, 2008 Posted October 14, 2008 There's nothing wrong (that I can see) with the way you are using If[] and Else If[]. The problem is with the FieldType() function, which doesn't do what you think it does. I suspect you want to test the current layout's name - if so, use the Get (LayoutName) function.
David Jondreau Posted October 14, 2008 Posted October 14, 2008 What sort of help are you looking for? You have a script. Does it do what you want it to? You need an If[] and End If to make an If[] statement. Else If[] and Else are optional. Else is the same same Else If[1], and it means, "if none of the previous tests succeed do this instead." No Else If[] or Else used after an Else will ever get tested. I'd leverage script parameters instead of relying on the current field. Parameters are optional strings passed to the script. you can set them when defining your button (among other places). On your Customer button, pass the parameter "Customer". Then on your script: Set Variable[$type = Get(ScriptParameter)] If[$type = "Customer"] do this Else If [$type = "Service"] Do this End If
Recommended Posts
This topic is 5885 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