英文:
Logic App Extracting String and Group them to Body Email
问题
这里是代码段的翻译,提取了您期望的AppId的部分:
- Youtube
- ios
- strongbox
- ......
您尝试了以下操作:
并且获得了以下结果:
问题是:如果我要发送邮件,它将至少发送23次,这将引起混乱。如何像这样对它们进行分组:
- Youtube
- ios
- strongbox
并且只发送一次。感谢您的提前贡献。
英文:
Hello here is the snippet of my code and I am trying to get the AppId from this represented in the following manner in oder to send it via mail.
{
"appId": "com.google.ios.youtube"
},
{
"appId": "com.keepassium.ios"
},
{
"appId": "com.markmcguill.strongbox"
},
{
"appId": "com.microsoft.azureauthenticator"
},
{
"appId": "com.microsoft.Office.Excel"
},
{
"appId": "com.microsoft.Office.Powerpoint"
},
{
"appId": "com.microsoft.Office.Word"
},
{
"appId": "com.microsoft.onenote"
},
{
"appId": "com.microsoft.rdc.ios"
},
{
"appId": "com.microsoft.skydrive"
}
What i expect is:
Youtube
ios
strongbox
......
I tried this
and I got this one
The Problem is: if I want to send a mail this will be sent at least 23 times and it'll cause chaos. How can I group them like this:
- Youtube
- ios
- strongbox
and send them once. Sorry to be long and thanks in advance for your contribution.
答案1
得分: 0
我在我的环境中复现并获得了以下预期结果:
您可以使用**空数组变量
和使用空格连接操作符
**来实现此操作:
输出:
之后,您可以将电子邮件作为操作。
代码视图:
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"For_each": {
"actions": {
"Append_to_array_variable": {
"inputs": {
"name": "var",
"value": "@outputs('Compose')"
},
"runAfter": {
"Compose": [
"Succeeded"
]
},
"type": "AppendToArrayVariable"
},
"Compose": {
"inputs": "@last(split(items('For_each')['appId'],'.'))",
"runAfter": {},
"type": "Compose"
}
},
"foreach": "@body('Parse_JSON')",
"runAfter": {
"Parse_JSON": [
"Succeeded"
]
},
"type": "Foreach"
},
"Initialize_variable": {
"inputs": {
"variables": [
{
"name": "var",
"type": "array"
}
]
},
"runAfter": {},
"type": "InitializeVariable"
},
"Join": {
"inputs": {
"from": "@variables('var')",
"joinWith": " "
},
"runAfter": {
"For_each": [
"Succeeded"
]
},
"type": "Join"
},
"Parse_JSON": {
"inputs": {
"content": "@triggerBody()",
"schema": {
"items": {
"properties": {
"appId": {
"type": "string"
}
},
"required": [
"appId"
],
"type": "object"
},
"type": "array"
}
},
"runAfter": {
"Initialize_variable": [
"Succeeded"
]
},
"type": "ParseJson"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {},
"triggers": {
"manual": {
"inputs": {
"schema": {}
},
"kind": "Http",
"type": "Request"
}
}
},
"parameters": {}
}
编辑:
在此处使用了**空格 - 空格
**:
输出:
英文:
I have reproduced in my environment and got expected results as below:
You can use Empty array variable
and Join Operator with space
for this:
Output:
After this you can use Email as an action.
Code view:
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"For_each": {
"actions": {
"Append_to_array_variable": {
"inputs": {
"name": "var",
"value": "@outputs('Compose')"
},
"runAfter": {
"Compose": [
"Succeeded"
]
},
"type": "AppendToArrayVariable"
},
"Compose": {
"inputs": "@last(split(items('For_each')['appId'],'.'))",
"runAfter": {},
"type": "Compose"
}
},
"foreach": "@body('Parse_JSON')",
"runAfter": {
"Parse_JSON": [
"Succeeded"
]
},
"type": "Foreach"
},
"Initialize_variable": {
"inputs": {
"variables": [
{
"name": "var",
"type": "array"
}
]
},
"runAfter": {},
"type": "InitializeVariable"
},
"Join": {
"inputs": {
"from": "@variables('var')",
"joinWith": " "
},
"runAfter": {
"For_each": [
"Succeeded"
]
},
"type": "Join"
},
"Parse_JSON": {
"inputs": {
"content": "@triggerBody()",
"schema": {
"items": {
"properties": {
"appId": {
"type": "string"
}
},
"required": [
"appId"
],
"type": "object"
},
"type": "array"
}
},
"runAfter": {
"Initialize_variable": [
"Succeeded"
]
},
"type": "ParseJson"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {},
"triggers": {
"manual": {
"inputs": {
"schema": {}
},
"kind": "Http",
"type": "Request"
}
}
},
"parameters": {}
}
EDIT:
Used space - space here:
Output:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论