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.
Please let me know how to solve this.
Thanks.
Subrat
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.
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