jjjjp Posted September 25, 2011 Posted September 25, 2011 Following up on recent FM Forum advice, I have been trying to replace as much of my scripting of record validation using FM's native validation. I wish I had done this much earlier, but I have come across this particularly knotty issue: (1) In my database, users with the right privileges can create accounts for others and, during the process of creating an account, replace the script-generated account name with one of their own choosing. At the end of the process, an email is sent to the new user containing, among other things, the account name. If the send email step generates an error, I don't want to commit the new account record. The account should remain uncreated. The problem is that to generate a unique account name, I need to use validation, and the record will commit if the user-supplied account name is unique. Alternatively, scripting the validation also ends up committing the record. Is there a way to find out whether a record would have generated an error on validation without actually committing the record if the error is zero? Or is there some other way to approach this? I'm thinking it may be possible to exploit the order in which validation errors are checked by setting up a calculation that fails if the message hasn't been sent yet, but this method seems inelegant and might be unreliable in many situations. (2) I am aiming to use validation to ensure that no incorrect records are ever generated if a session is interrupted. But I also create temporary records (in some situations related to the record that's being validated, in some case not). These records do not threaten the integrity of the database because if there is an untimely interrupt, they will either be orphaned or marked. I think I can see how it should be possible to ensure that even all of these "temporary" records get wiped out on interrupt: by making sure that they are related to a record that will not be committed on interrupt and clicking "Delete related records in they table when a record is deleted in the other table" in the relationships graph. I just want to be sure before embarking on this approach, as opposed to periodically engaging in garbage collection when the database if offline, that I would be following best practices. I can already see that one has to be very careful; for example, importing tables in the wrong order can wipe out a table.
Recommended Posts
This topic is 4806 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