In article <1122244502.793197.108880 (AT) f14g2000cwb (DOT) googlegroups.com>,
leon.obers (AT) iae (DOT) nl wrote:
Quote:
Hello,
How to get an "index" of names.
E.g. I do have 20 records, containing Names of Cities (fieldname City)
Sorting to "City", duplicate names are following.
Record 1 --- Alabama
Record 2 --- Alabama
Record 3 --- Amsterdam
Record 4 --- Amsterdam
Record 5 --- Amsterdam
Record 6 --- Amsterdam
Record 7 --- Kopenhagen
Record 8 --- Kopenhagen
Record 9 --- New York
Record 10 --- New York
Record 11 --- New York
Record 12 --- Oslo
Record 13 --- Paramaribo
Record 14 --- Paris
Record 15 --- Paris
Record 16 --- Tokyo
Record 17 --- Tokyo
Record 18 --- Tokyo
Record 19 --- Tokyo
Record 20 --- Viena
I want only a *numbered* index output list shown
unique City names.
Nr 1 --- Alabama
Nr 2 --- Amsterdam
Nr 3 --- Kopenhagen
Nr 4 --- New York
Nr 5 --- Oslo
Nr 6 --- Paramaribo
Nr 7 --- Paris
Nr 8 --- Tokyo
Nr 9 --- Viena
How to get only unique City names?
How to get nice follow up numbers? |
This really depends on what you want to do with that list once you've
obtained it, and whether the names come from the whole database or just
the current Found Set of records.
For example, you could use a script to sort the records and then
generate the list, but this would be no good if you want the list
on-screen constantly updating.
Anyway, here's one method:
The easiest way would be to use two separate fields - one for the city
names and another one for the numbers.
To obtain the list of names (without the numbers) is to define a new
Value List that takes it's values from the City field - this will
automatically generate the list of unique names in alphabetical order
and update whenver new names are added to the database.
The names in this Value List can then be grabbed by a Calculation field
using the ValueListItems function.
eg.
CityNamesIndex Calculation, Text Result, Unstored
= ValueListItems (DatabaseName, ValueListName)
where DatabaseName is the name of the file you're using and
ValueListName is the name of the Value List you've defined to obtain
the unique City names.
This gives you a field containing each unique City Name from the entire
database, with each City Name on a separate line (ie. separated by a
Return / ¶ character).
For the numbers you can use another new Calculation field that counts
the number of values in the CityNamesIndex field above.
eg.
CityNameNumbers Calculation, Text Result
= Left("Nr 1 ---
Nr 2 ---
Nr 3 ---
Nr 4 ---
Nr 5 ---
Nr X ---", (PatternCount(CityList, "¶") + 1) * 9)
Obviously you'll need to add "Nr X ---" lines to cover as many cities
you'll possibly ever get.
This counts the number of Return / ¶ characters, adds 1 (to include the
last name in the list) and then uses that to add the correct number of
characters using the Left function (the * 9 is used because you've got
"Nr X ---" plus the Return character).
Then simply put the two fields on a Layout next to each other
ie.
[CityNameNumbers][CityNamesIndex]
stretched vertically as long as necessary.
Note: Despite the CityNamesIndex field being Unstored, it will not
update automatically on-screen when you add a new record with a new
City Name - you have to go to another record before the Value List and
therefore this field updates.

\
Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)