October 14, 200817 yr 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.
October 14, 200817 yr Take a look at this video: http://www.filemakermagazine.com/articles/methods-for-taking-notes.html
October 14, 200817 yr Author Neat technique, but I'm still learning the basics first. So if anyone could help on the If, and Else if. Edited October 14, 200817 yr by Guest
October 14, 200817 yr 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.
October 14, 200817 yr 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
Create an account or sign in to comment