Rename

This layer is used to change the name of one or more captured data points using regular expressions.

Parameters

NameDefaultMeaning
fromThe text to search for
expressionOptional expression-based text to search for
toThe resulting text

Description

This is most often used when you have captured data that varies in name or number.

For example, let's say we have several water pumps, named Water Pump #1 to Water Pump #5. We also have a table of incidents that include a field that identifies which pump failed.

When we get data for a particular incident on Pump 3, we end up capturing points like Water Pump #3 Pressure, Water Pump #3 Speed and Water Pump #3 Voltage.

But if we want to directly compare incidents, it would be much easier if these all used the same point-names, so renaming them to just Pump Pressure / Speed / Voltage would be useful.

Example

Let's say we start with…

AttributeValue
Start Time12:00
End Time13:00
Pump #3 Pressure20
Pump #3 Voltage240
Pump #3 Speed32.3

…and we have the following layer…

[{
    "type": "rename",
    "from": "Pump #.\s(.*)",
    "to": "Pump $1",
    "comment": "Rename Pump Data"
}]

Our final output will rename the two 'Pump #3' values so that our final attributes look like those below…

AttributeValue
Start Time12:00
End Time13:00
Pump Pressure20
Pump Voltage240
Pump Speed32.3

Using Attributes In Expressions

If you want to use attribute values in expressions, use the expression rather than from parameter.

This would allow you to use the values of captured attributes in your regular expression.