1

In my nifi flow, I need to perform name standardization for a specific column. Examples include:

  1. Making name title case
  2. If it contain mc before something such as donald, make it McDonald and such other things.

How do I perform all of these in a single go in update record processor? Also, I dont see any function for making name titlecase in nifi expression language. I only see upper and lower. How do i build the logic? Do I need to make a custom property for this? Please let me know. thanks.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245

1 Answers1

0

It's possible with the method WordUtils.capitalizeFully. Check also this question

ScriptedTransformRecord processor:

  • Record Reader: JsonTreeReader
  • Record Writer: JsonRecordSetWriter
  • Script Language: Groovy
  • Script Body:
import org.apache.commons.lang3.text.WordUtils

record.setValue("text", WordUtils.capitalizeFully(record.getValue("text")))
record

Example

input json

[
  {
    "text": "man OF stEEL"
  },
  {
    "text": "hELLo"
  }
]

output json

[
  {
    "text": "Man Of Steel"
  },
  {
    "text": "Hello"
  }
]
tonykoval
  • 958
  • 7
  • 18