Jump to content
  • 0

Require more than one Address for a Provider before allowing an address to be deleted


anyalynn

Question

My application has a provider table that contains name, email, phone, etc., which  is linked to an address table so that the provider can have more than one physical address on file.  Everything works fine, but I want to allow admins to delete addresses BUT require at least one address for each provider, so if there is more than one  address they can delete, but when there is only one address they cannot delete anymore.  The address table has a pointer to the ProviderID so that I know what addresses go with each provider, but I don't know  if there is a query or a trigger that I can use with Caspio so that I can check that there is more than one address for a provider before I let an address be deleted.  I hope this makes sense.  Thanks in advance for any ideas.

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

There is no easy solution but a workaround is to add a field in your address table to identify which records can be deleted and then create a report to filter out the records that should not be deleted. For example, in your address table add a field named Delete? as yes/no data type. Check all records for each provider except one record. Then in the report, you can use predefined criteria to show only records that can be deleted using the Delete? field as criteria.  The results will only show records marked as delete. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...