December 31, 200916 yr I have a database with two tables: People and Activities. I want to print the detail of a person and it's related activities. I could make a really large portal for the activities table and use print sliding. I don't like this because the number of records in the activities table is not predictable. I ended up making a list layout from the activities table and using GTRR script step to pull out all the related activities. It worked out really good whether there were one or 1000 activities. The only problem is that when the person has no activities. The GTRR script gave an 101 "record is missing" error and the printing was broken up. Is there a way to get around this problem? When there is not related record, just leave that empty and make the rest print out correctly.
December 31, 200916 yr Hi, You will need to handle this printing of activities carefully. For a people record Go to layout (people) Go to related (activities) If(get(lasterror =0) { Go to the list layout and print them all } else { go to layout (People) Show custom dialog ("There does not exists any activites for this person") }
December 31, 200916 yr Author thanks for the reply. I came up with my own solution. I temporarily attached an empty related record before printing and removed it right away after the GTRR script step. It worked for me.
December 31, 200916 yr What? Why did you need a temporary related record? Pushkraj's script is fine. If there are no related records, FM throws an error. His script checks for the error and not getting one (Get (LastError) = 0) goes to the related records. That works. Another way is to check for related records, and if there are any, gtrr. I use the construct: If (not isempty ( relationship) ) gtrr Else Show Dialog, "No related records" ) End If Edited December 31, 200916 yr by Guest
December 31, 200916 yr His script checks for the error and not getting one (Get (LastError) = 0) goes to the related records. If there's no error, wouldn't you already be there?
January 1, 201016 yr True! Oh, you're so much more careful a reader than I am. So, use my method and check the relationship, if it exists, then gtrr.
January 1, 201016 yr Being a "careful reader": you should check for the existence of a related record, not the relationship: If [not IsEmpty ( Activities::PersonID )] Go to Related Record [ ... ] Else # DO SOMETHING ELSE End If
January 1, 201016 yr Well, if I was a more careful WRITER, I would have said check for the existence of a related record, which is precisely what I'm doing.
Create an account or sign in to comment