I an reading a feature table having 3 string columns say a,b,c and column X from another feature. Columns a,b,c holds string value(nullable). X has value like "Concat(Concat(a,b),c)". I need to derive final string without running sqlexecutor.
You can use the TestFilter to branch the feature flow into four flows according to X value, and then use four StringConcatenators to do different concatenating operations.
Alternatively, if you are using FME 2013 SP1 or later, you can also use "Conditional Mapping" functionality of the AttributeCreator, like this.
Select "Set To Conditional Value..." for setting Value parameter.
This is an experimental solution. A PythonCaller with this script might work. -----
import fmeobjects, re def processFeature(feature): x = str(feature.getAttribute('X')) s = '' for name in re.sub('.*\\(|\\)|\\s', '', x).split(','): v = feature.getAttribute(name) if v: s += str(v) feature.setAttribute('concatenated', s)
The minimum requirement for "Conditional Mapping" is FME 2013 SP1 (released in late of March), I don't think your FME version supports it unfortunately. I recommend you to upgrade your FME to the latest version if possible.
Depending on the environment. If the performance of execution may be too inefficient, I would also consider to use two SQLExecutors in a series. Naturally, this approach can be applicable only if the source dataset is a database. 1st SQLExecutor: select distinct X from table_name 2nd SQLExecutor: select id, foo, bar, @Value(X) as concatenated from table_name where X = '@Value(X)'
I currently have no other ideas. In my experiences, querying with SQL statement seems to achieve the best performance in many cases. But I have never used SQL statement containing "concat" function in a workspace, the Python approach might be better in this case. The exact answer can not be known until you measure time actually. About general issues on FME performance, see Dave's posts and related links in this Q&A: Dynamic Schema and Memory issueshttps://safe.secure.force.com/AnswersQuestionDetail?id=906a0000000coggAAA
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.