Counter for identical Data

Posted by: fwenger

Counter for identical Data - 08/08/18 03:38 AM

Im looking for a expression, that increments a counter, if a datafield dont change.
For example, my table has a ID and a Value:
ID Value
15 xy
15 zt
15 ou
17 ff
17 ds

The counter should count the identical IDs and looks like this:
1/3
2/3
3/3
1/2
2/2

I read already about a macro in topic "[Macro] Check if data in a field changes", but there is no code inside. Also i read about a Expression IF(CHANGED([ID]),... but that Keyword dont want work in my PSM 6.1.1.

Is there any way to do that without a Excel-handling?
Posted by: Sander vd Berg

Re: Counter for identical Data - 08/09/18 11:02 AM

I think CHANGED only works in PSM 7.

You could write a macro for PSM 6 that would give you the "1" part of "1/3", but unfortunately I can't think of any way to get the "3" part of "1/3". You can look back to what you encountered before, but there is no way to look ahead.
Posted by: Jean-C├ędric

Re: Counter for identical Data - 08/09/18 11:20 AM

You could try to read your Excel sheet from an ODBC driver as a database and while you are extracting, use SQL to gather the number of each similar ID and add this as a new field that will be used as X of 1/X.