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

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

Recommended Posts

Posted

I am trying to simplify by automating this task.

I have a field that says "staff name". I also have a field that says "staff email".

I did a script that will insert a email if "staff name" is selected, but I have to somehow make the script execute.

Can someone tell me how to make it auto execute the script when I select "staff name"?

-OR-

Give me a better solution to make this happen?

Thanks everyone! Love this forum!

Posted

Hey Zero, I'm curious why you wouldn't simply use the Let() statement without the Evaluate(Quote(...)) and have it replace the contents, like this:

Let(

a = StaffName;

Case(

a = "john doe"; "[email protected]";

a = "Jane Doe"; "[email protected]")

)

They do evaluate a little differently, where using the Evaluate(Quote(...)) does not replace the existing Email if there's no match in the Let(), but is this desired behavior? See the sample.

I don't want to rain on Cal's parade, but it seems like Email would be an attribute (field) in a Staff table. It would be structurally better then, to simply reference the related Email field whenever you need to see the email address for a selected staff name. It's not a good practice to hard-code all the staff email addresses in a case statement as suggested.

EvaluateTest.fp7.zip

Posted

Sorry for taking so long to reply here.

Yes, Idealy email would be a related field and would auto lookup in the first place. By now ( a few days later) I have no idea why I didn't just tell them that, as I dislike to hardcode anything that might ever change.

I've had funny results just using Calc fields before for things like this ender, although they were probably due to faulty programming on my part, I've grown fond of the evaluate function and often use it where it isn't nessecarily needed.

Anywho, Cal, ender is right, doing it the way I originaly showed you is a bad idea. Create another field in your staff table that contains thier email, that way you don't have to update your code everytime a new staff person is added to the database.

This topic is 6879 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.