question

LeeYongSheng-3531 avatar image
0 Votes"
LeeYongSheng-3531 asked LeeYongSheng-3531 commented

Having issues on parsing CosmosDB items into Azure Logic App Condition

Hi everyone

I am trying to develop an email alert feature in Azure Cloud environment using Azure Logic App.
For instance, send an email alert to relevant person if the threshold of "healthstatus" is less than 0.50.

As referring to snapshots attached, I am currently able to import the data such as turbo_id, datetime and healthstatus into Logic App using CosmosDB components.

However, the data can not be imported into the condition loop where I execure the IF ELSE logic.

As i am new to Azure Cloud environment, thank you in advance for your assistance in advance from this forum.

Stay safe and take care!101860-logicapp-6.jpg101991-logicapp-4.jpg101992-logicapp-5.jpg


azure-logic-appsazure-cosmos-db
logicapp-6.jpg (66.0 KiB)
logicapp-4.jpg (59.3 KiB)
logicapp-5.jpg (32.0 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @LeeYongSheng-3531, welcome to Microsoft Q&A forum.

Can you please provide the code view of your logic app please? You can attach it in a text file by masking the sensitive information. This will help us in doing repro of the issue and finding proper solution.

0 Votes 0 ·

Hi @LeeYongSheng-3531, just wanted to check if you were able to look into the answer provided.

0 Votes 0 ·
AnuragSharma-MSFT avatar image
0 Votes"
AnuragSharma-MSFT answered AnuragSharma-MSFT commented

Hi @LeeYongSheng-3531, I was able to make some changes and get it to work. Please check the screenshots below and try once:

1. Querying Azure Cosmos Documents:

102511-image.png


2. For each operation:

102445-image.png

3. Parse JSON operation:

102446-image.png

4. Condition Block:

![102521-image.png][6]

I am also attaching the code view file which you an directly use. Just provide right values for subscription id and resource group(I replaced them with xxxxx)

Please let me know if this helps or you need more details.



If answer helps, please mark it 'Accept Answer'




image.png (23.6 KiB)
image.png (22.0 KiB)
image.png (26.5 KiB)
codeview.txt (3.8 KiB)
image.png (31.3 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @LeeYongSheng-3531, I was able to repro the issue. You were using "@floatbody('Parse_JSON')?['healthscore']". But the correct code will be "@float(body('Parse_JSON')?['healthscore'])",. Body should be inside brackets.

You can use below code:

 "less": [
                                         "@float(body('Parse_JSON')?['healthscore'])",
                                         "@float(0.5)"
                                     ]

I am attaching the file again. Please let me know if you face any issue.


If answer helped, please mark it 'Accept Answer'

104673-codefile0611.txt





0 Votes 0 ·
codefile0611.txt (3.8 KiB)
LeeYongSheng-3531 avatar image
0 Votes"
LeeYongSheng-3531 answered LeeYongSheng-3531 commented

Dear AnuragSharma-MSFT

Thank you for your answer, it was really helpful to me.


The JSON Parsing is fine but having some issues on condition block, as showing no inputs.
Error message shows "floatbody is not defined.

I attached some snapshots and codeview for your reference.
Thank you!


[1]: /answers/storage/attachments/104053-support3.jpg

[2]: /answers/storage/attachments/104054-codeview-0610.txt


support3.jpg (72.4 KiB)
codeview-0610.txt (5.2 KiB)
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for replying back. I am checking this and will get back at the earliest.

0 Votes 0 ·

Dear AnuragSharma-MSFT

Thank you for your message.
I really appreciate your help looking into this issue!

0 Votes 0 ·

Dear AnuragSharma-MSFT

Thank you so much for finding the error.

I am able to make it work now and everything looks good now.

Besides this, may I ask whether there is any multiple email sending function block inside Azure Logic App?
Because thus far I only found the function block to send email to a single recipient...
And currently I am using a few of this blocks to send email to different email addresses.

Thank you!

0 Votes 0 ·