-1

Im struggling with to build the email body from the compose action output.

I tried different way using select, union, but could no get any results.

so the output of the compose looks like this:

[
  {
    "borderID": "1",
    "hour": "2025-10-02 00:00:00 - 2025-10-02 01:00:00"
  },
  {
    "borderID": "1",
    "hour": "2025-10-02 01:00:00 - 2025-10-02 02:00:00"
  },
  {
    "borderID": "1",
    "hour": "2025-10-02 02:00:00 - 2025-10-02 03:00:00"
  },
  {
    "borderID": "2",
    "hour": "2025-10-02 00:00:00 - 2025-10-02 01:00:00"
  },
  {
    "borderID": "2",
    "hour": "2025-10-02 01:00:00 - 2025-10-02 02:00:00"
  },
  {
    "borderID": "2",
    "hour": "2025-10-02 02:00:00 - 2025-10-02 03:00:00"
  }
]

Note that I will always have the boredID 1 and borderID 2. My goal is to produce the email body like this

For borderID = 1, results.
The following hourly intervals exceeded the threshold:
• 2025-10-02 00:00:00 - 2025-10-02 01:00:00
• 2025-10-02 01:00:00 - 2025-10-02 02:00:00
• 2025-10-02 02:00:00 - 2025-10-02 03:00:00


For borderID = 2, results.
The following hourly intervals exceeded the threshold:
• 2025-10-02 00:00:00 - 2025-10-02 01:00:00
• 2025-10-02 01:00:00 - 2025-10-02 02:00:00
• 2025-10-02 02:00:00 - 2025-10-02 03:00:00

My current logic app looks like this enter image description here

and producing the output like this

{"":"For borderID = 1, results.
The following hourly intervals exceeded the threshold:
• 2025-10-02 00:00:00 - 2025-10-02 01:00:00"}

{"":"For borderID = 1, results.
The following hourly intervals exceeded the threshold:
• 2025-10-02 01:00:00 - 2025-10-02 02:00:00"}

{"":"For borderID = 1, results.
The following hourly intervals exceeded the threshold:
• 2025-10-02 02:00:00 - 2025-10-02 03:00:00"}

{"":"For borderID = 2, results.
The following hourly intervals exceeded the threshold:
• 2025-10-02 00:00:00 - 2025-10-02 01:00:00"}

{"":"For borderID = 2, results.
The following hourly intervals exceeded the threshold:
• 2025-10-02 01:00:00 - 2025-10-02 02:00:00"}

{"":"For borderID = 2, results.
The following hourly intervals exceeded the threshold:
• 2025-10-02 02:00:00 - 2025-10-02 03:00:00"}

1 Answer 1

0

You’ll need the following Logic-App workflow to group the hourly records by borderID and format them into a single text block.
If you use this code/logic, the problem will be solved and you can easily use the final string to send an email (for example through the “Send an email” action).

The full working Logic-App JSON is available here:

https://github.com/rambhuvanparmarsingh-dev/StackoverflowSolutions/blob/89b279996717a9dbeec09216ef21549cd4870cb7/Logic%20app%20-%20parse%20JSON%20to%20compose%20the%20email%20body

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.