July 23, 200421 yr 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?
July 23, 200421 yr 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
July 23, 200421 yr Author Thanks guys, appreciate the assistance. Sometimes the answer is so easy you overlook it eh?
July 26, 200421 yr 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.
July 26, 200421 yr 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.
July 26, 200421 yr 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?
July 26, 200421 yr 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?
July 26, 200421 yr 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.
July 27, 200421 yr 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.
Create an account or sign in to comment