August 18, 200520 yr Is there a way i can put in a script step to check if a related record exists? Reply would be great cheers, genx
August 18, 200520 yr You can use IsValid(RelatedTable::relatedSerialField) inside an If[] script step.
August 18, 200520 yr Note that IsValid could return false even if there is a related record (see FM Help). IsEmpty is more reliable and, from what I have read, optimized for this use.
August 19, 200520 yr I have been using Count(TO::Field) with consistent results, is there any reason I should be using IsEmpty instead?
August 19, 200520 yr If there are lots of related records, Count() will be slower, as it actually has to count them all.
August 22, 200520 yr you could also use if(sum(any related numeric field)=0). Use this successfully in scripts as long as there is always going to be a number in the numeric fields, e.g. account number. You could also set up a calculation field in your table that returns a 1 if there is a count or sum greater than zero in related tables and use this as a flag in scripts. You could also go to related records and check file, layout or table names to check if its gone to any.
August 22, 200520 yr if(sum(any related numeric field)=0) You havn't understood what Ender wrote, littering the calc with yet another function ...is making things worse, all aggregate functions suffer from this artifact. But we're way beyond 4000 records in the related, before any noticable difference shows. --sd
August 22, 200520 yr If the related field is a number field that is guaranteed not to contain zero (e.g. a serial number), you can make it simply: If [ related::serialID ]
Create an account or sign in to comment