Skip to main content
Hi All, i have a large number of ESRI SDE featureclasses and am looking to undertake data attribute cleaning. I choose what tables/attributes i am going to clean i need to create some reporting on each table

 

 

I am trying to loop thru all attributes in a table build a list of the values and frequencies then output these to xls as concatentated strings

 

 

ie Attribute1, Value1,3,Value 2,99,Value3 43 etc etc

 

ie User, John,3,Sally,43,Matthew,99,matt,1 etc etc

 

 

I have built lists and utilized the ListHIstogrammer but how to i take the values from the listHistogrammer and create a new List (or python dictonary) of the histogram value and count? ie Value1,Count99,Value2,Count 4 etc etc

 

 

 

Thanks for your help

 

 

Steve
Hi Steve,

 

 

I think the StatisticsCalculator transformer is suitable to this case rather than the ListHistogrammer.

 

For example, if you set the parameters of the StatisticsCalculator like this:

 

Attributes To Analyze: Attribute1 User

 

Histogram List Attribute: histogram

 

 

the output feature (SUMMARY) will have these list attributes. Attribute1.histogram{}.value

 

Attribute1.histogram{}.count

 

User.histogram{}.value

 

User.histogram{}.count

 

 

Then, you can get the value-count pairs of each attribute (Attribute1 and User) from these lists.

 

Finally, if you need to create concatenated string like "Attribute1, Value 1, 3, Value 2, 99, ...", a PythonCaller with this Python script (for example) would work.

 

-----

 

import fmeobjects   class FeatureProcessor(object):     def __init__(self):         pass              def input(self, feature):         attrNames = r'Attribute1', 'User']         for attr in attrNames:             values = feature.getAttribute('%s.histogram{}.value' % attr)             counts = feature.getAttribute('%s.histogram{}.count' % attr)             s = attr             for (v, c) in zip(values, counts):                 s += ', Value %s, %s' % (v, c)             newFeature = feature.cloneAttributes()             newFeature.setAttribute('attr_value_count', s)             self.pyoutput(newFeature)              def close(self):         pass -----

 

 

Takashi

 


Many Thanks for your input Takashi,

 

 

yes this is perfect. 

 

 

I appreciate your python code also. I know python but am not that good at intergrating it with FME yet !!

 

 

Thanks Again

 

 

Steve

Reply