Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-1258

Add getDelimitedField method to Expression Language

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.5.0
    • Extensions
    • None

    Description

      With the ability for Processors to use arbitrary variables in the Expression Language, based on what a Processor provides, a powerful feature would be to reference a specific field in delimited text data. For example, this can be used with RouteText to very effectively route CSV (or tab-delimited, or any other type of delimited text) data.

      If we have the following line:

      1,84,Mark,555-555-5555,123 My Street,"My City, MS"
      

      We should be able to reference the city & state and capitalize it by using:

      ${line:getDelimitedField(6):toUpper()}
      

      Similarly, if we have:

      1|84|Mark|555-555-5555|123 My Street|My City, MS
      

      We should use:

      ${line:getDelimitedField(6, '|'):toUpper()}
      

      Finally, we should be able to specify an enclosing string so that if we have:

      1,84,Mark,555-555-5555,123 My Street, __My City, MS__
      

      We can access it via:

      ${line:getDelimitedField(6, '|', '__'):toUpper()}
      

      Attachments

        Activity

          People

            markap14 Mark Payne
            markap14 Mark Payne
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: