Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-71223

readCSV: cannot get() first element by name

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • Pipeline Utility StepsVersion 2.15.2

      Trying to access the first element by name via get method always fails:

      Mapping for a not found, expected one of [a, b, c, d]

       

      --Example--

      CSVFormat fmt = CSVFormat.EXCEL.withHeader().withDelimiter(';' as char)
      def data = readCSV file: 'test.csv' , format: fmt
      echo records[0].get('d')
      echo records[0].get('c')
      echo records[0].get('b')
      echo records[0].get('a')

      --Output--

      3

      2

      1

      Mapping for a not found, expected one of [a, b, c, d]

      --'test.csv' contents---

      a;b;c;d
      test;1;2;3

            rsandell rsandell
            khegemann Klaus Hegemann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: