June 18, 200223 yr Hey guys, When I use a command "Goto related record" and there is no related record in other file - the script does nothing. How can I recognize that there is no related record and react respectively on that event? Is there any status function to recognize that? (I would like to view all records in such a case). Thanks for help
June 18, 200223 yr You can test for related records with the IsValid() function, e.g. If IsValid(RelationshipName::RelatedForeignKey) Go to Related Records (RelationshipName) Else Show Message "There are no related records" End If
June 18, 200223 yr Author thanx - you are right - I forgot about IsValid function, appreciate it have a nice day
June 19, 200223 yr IsValid() hasn't given me any trouble yet -- any particular reason why Count() is the way to go, other than precision perhaps?
June 24, 200223 yr I've another question, similar to the one before: i need the same event "no records found" when i use find mode script. So if i search a particular record and i have no mathes i'd like to see a message like "sorry, your request found 0 records" instead of the basic window of fmp "no records found: continue, cancel,ec...... the script". How it can be done? Thanks
June 24, 200223 yr IsValid() hasn't given me any trouble too but according to FM sources the "right" function to test for presence of related records should be IsEmpty(Relationship::Any field that ALWAYS has a value) Count() does work but might slow things down since it has to take into account all related records, while IsEmpty () will check only the first related record
June 24, 200223 yr Hmmm thanks for the tip, Pupiweb. I can see the sense in IsEmpty(). A good field to test would be the remote key.
Create an account or sign in to comment