Jump to content
Server Maintenance This Week. ×

calculated match fields?


richshone

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

Recommended Posts

Trying to figure out the best and least cumbersome way to find data in a related file if it is there, and still have the user type in info for a new record if not - all in the same set of fields. Are the only two ways to do this a portal or a calculated match field? Is there a slicker way of doing it? Portals will look bad in my solution and so far calculated match fields are the best option I can find (if a little cumbersome). Anything I am missing? Thanks fo any ideas...

Link to comment
Share on other sites

Take a look around the Database Pros web site, I think there are a couple of solutions there that offer varying degrees of this functionality.

http://www.databasepros.com/

The simplest way is to perform a find, then trap for an empty found set and take actions accordingly.

Link to comment
Share on other sites

The simplest way is to perform a find, then trap for an empty found set and take actions accordingly.

Huh? Please elaborate for me a bit on this thought is you can. As for the site you directed me to, it does have quite a few things of interest, if not directly related to my query. Thanks...

Link to comment
Share on other sites

OK, what does "trap an error" mean...

Whenever FMP encounters an "error" condition it has some "solutions" built-in to respond to them. One such error is an empty found set -- when a find does not match any records, FMP automatically responds with an alert that asks if you want to modify the find or cancel. This is the built-in response to the error.

But what if an empty found set is good in your solution, like when no accounts are overdue? In this case we want to be able to "turn off" the built-in response to the empty found set error and create our own response, one that is not necesarily negative or warning of a potential problem.

The "Set Error Capture [on]" script step does this. "On" means that the developer is now doing the error responding, not FMP any more. But how do we know what error to react to? FMP has error codes that help us work it out -- print out the list of error codes in the Status(CurrentError) function in FMP Help.

How do error codes work? After running each and every script step, FMP generates an error code in memory. If there was no error the value is zero. If there was an error it will be a non-zero number -- read the list to see them all. The way to "trap" the code is to perform the find, then immediately look at the error code. The most robust and reliable way to "hold" the code to look at it is to create a global field and use the "Set Field" step to insert the error code into it -- the Status(CurrentError) function does the trick. Then follow that Set Field step with a conditional...

If [ globalerrorfield = 0]

do whatever needs to be done if one or more records are found

Else

do whatever needs to be done if NO records are found

End If

This whole process is called "trapping" because you set a trap for the error, check the trap and see what you've got, then act accordingly.

Welcome to the world of FMP developing.

[This message has been edited by Vaughan (edited December 20, 2000).]

Link to comment
Share on other sites

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