# Calculate a field with a text string containing various values from another table?

Discussion created by TinaH85 on Mar 27, 2013
Latest reply on Apr 3, 2013 by TinaH85
Hi everyone,

I've got the following problem:

I have a table with the columns NAME - GESCHL - FAMST - FREQUENCY - MEAN_ALTER from summary statistics. Basically, it lists the number of people (FREQUENCY) for different disctricts (NAME) first by gender (GESCHL), then by family status (FAMST) with the according mean age (MEAN_ALTER) for that family status.
So there are a couple of entries for each district, depending on the number of different family status values occuring in that district (possible values are "GS", "LA", "LD", "LP", "VH" and "VW").

In addition to that, I have a feature class with the districts in the same FGDB, whose attribute table naturally contains only one entry for each district. I have added two fields (MFAMST and MMEAN_ALTER for the marital status and mean age of the male part of the population) to this fc and now I want to calculate this field based on my summary statistics table using Python code. As the table would become pretty big, if I added one field for each family status and mean age first for men then for women, I would like to summarize all the values in one text field looking somewhat like the following example (capitals = column names):

NAME: Ampen
MFAMST: GS = 8; LD = 25; VH = 15; ...
MMEAN_ALTER: GS = 50.38; LD = 23.56; VH = 51.60; ...

Does that make sense? I know it's a little complicated, so let me know, if you have any further questions. I'm guessing I need to use a list in Python looking for all the distinct values in the "FAMST"-column of my summary statistics table and then somehow put this into an expression that connects the family status with the according frequency / mean age, but after unsuccessfully searching the forums here and trying various search terms in Google, this post appears to be my most promising option.:)

So any help on this would be higly appreciated!

Thanks,
Tina