Forum Discussion

jwb3d's avatar
jwb3d
Frequent Visitor
2 months ago

Format output to CSV FILE

I have established a variable that contains several variables in a concatenated form. Please see below.

 

concat(variables('HeaderLine1'), decodeUriComponent('%0A'), variables('HeaderLine2'), decodeUriComponent('%0A'), body('Join'))

Current Output:

 

10 SCADA.DB4 STATUS value1 name decodeUriComponent('%0A') [{"blank":""value1:"466677"name:"Ted Sample"}]

 

I wish to eliminate the key from the preview join and display solely the values. Additionally, I am using decodeUriComponent('%0A'), but it is not providing the CRLF in the output CSV file.

Desired Output:

10SCADA.DB 
4STATUSvalue1Name
  466677Ted Sample
0   
0   

 

2 Replies

  • Hi jwb3d,

    Thank you for reaching out to the Microsoft Fabric Community Forum.

    The Microsoft Fabric Community Forum focuses on issues related to Power BI and Microsoft Fabric specifically. If your query is not related to Power BI or Fabric and is instead related to Power Platform or Power Automate, we kindly request you to post it in the respective community forum using the links provided below:
    Microsoft Power Platform Community Forum Thread
    Microsoft Power Platform Community Forum Thread
    Find Answers | Microsoft Power Platform Community

    Should you have any further queries, please feel free to contact the Microsoft Fabric Community.

    Thank you.

  • Omkar_1712's avatar
    Omkar_1712
    Solution Specialist

    Hello jwb3d,

    It looks like there are two separate issues:

    1. body('Join') is returning the JSON object, so you're seeing both keys and values. Before joining the data, use a Select action (or map only the required fields) so that only the values are passed to the Join action.

    2. For a proper new line in the CSV, use CRLF instead of LF:

    decodeUriComponent('%0D%0A')

    or

    '\r\n'

    Your final expression would look similar to:

    concat(
        variables('HeaderLine1'),
        decodeUriComponent('%0D%0A'),
        variables('HeaderLine2'),
        decodeUriComponent('%0D%0A'),
        outputs('Join')
    )

    This will generate the header followed by the data rows with the correct line breaks. If you're still seeing the field names (keys), the issue is with the data being passed into the Join action rather than the concat() expression itself.


    Best regards,
    Omkar Shinde
    Microsoft Fabric Enthusiast | Power BI Consultant

    💡 If you found this response helpful, please consider giving it a Kudos.
    ✅ If this resolves your question, please mark it as the Accepted Solution to help others in the community.