Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Distinct function?

Status
Not open for further replies.

CryoGen

MIS
Apr 15, 2004
86
US
In the SQL world I can run write a query with a DISTINCT argument to aggregate values in a particular column. Does FMP have a similar function? I need to be able to set all the possible values in any given field into a global field.

I know it's possible to export values from a field once they been sorted and summarized, but I need the values to be available within the application (not in an exported file).

Can this be done recursively through a custom function? Any idea on what it would look like (or is that overkill?)
 
As far as I can see, and not knowing the why, you need to script it.

See how far you can go with Get(ActiveFieldContents) and a set field script in a loop.
 
On the other hand, if you want a Custom Function, I would look at the new GetNthRecord() function in FM8, if you have 8A.

You could make something along these lines:

Case ( currentRecordNumber < Get ( FoundCount );
GetNthRecord ( yourField ; currentRecordNumber )
& ¶ & CFName( yourField; currentRecordNumber + 1 );
currentRecordNumber = Get( FoundCount );
GetNthRecord ( yourField ; currentRecordNumber )
)

Within this function you only need the value from yourField and currentRecordNumber

HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top