Skip to main content
Question

Schema reporting ListHistogrammer

  • September 2, 2013
  • 2 replies
  • 52 views

Forum|alt.badge.img
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
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

takashi
Celebrity
  • September 3, 2013
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 = ['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

 


Forum|alt.badge.img
  • Author
  • September 4, 2013
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