Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.filemaker > #3257

Re: Detecting No Related Records

Newsgroups comp.databases.filemaker
Subject Re: Detecting No Related Records
From csampson@inetworld.net (Charles H. Sampson)
Date 2019-07-30 19:27 -0700
Message-ID <1objkhl.1u8ai461ffs7ibN%csampson@inetworld.net> (permalink)
References <1obhm6m.hdoyrw1jr4ctoN%csampson@inetworld.net> <qho6eo$ofp$1@gioia.aioe.org>

Show all headers | View raw


Helpful Harry <HelpfulHarry@BusyWorking.com> wrote:

> On 2019-07-30 01:13:20 +0000, Charles H. Sampson said:
> 
> > How do I detect that a record has no related records? I've found that
> > "Go To Related Record" doesn't protest if there are no related records
> > so catching an error doesn't work. I've also searched the Get functions
> > for something that returns a count of related records to no avail.
> 
> 
> There's probably a few ways, but perhaps the easiest is to simply count
> the number of related records using a related field that must always 
> contain data - the obvious one being the related records' Child-Key 
> field itself. In the Parent Table, you can create a Calculation field
> like:
> 
>     NumRelatedRecords    Calculation, Number Result
>         = Count(Relationship::Related_Child_KeyField)
> 
> or you can simply use the same calculation in a Script, within an If 
> statement's test for example..
> 
> If that calculates as zero, then there are no related records.
> 
> You may even already have that field in the Parent Table since it can
> often be handy to display the count underneath a Portal.
> 
> Helpful Harry  :o)

Worked like a champ, Harry. Thanks yet again. You'd think (or at least I
would think) that with the many Get functions, not a few of them having
to do with the number of records in a set, there would be one something
like Get (RelatedRecordsCount).

Charlie
-- 
Nobody in this country got rich on his own.  You built a factory--good.
But you moved your goods on roads we all paid for.  You hired workers we
all paid to educate. So keep a big hunk of the money from your factory.
But take a hunk and pay it forward.  Elizabeth Warren (paraphrased)

Back to comp.databases.filemaker | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Detecting No Related Records csampson@inetworld.net (Charles H. Sampson) - 2019-07-29 18:13 -0700
  Re: Detecting No Related Records Helpful Harry <HelpfulHarry@BusyWorking.com> - 2019-07-30 13:27 +1200
    Re: Detecting No Related Records csampson@inetworld.net (Charles H. Sampson) - 2019-07-30 19:27 -0700
      Re: Detecting No Related Records none@gmail.com - 2019-07-31 20:35 +0200

csiph-web