Rename
This layer is used to change the name of one or more captured data points using regular expressions.
Parameters
| Name | Default | Meaning |
|---|---|---|
| from | The text to search for | |
| expression | Optional expression-based text to search for | |
| to | The 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…
| Attribute | Value |
|---|---|
| Start Time | 12:00 |
| End Time | 13:00 |
| Pump #3 Pressure | 20 |
| Pump #3 Voltage | 240 |
| Pump #3 Speed | 32.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…
| Attribute | Value |
|---|---|
| Start Time | 12:00 |
| End Time | 13:00 |
| Pump Pressure | 20 |
| Pump Voltage | 240 |
| Pump Speed | 32.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.