faada Posted July 23, 2004 Posted July 23, 2004 Hey guys, I'd like to do 2 things that can be accomplished with the same function, I'd first like to put a field on a layout that shows the total number of portal records, also I'd like to prevent a record in one table from being deleted if it has related records in another. Is there a function that will return the number of portal rows or the number of related records?
-Queue- Posted July 23, 2004 Posted July 23, 2004 To prevent deletion, don't allow access to the menu and script it instead, testing for related records first. If [isEmpty(relationship::serial)] Delete Record/Request Else Show Custom Dialog [This record cannot be deleted.] End If
faada Posted July 23, 2004 Author Posted July 23, 2004 Thanks guys, appreciate the assistance. Sometimes the answer is so easy you overlook it eh?
PRP407 Posted July 26, 2004 Posted July 26, 2004 Sorry for being dense but where would you put the Count function to have it count the portral rows? I tried using a field on the layout and used Count (table::field) with table being the table the portal is based on and field being a field displayed in the portal. I got a "?" as my result.
-Queue- Posted July 26, 2004 Posted July 26, 2004 How many related records are there? How wide is your field? If the number cannot fully fit on the field with its current width, it will display a question mark.
PRP407 Posted July 26, 2004 Posted July 26, 2004 The number of related records varies from as few as 1 to as many as 115. I have the result field set very large. I am going through a couple of table occurrences to get the relationship that I need. Does it have to be based on a real table or can I count through a table occurence?
-Queue- Posted July 26, 2004 Posted July 26, 2004 I would think using the TO on which the portal is based should work. Can you zip a sample copy of your file and attach it for investigation?
PRP407 Posted July 26, 2004 Posted July 26, 2004 I'll have to make a smaller file before I can zip and load. Mine's pretty hefty right now. And I think I'll have to do it tomorrow as I have to leave the office in a few minutes. Sorry for the delay when you are willing to help now. Meanwhile, a quick question, would you put the function in a field in the table that the layout is based on or put the function in a field somewhere else? I have it in my table of globals, which has one record. This works great for displaying what I want to display in the portals, by the way. I just can't get a count of the portal rows. The only time I get an answer other than "?" is when I pick the original data table and not one of the table occurences of the same data. They're both linked to global through the same IDNumber field.
PRP407 Posted July 27, 2004 Posted July 27, 2004 I figured out why it wouldn't work. I'm using a data file that is separate from the user interface. The table occurence I'm referencing doesn't exist in the data file, just in the user interface. So I had to create the reference in the data file and then do the count from there. Thanks for your help.
Recommended Posts
This topic is 7425 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