|
228 | 228 | /// not exactly the same, then a warning output message will be prompted. |
229 | 229 | /// - **last**: It will simply register the value of the metadata member |
230 | 230 | /// from the last file in the list of selected files. |
| 231 | +/// - **append**: It will append the metadata member value to the previous |
| 232 | +/// value. The user can specify the appender string after the `append` |
| 233 | +/// keyword. If no appender is given, then an empty string will be used. |
| 234 | +/// It will check if the value is already in the string and not append it |
| 235 | +/// if it is. Use _extend_ if you want to force the append. |
| 236 | +/// - **extend**: same as _append_ but it will not check if the value is |
| 237 | +/// already in the string. |
231 | 238 | /// |
232 | 239 | /// ### Adding a new column based on relevant quantities |
233 | 240 | /// |
@@ -513,6 +520,26 @@ std::vector<std::string> TRestDataSet::FileSelection() { |
513 | 520 | } |
514 | 521 |
|
515 | 522 | if (properties.strategy == "last") properties.value = value; |
| 523 | + |
| 524 | + if (properties.strategy.find("append") != std::string::npos) { |
| 525 | + // Get appender from "append" til the end of string. E.g. "append," -> "," or "append" -> "" |
| 526 | + std::string appender = properties.strategy.substr(properties.strategy.find("append") + 6); |
| 527 | + if (properties.value.empty()) |
| 528 | + properties.value = value; |
| 529 | + else |
| 530 | + // do not append if value already contains the value to append |
| 531 | + if (properties.value.find(value) == std::string::npos) |
| 532 | + properties.value += appender + value; |
| 533 | + } |
| 534 | + |
| 535 | + if (properties.strategy.find("extend") != std::string::npos) { |
| 536 | + // Get appender from "extend" til the end of string. E.g. "extend," -> "," or "extend" -> "" |
| 537 | + std::string appender = properties.strategy.substr(properties.strategy.find("extend") + 6); |
| 538 | + if (properties.value.empty()) |
| 539 | + properties.value = value; |
| 540 | + else |
| 541 | + properties.value += appender + value; |
| 542 | + } |
516 | 543 | } |
517 | 544 |
|
518 | 545 | if (run.GetStartTimestamp() < fStartTime) fStartTime = run.GetStartTimestamp(); |
|
0 commit comments