AnsweredAssumed Answered

Primary key with more than one fields

Question asked by ShubhankarDiptiman on Aug 9, 2010
Latest reply on Aug 11, 2010 by Shraddha

Title

Primary key with more than one fields

Post

I am new to the file maker community .

I wish to make combination of two fields in a table as primary key ( unique ) .

I have SalesTable (Header) and SalesLines (Lines) .

SalesTable has SalesId as primary key (unique) .

SalesLines table has SalesId as a foriegn key and another field LineNum (Line number) .

 In SalesLines, I  wish to

1. Make the LineNum field auto entered from number 1 for a SalesId e.g.

SalesId           LineNum

SO001                 1

SO001                 2

SO002                 1

SO002                 2

SO003                 3

Line number once consumed e.g. in case a user deletes a sales line will not be used again for the SalesLines of that sales order i.e. if in above example if a user deletes the record for SalesId SO002  and lineNum 2 then LineNum 2 will not be created again for SalesId SO002

2. Make combination of SalesId and LineNum  as unique for SalesLines.

Pls help.

SD

Outcomes