Removing commas from ADF Sink Text File? Urgent, please help...

Mike Kiser 1,536 Reputation points
2021-01-21T16:26:07.25+00:00

Hello
I have a final sink file (same as a report) as an output from an ADF Copy Activity in a Pipeline where the formatting has to be "perfect" to meet a 3rd Party Vendors requirements. The following shows the first line; it is all correct BUT I need the commas removed. I could not get ADF to create this without delimiters.
Can anyone please suggest a possible solution? I need this for Production.
Thanks!
Mike Kiser

05, ,2021-01-21, ,BMECOL, ,,,,,,, ,0000000000,0000000000,0000000000,000000000000000,+,00000000000,+,000000000000000000000,10,E,2007-10-09 00:00:00.0000000,XXXXXXXXX06,BMECOL, , , , ,00,,Henry,W, ,Loescherkisertest3,,M,1960-01-01 00:00:00.0000000, ,USA,,,,XXXXXXXXX06,,,,,,,S,Single,,010004,,,,,,,,,,15,1,,XXXXXXXXX06,BMECOL , , , , ,0 ,Address 1,Address 2,Address 3, ,City,OH, ,United States,12345,Home, ,541/981-1818, ,, ,******@battelleecology.org,20, ,,XXXXXXXXX06,BMECOL , , , , ,00,,5,HIS, , , ,25, ,,XXXXXXXXX06,BMECOL , , , , ,00,0000,C4029O,Professional,000000,000000 ,S,5200,M ,CO0001,BE CS Boulder HQ Ops,D22,NO ,REGULAR , ,,BCO , , ,40,0000000000 ,0000000000 ,1900-01-01 00:00:00.0000000,1900-01-01 00:00:00.0000000

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,646 questions
{count} vote

2 answers

Sort by: Most helpful
  1. Nasreen Akter 10,811 Reputation points Volunteer Moderator
    2021-01-21T18:27:26.217+00:00

    Hi @Mike Kiser ,

    According to the specification, I think you are trying to create a fixed length file. In this case, you can do the following (please see the screenshots attached):

    1. add a derived column just before the sink activity
    2. in the derived column, have a column e.g., outputPerLine with concat() function with all the output fields. concat(
      toString(col1),
      toString(col2),
      toString(col3),
      toString(col4),
      toString(col5),
      toString(col6),
      toString(col7),
      toString(col8),
      toString(col9)
      )
    3. in the sink Dataset Schema have only one column outputPerLine
    4. and finally in the sink, do the mapping outputPerLine from the derived column to the sink->dataset
    5. also for fixedLength file dont forget to use lpad()/rpad() function.e.g., iif(isNull(col1),
      lpad('0',9,'0'),
      lpad(col1, 9, '0')
      )

    59119-derivedactivity.jpg

    59188-sinkmapping.jpg

    59236-fixedlengthfile-1.jpg

    59189-fixedlengthfile.jpg

    ----------

    If the above response helps, please "accept as answer" and "up-vote" the same! Thanks!


  2. Mike Kiser 1,536 Reputation points
    2021-01-27T02:25:19.087+00:00

    Just to finalize this; I ended up creating a Logic App which I called from my ADF Pipeline. The Logic App stripped the comma's out using the Expression language.

    This simple expression performed this:

    ![60831-image.png]1

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.