Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 5887 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi all,

I have 2 tables..

StockCodes

CreateFile

In CreateFile, I have a field called List.

At the moment, this is a calculated list that lists all records (stock codes) from the table StockCodes.

So the list shows

StockCode1

StockCode2

StockCode3

...

Does anyone know a way whereby this list will only show the unique records from the StockCodes table.

In other words the stockcodes table may show a stock item code in more than 1 record. I would like the list to only show the stock item codes that are listed in 1 record only in that table.

Can any of you experts out there advise on the best way to do this please?

Many thanks

Ed

Posted

Quick and easy answer is to use GetNthRecordUnique custom function. However, I have a feeling that your database structure is flawed. If you describe your setup and functional goals in more detail, we can point you in the right direction.

Posted

Thanks bcooney. I will take a look at the custom function and see if I can use that. I think I will be able to.

The structure is as follows:

Table: HistoricData

Field1: StockCode

Field2: Date

Field3: Amount

Filed4: RelationSetup

Table: CreateFile

Field1: Text (List field)

Field2: RelationSetup

I am sure this is not "proper" but it works...

The relationship is basically rubbish. All records from HistoricData relate to the 1 and only record in CreateFile by the 2 RelationSetup fields.

I can see experts cringing!!

Anyway, this provides the list in CreateFile - a list of all stockcodes from the related records (all of them) in HistoricData.

I want the list to show only the records that are unique - so where there is only one instance of the stock code in Historic Data.

For info, if it matters, the field called Text in the 2nd table is not just a list - it also has static text around the list so...

Here are the stock codes with only 1 record

Stock1

Stock2

Stock3

Sort them out...

Could I use the custom function using my "fake" relationship?

Thanks again - of course open to any suggestions on how to do this better!! Always eager to learn the "proper" way of doing things.

Ed

Posted

Its quite a strange scenario really.

The data in the historic table is submitted every Friday from Excel spreadsheets - something I can't get the users away from - this is using ODBC.

Now each Friday night I need to check if there have been any new stock items added to the historic table - i.e. it is the items first record.

If it is I create an output text file (the Field: Text mentioned in the previous post) which is submitted to an external system which then generates the old data I need.

I know, not pretty but with what I've bene given it is what I need to do.

Thanks

Posted

I don't quite follow. You say "check if there have been any new stock items added to the historic table", but you generate a list of ALL items, old and new alike.

Posted

Thats my problem.

At the moment the best I can do with my limited knowledge is show a list of all stock codes. I need the list to just show unique stock codes- i.e. new ones - new ones are defined by only have 1 record

Posted

I am sorry, but I still don't get this. Unique is unique, and new is new. If I have a list:

A

B

A

C

A

then unique is:

A

B

C

If I now add to the list, so that it becomes:

A

B

A

C

A

D

D

A

then unique is now:

A

B

C

D

and new is:

D

So which one do you need?

Posted

Sorry, in your terms new is what I need, by unique I meant individual, one of a kind - confusion with lingo!!

Definitely new - i.e.

A

F

B

C

A

D

B

C

I would want this to report D & F in my list as they only appear once

Posted

I'd just set a flag field that I've exported the record. Before an export, find for records where the flag is empty.

Posted

But I never export from the HistoricData Table

I only export 1 field from the CreateFile Table - the text field that makes up the list

Posted

I would define a self-join relationship of the HistoricData table as:

HistoricData::StockCode = HistoricData 2::StockCode

and a calculation field cCount (result is Number) =

Count ( HistoricData 2::StockCode )

Do a find for 1 in this field.

Posted

Perfect! Knew someone would know a straight forward way once i made myself understood!!

Many thanks, very much appreciated, apologies for the confusion along the way.

Ed

Posted

Come to think of it, there is a much simpler (and faster) way to find records that do not have duplicates:) enter Find mode, type ! (exclamation mark) into the StockCode field, check the Omit box and perform a find.

I should have come up with this at once, but I guess I got all confused by the term "unique".

:doah:

I still don't get what role "old" and "new" play in this; perhaps you need only to constrain the found set instead of doing a full find?

Posted

I swear I used it successfully, and yet I can't create a demo in which it works! I know in my final solution, I ended up not using it. Thank goodness.

This topic is 5887 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.