Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5885 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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.

Posted (edited)

Neat technique, but I'm still learning the basics first. So if anyone could help on the If, and Else if.

Edited by Guest
Posted

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.

Posted

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.