SPAN8.
SPAN4.
Hi FME'ers,
This question was asked about Excel data, but it often applies to any text-based format where a set of records is subdivided by a separate header record. In this scenario, the header record gets read as a standard feature by FME. It needs not just to be filtered out, but its contents added to adjacent records.
编辑:有关本周之前问题的完整列表,请参阅这个Google电子表格。
Q)I am trying to use FME to get some excel data formatted. The problem is there are headers which I need to populate as a column. I tried using the VariableSetter but it gives me the same header all the way through for all the lines.
https://knowledge.亚搏在线safe.com/questions/104160/variable-setter.html.
一个)亚搏在线工作流 - 或通过工作空间的功能流 - 是FME的一个方面,对于敏锐的工作空间作者来说是重要的。事实上,我最近写了2019年的特征订单的帖子。为什么这适用于这里?这是因为用户想要将信息从一个功能传递给另一个功能,而不是使用常见的属性值,而是基于它们在Excel文件中的邻近。
让我们看看为什么......
那么用户在这里有什么有效的:
标题功能1功能2标题B功能3功能4
What they want is to apply the header to subsequent features, giving them:
Feature 1,A Feature 2,A Feature 3,B Feature 4,B
因此,我们需要能够将该标题存储并将其存储在某个地方,以便将其应用于后续功能。有两种方法可以做到这一点:我称之为“正确的方式”,以及“旧的正确方式”。
变量就像属于整个工作区的属性,而不仅仅是一个功能。一个功能可以设置变量(变型缩放器),另一个功能可以检索它(variableretriever)。这里的解决方案是标题功能设置变量(具有标题值)和功能记录以检索它:
但是,此解决方案为我们提供了对操作顺序的严格要求......
So controlling the order of features is vitally important in this scenario.
相邻的特征属性is a way where we give one feature the ability to fetch the attributes of a previous (or subsequent) feature. Here the solution is to give Feature 1 access to the information from the previous feature (Header A):
What about feature 2? Well, Feature 2 fetches its value from Feature 1, which had already fetched it from Header A. What you end up with is a temporary attribute that stores the header value and gets updated whenever the current feature is a new header.
This too depend on the order of features, so what's the difference?
请注意,我没有提到哪种方式是正确的方式,这是旧正确的方式。
变量是旧方式。我不说出错了,但个人不想再使用它们了。正如该用户发现的那样,预测功能顺序更难,因为您需要将要素拆分为多个流(请注意variableTter和variableretriever如何在不同的连接上)。
此外,变量也不适用于批量功能模式。我没有提到它以前的文章,but variables are affected by bulk mode because bulk mode changes the order. You are likely to get both Header A and Header B emerge from the Tester:Passed port and set the variable, beforeanyFeatures emerge from the Failed port, and I think that's what the user in this case found out.
With adjacent attributes it's much easier to predict the order of features because you don't need to split up the data into separate streams.
本周对我来说特别感兴趣的其他问题是这些......
Apologies for the lack of log-in capability yesterday. We're hoping this problem won't repeat. And it didn't - today's issue was something different. I apologise for the slowdown today. We're aware it's not a good position and we're actively working on a solution. As always, status details can always be found onstatus.亚搏在线safe.com.
在这种情况下,我认为必须在attributecreator中设置条件值。例如
headervalue =如果@Value(text_line_data)以标题开始,则@replaceregex(@value(text_line_data),“。+ \ s +(。+)$”,\ 1)else特征[-1] .headervalue
为了能够在此处引用“特征[-1] .headervalue”,请在attributecreator之前插入attributeexposer以公开属性名称“headervalue”。在attributecreator后,还需要删除后续进程中的标题功能以完成翻译。
Yes, I think you're right. You would keep the HeaderValue attribute and then If newline is not a header, set HeaderValue to HeaderValue.feature[-1]. Else set HeaderValue to the new value.
I loved the explanation of the Adjacent Feature Attributes solution@ mark2a亚搏在线tsafe.! It is quite timely as I think this will solve a project I'm working on where I need to use Cloner and then AttributeCreator to populate the clones attributes based on the values of each preceding feature.
Excellent. Glad it's going to be of use. It's an interesting, and not uncommon, scenario.
©2020 S亚搏在线afe Software Inc |合法的