### Title

flag_unique Problem

### Post

If anyone is familiar with the flag_unique method, please help!

I am trying to create a field flag_unique that contains a 1 for the first instance of the field you're sorting by. So there should be mutliple types of the field you're sorting by, for example, Product Type. The calculation for flag_unique is supposed to be

`Let ( x = GetNthRecord ( salesperson ; Get(RecordNumber) - 1 )`

;

`If ( salesperson <> x ; 1 ; "" )`

`) // end let`

However, when I do this, flag_unique only works for the first Product Type, the other Product Types, get 1 in all their instances for field flag_unique. It is not reiterating for all Product Types? I'm not sure how to fix this problem.

Source for expression: http://www.filemakerhacks.com/?p=25

For this to work your table has to be sorted on the Product type and your calculation field(flag_unique) needs to be unstored. To make your field unstored click storage options then click "Do not store calculation results - recalculate as needed.

This is your calculation.

`Let ( x = GetNthRecord ( ProductTypes ; Get(RecordNumber) - 1 )`

;`If ( ProductTypes <> x ; 1 ; "" )`

`)`