Azure Logic Apps按属性过滤子数组失效问题排查
Azure Logic Apps 过滤MEMBERSHIP_DATA失败排查请求
从第三方端点获取了如下示例Payload,希望通过Azure Logic Apps仅返回其中的Data数组,同时过滤掉MEMBERSHIP_DATA中status属性为"Previous"的对象(例如示例中Paul Doe的第一条会员记录应被移除)。但当前我的Logic App定义执行后,虽能返回Data数组,却未按要求过滤MEMBERSHIP_DATA,现附上Payload和Logic App定义,请求排查问题:
{ "SearchSummary": { "TotalRecordsFound": 48, "Offset": 0, "RecordsReturned": 48, "DatabaseInfo": { "ReleaseNumber": "43", "UpdateNumber": "431", "UpdateDate": "2024-08-20T00:00:00", "VersionNumber": "129.00", "IndexationDate": null }, "Sort": null }, "Data": [ { "birthdate": "1950-06-01T00:00:00", "firstName": "Ian", "middleName": "Charlie", "lastName": "Jones", "dirId": "P003577888", "MEMBERSHIP_DATA": [ { "companyId": null, "companyName": null, "startDate": null, "status": null, "endDate": null, "title": null, "dept": null } ] }, { "birthdate": "1919-05-11T00:00:00", "firstName": "Dorothy", "middleName": "June", "lastName": "Perkins", "dirId": "P003890700", "MEMBERSHIP_DATA": [ { "companyId": null, "companyName": null, "startDate": null, "status": null, "endDate": null, "title": null, "dept": null } ] }, { "birthdate": "1947-11-09T00:00:00", "firstName": "Paul", "middleName": "Dean", "lastName": "Doe", "dirId": "P003890600", "MEMBERSHIP_DATA": [ { "companyId": "GB04969800", "companyName": "Acme Ltd 1", "startDate": "2020-04-15T00:00:00", "status": "Previous", "endDate": "2021-04-15T00:00:00", "title": "Director", "dept": "Board of Directors; Senior management" }, { "companyId": "GB07346800", "companyName": "Acme Ltd 2", "startDate": "2010-08-16T00:00:00", "status": "Current", "endDate": null, "title": "Director", "dept": "Board of Directors; Senior management" } ] } ] }
我的Logic App定义如下:
{ "definition": { "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", "actions": { "Create_CompanyContact_Array": { "inputs": { "variables": [ { "name": "CompanyContacts", "type": "array", "value": "@body('Parse_JSON')?['Data']" } ] }, "runAfter": { "Parse_JSON": [ "SUCCEEDED" ] }, "type": "InitializeVariable" }, "HTTP": { "inputs": { "headers": { "ApiToken": "XXX" }, "method": "GET", "uri": "https://companytest.free.beeceptor.com/contact" }, "runAfter": {}, "type": "Http" }, "Loop_Contacts": { "actions": { "Loop_Membership": { "actions": { "Filter_array": { "inputs": { "from": "@items('Loop_Contacts')?['MEMBERSHIP_DATA']", "where": "@equals(items('Loop_Membership')['Status'],'Current')" }, "type": "Query" } }, "foreach": "@items('Loop_Contacts')?['MEMBERSHIP_DATA']", "type": "foreach" } }, "foreach": "@variables('CompanyContacts')", "runAfter": { "Create_CompanyContacts_Array": [ "SUCCEEDED" ] }, "type": "foreach" }, "Parse_JSON": { "inputs": { "content": "@body('HTTP')", "schema": { "properties": { "Data": { "items": { "properties": { "MEMBERSHIP_DATA": { "items": { "properties": { "companyId": { "type": [ "string", "null" ] }, "companyName": { "type": [ "string", "null" ] }, "dept": { "type": [ "string", "null" ] }, "endDate": { "type": [ "string", "null" ] }, "startDate": { "type": [ "string", "null" ] }, "status": { "type": [ "string", "null" ] }, "title": { "type": [ "string", "null" ] } }, "type": "object" }, "type": "array" }, "birthdate": { "type": [ "string", "null" ] }, "dirId": { "type": [ "string", "null" ] }, "firstName": { "type": [ "string", "null" ] }, "lastName": { "type": [ "string", "null" ] }, "middleName": { "type": [ "string", "null" ] } }, "type": "object" }, "type": "array" }, "SearchSummary": { "properties": { "DatabaseInfo": { "properties": { "IndexationDate": {}, "ReleaseNumber": { "type": "string" }, "UpdateDate": { "type": "string" }, "UpdateNumber": { "type": "string" }, "VersionNumber": { "type": "string" } }, "type": "object" }, "Offset": { "type": "integer" }, "RecordsReturned": { "type": "integer" }, "Sort": {}, "TotalRecordsFound": { "type": "integer" } }, "type": "object" } }, "type": "object" } }, "runAfter": { "HTTP": [ "SUCCEEDED" ] }, "type": "ParseJson" }, "Response": { "inputs": { "body": "@variables('CompanyContacts')", "statusCode": "@outputs('HTTP')?['statusCode']" }, "kind": "Http", "runAfter": { "Loop_Contacts": [ "SUCCEEDED" ] }, "type": "Response" } }, "contentVersion": "1.0.0.0", "outputs": {}, "triggers": { "When_a_HTTP_request_is_received": { "kind": "Http", "type": "Request" } } }, "kind": "Stateless" }
内容的提问来源于stack exchange,提问作者InvalidSyntax
相关产品推荐
相关产品推荐

