2013-06-23

Recently I found the documentation about this subject > FME String Functions
These functions can be used in the Advanced Text Editor for the AttributeCreator etc. In some cases operating strings, using those effectively, we can reduce dramatically the number of transformers on the canvas.

Community > Attribute Trimmer
For example, just one AttributeCreator with the following expression as the value parameter for new attribute completes the job required in the question:
@ReplaceRegEx(@Value(AttrName),(.*)(...),\1)@Format(%03d,@Evaluate(@int(@ReplaceRegEx(@Value(AttrName),(.*)(...),\2))+1))

However, I don't know whether it's preferable or not from the viewpoint of maintainability. If using too many functions in a expression, it would become difficult to understand.
Use them moderately.

When the parameter type is 'Attribute Name',
'$(PARAM_NAME)' represents the parameter value i.e. an attribute name,
'@Value($(PARAM_NAME))' represents the value which the attribute name refers to.
Let's keep this in mind, all is going well!

2013-06-08

Community > Replace value with a null
The point of this question is how to replace a character string like 'Today' or 'Day N' (N is a digit) with a null value so that only valid datetime strings formatted in "YYYY-mm-dd HH:MM:SS" will be preserved.Of course, using the StringSearcher or the StringReplacer with a regular expression would be a solution. But there should be various approaches, which is more preferable?Since there could be several patterns for non-datetime strings in such a case, we might need to prepare several regular expressions (and transformers) when filtering them out perfectly. However, for the datetime strings, we need only one expression. Even if new non-datetime string pattern appears in the future, we don't need to touch the expression.So, I thought considering about a regular expression for the datetime strings is better rather than for non-datetime strings.Addition:The StringReplacer with the following settings can replace non-datetime string with a blank and also format a datetime string into 14 digits (YYYYmmddHHMMSS) simultaneously.

2013-06-03

Using the 2D / 3DPointReplacer, we can create a point from (x, y) / (x, y, z).
To create a line, I usually use the 2D / 3DPointAdder or the PointConnector after creating points.
If the created line is closed, these transformers generate a polygon.
If not (and if I need to create a polygon), also use the LineCloser.
=====
Note: In FME 2014, the 2D/3DPointReplacer and the 2D/3DPointAdder have been integrated into the VertexCreator transformer.
=====
2015-05-11: If you are going to create points based on coordinates (x, y) / (x, y, z) given by a CSV file or an Excel spreadsheet, you can also create them with the reader.
Look at the parameters dialog when adding the reader. If you set "x_coordinate", "y_coordinate" (and "z_coordinate") to the attribute types, the reader will create points based on the values.