Hi Brad,
Here is a custom function from Eilert Sundt, by way of a post on the
Experts list from Stephen Wonfor:
_________________________________
James
You may find some joy in this CF from Eilert Sundt (posted to FMI
TechTalk in Feb of the year 9)
"Assuming your records have a unique record IDs, you can use the
following custom function to get a return-delimited list of the record
IDs in the current found set:
------
FoundList ( field ; start )
GetNthRecord ( field ; start ) &
Case (
start < Get ( FoundCount ) ;
"ΒΆ" & FoundList ( field ; start + 1 )
) // EndCase
"
Stephen
-------
The perfect project plan is possible if one first documents a list of
all the unknowns. --- Bill Langley
On May 21, 2009, at 8:25 AM, James McAlister wrote:
I have a calculated field AllEmails on a layout which uses the list
function to return a list of all email addresses in my small (less
than 150 records) class reunion database. Since those without emails
aren't shown, I just copy the field contents and paste them into a new
email to contact everyone. This works well.
What I would like to do is have another calculated field FoundEmails
on the same layout to return just the addresses of only those people
in the found set, omitting those who don't have emails. That way I can
easily copy those addresses and send an email to a subset of the
class. How would I do this with a calculated field using FM10A?
Thanks!
James
www.james-mc.com_
_____________________
On Jun 25, 2009, at 12:51:37, Brad Lowry wrote:
Hi All,
I *love* the [relatively] new List() function.
As always, if the limitation I describe below is an indication of
ignorance of how to use the List() function or some other
methodology that I am unaware of then I will be thrilled to have my
ignorance cured by you-all.
You just point it at the Primary Key through the relatonship of your
choosing and you have a list of the Keys of the Related Records.
However, there are times where you can arrive at a Found Set of
records but only *not* through a relationship, and you still want
all the keys.
In this case you need to Kludge your way through building a layout
with only one field -- they key -- and then travel there with your
found set in tact and perform a CopyAll() step and then paste it
somewhere and then assign it to a $script variable or a $$session
variable.
(Alternately, you could Kludge an on-the-fly relationship and use
List() -- I am tending toward that these days, but still too kludgey.)
I wish that FMI would create a "list from found set" or a "targeted
copy-all". These are two ways of describing the exact same thing;
yet one is an enhancement of a Function and the other is an
enhancement of a Script Step -- so maybe both: ListFromFoundSet()
functions and CopyAllTargeted() script step.
I'll go with the "List Opton":
You could run, ListFromFoundSet("CustomerID") to return the exact
same data as you would with either kludge above.
Better yet. FileMaker should add the ability to have:
1. Optional Parameters
2. Default Values where Parameters are skipped (there are many cases
where the parameter can be one or more than one [Avg(), Sum() and so
on]; but I am unaware of a case where there can be none or more than
none for parameters).
If that were the case it then both the function and the script step
could remain unchanged and backwards compatible, but allow an
addition parameter to both.
For fun I will swith to the CopyAll function and show how this would
work: empty parameters means "ALL" (so no change to existing
scripts); yet the optional parameter(s) would be one or more column
names that should be included in the CopyAll. [Also, the minute you
begin to specify any parameter at all, the function become layout
INdependent -- and you can pass in the string "ALL" and have that a
layout INdependent expression copying all fields of that table.]
So that CopyAll("CustomerID") would do the trick.
I hope that I am just ignorant and someone can clue me in to a way
to effect this elegantly with the existing feature set.
If not, just a wishlist.
FWIW: $0.02
Thanks.
--
Sincerely,
Brad