I want to put the output of an HTTP POST request into an html table

NishimuraChinatsu-9854 756 Reputation points
2023-04-25T09:33:40.94+00:00

I want to put the output of an HTTP POST request into an html table. I'd like to create the output of an HTTP POST request as an html table and send it via email. I'm trying to change from a string to an array, but I get an error and can't get it to work. I have seen similar questions and have tried everything, but I can't get it to work, so can you please help me?

"material_cd" : ~~~~~ I would like to make a table at the ~~~~ value. This is just the part of the csv file that I need extracted with web activity in synapse pipeline.User's image

User's image

tempsnip

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,996 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sonny Gillissen 3,351 Reputation points
    2023-05-09T19:56:31.4466667+00:00

    Hi NishimuraChinatsu-9854

    Thanks for reaching out on Microsoft Q&A!

    I've tested your request in my test lab, and I noticed your ['material_cd'] attribute contains a string, where you must first "convert" it to an array with lines before it can become a HTML table. To do this the following principle applies to your example:

    • First split the rows by the \n (line break) character
    • Next select all rows, while splitting the columns based on the comma (,)
    • The output can be converted to the HTML table you're looking for

    So first we're going to break the rows in pieces using the line break character \n. You can do this be referencing the triggerBody()['material_cd'] in your code like this in a Compose action:

    split(triggerBody()['material_cd'],'

    ')

    User's image

    Next we're going to use the outputs of the Compose action to split the columns in each row using the following function (with a defined header and the index of the column):

    split(item(),',')[0]

    User's image

    After that you can use the outputs of the Select action in the create HTML table:

    User's image

    This results in the table you wished:

    User's image

    Please let me know if this answer was helpful by clicking 'Accept answer'. Feel free to drop additional queries in the comments below!

    0 comments No comments