Hi, you can use @StringLength(<string>) in e.g. AttributeManagers, AttributeCreators, ExpressionEvaluators etc. Could that be of help to you?
You could use a BulkAttributeRenamer to create copies (Mode: Keep Original Attributes) of your attributes with a prefix, then use an AttributeManager to set all attributes with your prefix to the value “@Evaluate(@StringLength(@CurrentAttribute()))”
Or directly overwrite your attributes with their lengths using an ExpressionEvaluator with this expression: @StringLength(@CurrentAttribute())
I like these problems, because there are so many ways it can be solved!! Yet another approach would be using a python caller with the input function being (leave the others as default)
definput(self, feature: fmeobjects.FMEFeature):for f in feature.getAllAttributeNames():
if f == '_count':
passelse:
attr = feature.getAttribute(f)
if isinstance(attr, str):
feature.setAttribute(f, len(attr))
self.pyoutput(feature)
This will replace the attribute value with the length of it. You can also add logic to only do certain types, or ignore certain attributes (in this case i’m ignoring ‘count’ and only getting the length of strs). Using a couple of bulk renamers and an aggregator you can add the lengths back onto the original feature
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.