Forum Discussion

rajendraj's avatar
rajendraj
New Contributor II
5 years ago

Record Count in CSV

Is there an easier way to find the number of records in an incoming CSV? Want to log this information before processing the file. Appreciate the help but looking for a setting or simpler way to count the number.

2 Replies

  • deepak_shaw's avatar
    deepak_shaw
    Contributor

    Hi @bojanvelevski , Amazing 🙂 it’s working as expected.
    Can you please explain a bit about the code you have written in the map i.e.

    $InvoiceLines.map(x=>{"LineNumber":{"@LineExtAmtExclTax":x.LineExtAmtExclTax,"$":x.LineNumber},"value":x.Employee})
    

    Many thanks for your help,
    Deepak Shaw.

    • bojanvelevski's avatar
      bojanvelevski
      Valued Contributor
      $InvoiceLines.map(x=>{"LineNumber":{"@LineExtAmtExclTax":x.LineExtAmtExclTax,"$":x.LineNumber},"value":x.Employee})
      

      I’m glad I could help.

      With the expression above, we’re mapping a specific value to every object inside the $InvoiceLines array. Basically the .map() function will iterate through the array, and for every object, it will map a JSON structure, using the values of that object.