ContributionsMost RecentMost LikesSolutionsFilter object from array Hello, I need to filter out an object from the distributionCenterSpecificData array where countryCodes array is empty. input payload: [{ "rpn": "ABCD", "gpn": "G12345", "productName": "CATHETER", "productDescription": "EXTRA FIRM", "division": "MedSurg", "sbu": "CC", "productFamily": "AIRWAY MANAGEMENT", "productSubFamily1": "C-CAE", "productSubFamily2": "NOT APPLICABLE", "productStatus": "CURRENT", "program": "CC", "madeby": "CEW", "lastUpdatedDate": "2024-02-08T00:00:50.000", "distributionCenterSpecificData": [ { "dcName": "NADC", "gtin": "004011", "uom": "EA", "quantity": 1, "availability": "AVAILABLE", "stockStatus": "STOCK", "currencyCode": "USD", "isActive": "true", "countryCodes": [] }, { "dcName": "CADC", "gtin": "004011", "uom": "EA", "quantity": 1, "availability": "AVAILABLE", "stockStatus": "STOCK", "currencyCode": "CAD", "isActive": "true", "countryCodes": [ "CA" ] } ] }, { "rpn": "XYZ", "gpn": "G45678", "productName": "GRAFT", "productDescription": "SOFT", "division": "Other", "sbu": "TTX", "productFamily": "COLORECTAL", "productSubFamily1": "RECTOPEXY", "productSubFamily2": "RECTOPEXY PLUG", "productStatus": "CURRENT", "program": "Other", "madeby": "CEW", "lastUpdatedDate": "2023-10-09T10:04:29.480", "distributionCenterSpecificData": [ { "dcName": "NADC", "gtin": "104731", "uom": "BX", "quantity": 1, "availability": "AVAILABLE", "stockStatus": "STOCK", "currencyCode": "USD", "isActive": "true", "countryCodes": [ "US" ] } ] } ] Expected output: [{ "rpn": "ABCD", "gpn": "G12345", "productName": "CATHETER", "productDescription": "EXTRA FIRM", "division": "MedSurg", "sbu": "CC", "productFamily": "AIRWAY MANAGEMENT", "productSubFamily1": "C-CAE", "productSubFamily2": "NOT APPLICABLE", "productStatus": "CURRENT", "program": "CC", "madeby": "CEW", "lastUpdatedDate": "2024-02-08T00:00:50.000", "distributionCenterSpecificData": [ { "dcName": "CADC", "gtin": "004011", "uom": "EA", "quantity": 1, "availability": "AVAILABLE", "stockStatus": "STOCK", "currencyCode": "CAD", "isActive": "true", "countryCodes": [ "CA" ] } ] }, { "rpn": "XYZ", "gpn": "G45678", "productName": "GRAFT", "productDescription": "SOFT", "division": "Other", "sbu": "TTX", "productFamily": "COLORECTAL", "productSubFamily1": "RECTOPEXY", "productSubFamily2": "RECTOPEXY PLUG", "productStatus": "CURRENT", "program": "Other", "madeby": "CEW", "lastUpdatedDate": "2023-10-09T10:04:29.480", "distributionCenterSpecificData": [ { "dcName": "NADC", "gtin": "104731", "uom": "BX", "quantity": 1, "availability": "AVAILABLE", "stockStatus": "STOCK", "currencyCode": "USD", "isActive": "true", "countryCodes": [ "US" ] } ] } ] SolvedJSON to XML conversion Hello, Im trying to convert a json payload into xml. Im using the xml generator and it gets me close. The content under data is still in json format. Can someone help with converting the content under data into xml as well? Attached is the current and expected output, as well as the json input and xml generator code. Thanks Convert to XML while updating headers Hello, Im trying to convert json payload to XML and I also need to update the headers like http status codes. I can achieve this using the document to binary snap but when I convert to xml using the XML formatter I lose the ability to update the headers. Can anyone point me in the right direction or can this even be done? Thanks for your help Re: Combine datasets from different stored procedures into one output koryknick- Works perfectly, Thank you so much!! Combine datasets from different stored procedures into one output Hello, I have a pipeline that uses two different stored procedures. The issue I'm having is that I need to incorporate the output of the second stored procedure (ranges) into every object of the first stored procedure output (risks). The output of the first stored procedure(risks) is: [ { "SupplierCode":"GVN00000007", "SupplierTeamLeadCode":"Top 150", "SupplierLocationCode":"UNITED STATES", "SupplierLocationStateCode":"Georgia", "SupplierCategoryCode":"Metals", "DBRisk":"8", "OwnershipRisk":10.0, "RestrictionsRisk":10.0, "ContractRisk":15.0, "SourceRisk":8.0, "GeopoliticalRisk":10.0, "CapacityRisk":15.0, "ContributingRisk":0.0, "FailedMarketRisk":10.0, "AggregateRisk":86.0, "RiskLevel":"Low Risk", "Mitigation_Code":null }, { "SupplierCode":"GVN00000541", "SupplierTeamLeadCode":"Top 150", "SupplierLocationCode":"UNITED STATES", "SupplierLocationStateCode":"Minnesota", "SupplierCategoryCode":"Metals", "DBRisk":"8", "OwnershipRisk":5.0, "RestrictionsRisk":10.0, "ContractRisk":15.0, "SourceRisk":8.0, "GeopoliticalRisk":10.0, "CapacityRisk":7.5, "ContributingRisk":0.0, "FailedMarketRisk":10.0, "AggregateRisk":73.5, "RiskLevel":"High Risk", "Mitigation_Code":"Implementing a contract" }, { "SupplierCode":"GVN00000541", "SupplierTeamLeadCode":"Top 150", "SupplierLocationCode":"UNITED STATES", "SupplierLocationStateCode":"Minnesota", "SupplierCategoryCode":"Metals", "DBRisk":"8", "OwnershipRisk":5.0, "RestrictionsRisk":10.0, "ContractRisk":15.0, "SourceRisk":8.0, "GeopoliticalRisk":10.0, "CapacityRisk":7.5, "ContributingRisk":0.0, "FailedMarketRisk":10.0, "AggregateRisk":73.5, "RiskLevel":"High Risk", "Mitigation_Code":"Increased Inventory" }, { "SupplierCode":"GVN00045254", "SupplierTeamLeadCode":"WCA", "SupplierLocationCode":"AUSTRALIA", "SupplierLocationStateCode":null, "SupplierCategoryCode":"Metals", "DBRisk":"5", "OwnershipRisk":7.5, "RestrictionsRisk":10.0, "ContractRisk":10.0, "SourceRisk":5.0, "GeopoliticalRisk":10.0, "CapacityRisk":7.5, "ContributingRisk":10.0, "FailedMarketRisk":10.0, "AggregateRisk":75.0, "RiskLevel":"High Risk", "Mitigation_Code":"Risk Accepted by Business" } ] Output of second stored procedure and mapper - (ranges) [ { "ranges":{ "highRiskLimitRange":"0.00-75.00" "mediumRiskLimitRange":"75.10-85.00" "lowRiskLimitRange":"85.10-1000.00" } } ] The expected result is: { "risks": [ { "riskDetails": { "supplierCode": "GVN00000007", "supplierLocationCode": "UNITED STATES", "supplierLocationStateCode": "Georgia", "dbRisk": "8", "ownershipRisk": 10.0, "restrictionsRisk": 10.0, "contractRisk": 15.0, "sourceRisk": 8.0, "geopoliticalRisk": 10.0, "capacityRisk": 15.0, "contributingRisk": 0.0, "failedMarketRisk": 10.0 }, "aggregateRiskDetails": { "aggregateRisk": 86.0, "riskLevel": "Low Risk", "ranges": { "highRiskLimitRange": "0-75", "mediumRiskLimitRange": "75.10-85", "lowRiskLimitRange": "85.10-1000" } }, "mitigationStrategies": { "mitigationCodes": [] } }, { "riskDetails": { "supplierCode": "GVN00000541", "supplierLocationCode": "UNITED STATES", "supplierLocationStateCode": "Minnesota", "dbRisk": "8", "ownershipRisk": 5.0, "restrictionsRisk": 10.0, "contractRisk": 15.0, "sourceRisk": 8.0, "geopoliticalRisk": 10.0, "capacityRisk": 7.5, "contributingRisk": 0.0, "failedMarketRisk": 10.0 }, "aggregateRiskDetails": { "aggregateRisk": 73.5, "riskLevel": "High Risk", "ranges": { "highRiskLimitRange": "0-75", "mediumRiskLimitRange": "75.10-85", "lowRiskLimitRange": "85.10-1000" } }, "mitigationStrategies": { "mitigationCodes": [ "Implementing a contract", "Increased Inventory" ] } }, { "riskDetails": { "supplierCode": "GVN00045254", "supplierLocationCode": "AUSTRALIA", "supplierLocationStateCode": "No_State_Code", "dbRisk": "5", "ownershipRisk": 7.5, "restrictionsRisk": 10.0, "contractRisk": 10.0, "sourceRisk": 5.0, "geopoliticalRisk": 10.0, "capacityRisk": 7.5, "contributingRisk": 10.0, "failedMarketRisk": 10.0 }, "aggregateRiskDetails": { "aggregateRisk": 75.0, "riskLevel": "High Risk", "ranges": { "highRiskLimitRange": "0-75", "mediumRiskLimitRange": "75.10-85", "lowRiskLimitRange": "85.10-1000" } }, "mitigationStrategies": { "mitigationCodes": [ "Risk Accepted by Business" ] } } ] } koryknick- this post has been out there for a while and I was wondering if you might be able to have a look. Your help is always appreciated! Thank you, Max SolvedData transformation issue Hello, I have a stored procedure that returns the following and i need that dataset transformed into the expected result. Thanks you for taking a look. Stored procedure result/input: [ { "RiskLevelCode": "High", "RiskLevelName": "High Risk", "Low_Limit": 0.00, "High_Limit": 75.00 }, { "RiskLevelCode": "Med", "RiskLevelName": "Medium Risk", "Low_Limit": 75.10, "High_Limit": 85.00 }, { "RiskLevelCode": "Low", "RiskLevelName": "Low Risk", "Low_Limit": 85.10, "High_Limit": 1000.00 } ] Expected result: "ranges":{ "highRiskLimitRange": "0-75", "mediumRiskLimitRange": "75.10-85", "lowRiskLimitRange": "85.10-1000" } Issue joining serveral datasets together Hello, Im trying to join several datasets together and wrap that in a object called overallMetrics. Im running into an issue when I add a mapper after the union snap. Its adding overallMetrics to each object . I have attached screen shots of the pipeline and mapper snap. Below is the input and the expected output. Thank you for your help. Input: [ { "riskDetails":{ "riskScore":{ "overallRisk":"87.33" "lowRiskCount":3 "mediumRiskCount":0 "highRiskCount":0 "statesByLowRisk":["Minnesota"] "statesByMediumRisk":[] "statesByHighRisk":[] "countriesByLowRisk":["SWEDEN","UNITED STATES"] "countriesByMediumRisk":[] "countriesByHighRisk":[] } "mitigationStrategies":{ "lowRiskMitigationCodes":["Increased Inventory","Implementing a contract"] "mediumRiskMitigationCodes":[] "highRiskMitigationCodes":[] } } }, { "diversityMetrics":[ { "diversityClassificationCode":"HUBZone Small Businesses", "percentOfTotalSpend":0.1, "percentOfTotalSuppliers":0.2 }, { "diversityClassificationCode":"Minority Owned", "percentOfTotalSpend":0.6, "percentOfTotalSuppliers":1.4 }, { "diversityClassificationCode":"Service Disabled Veteran Owned Small Businesses", "percentOfTotalSpend":0.0, "percentOfTotalSuppliers":0.1 }, { "diversityClassificationCode":"Small Businesses", "percentOfTotalSpend":9.8, "percentOfTotalSuppliers":26.1 }, { "diversityClassificationCode":"Small Disadvantaged Businesses", "percentOfTotalSpend":0.4, "percentOfTotalSuppliers":1.9 }, { "diversityClassificationCode":"Veteran Owned", "percentOfTotalSpend":0.0, "percentOfTotalSuppliers":0.1 }, { "diversityClassificationCode":"Veteran Owned Small Businesses", "percentOfTotalSpend":0.3, "percentOfTotalSuppliers":1.2 }, { "diversityClassificationCode":"Woman Owned", "percentOfTotalSpend":0.3, "percentOfTotalSuppliers":1.5 }, { "diversityClassificationCode":"Woman Owned Small Businesses", "percentOfTotalSpend":0.6, "percentOfTotalSuppliers":2.7 } ] }, { "rawMaterialSource":{ "insideUsaPercentage":72 "statesInsideUsa":[ "Arizona","Connecticut","Florida","Georgia","Illinois","Indiana","Massachusetts","Michigan","Minnesota","New Hampshire" ] "outsideUsaPercentage":28 "countriesOutsideUsa":[ "AUSTRALIA","CANADA","DENMARK","GERMANY","IRELAND","JAPAN","SWITZERLAND" ] } } ] Expected output: { overallMetrics: { "riskDetails":{ "riskScore":{ "overallRisk":"87.33" "lowRiskCount":3 "mediumRiskCount":0 "highRiskCount":0 "statesByLowRisk":["Minnesota"] "statesByMediumRisk":[] "statesByHighRisk":[] "countriesByLowRisk":["SWEDEN","UNITED STATES"] "countriesByMediumRisk":[] "countriesByHighRisk":[] } "mitigationStrategies":{ "lowRiskMitigationCodes":["Increased Inventory","Implementing a contract"] "mediumRiskMitigationCodes":[] "highRiskMitigationCodes":[] } } }, { "diversityMetrics":[ { "diversityClassificationCode":"HUBZone Small Businesses", "percentOfTotalSpend":0.1, "percentOfTotalSuppliers":0.2 }, { "diversityClassificationCode":"Minority Owned", "percentOfTotalSpend":0.6, "percentOfTotalSuppliers":1.4 }, { "diversityClassificationCode":"Service Disabled Veteran Owned Small Businesses", "percentOfTotalSpend":0.0, "percentOfTotalSuppliers":0.1 }, { "diversityClassificationCode":"Small Businesses", "percentOfTotalSpend":9.8, "percentOfTotalSuppliers":26.1 }, { "diversityClassificationCode":"Small Disadvantaged Businesses", "percentOfTotalSpend":0.4, "percentOfTotalSuppliers":1.9 }, { "diversityClassificationCode":"Veteran Owned", "percentOfTotalSpend":0.0, "percentOfTotalSuppliers":0.1 }, { "diversityClassificationCode":"Veteran Owned Small Businesses", "percentOfTotalSpend":0.3, "percentOfTotalSuppliers":1.2 }, { "diversityClassificationCode":"Woman Owned", "percentOfTotalSpend":0.3, "percentOfTotalSuppliers":1.5 }, { "diversityClassificationCode":"Woman Owned Small Businesses", "percentOfTotalSpend":0.6, "percentOfTotalSuppliers":2.7 } ] }, { "rawMaterialSource":{ "insideUsaPercentage":72 "statesInsideUsa":[ "Arizona","Connecticut","Florida","Georgia","Illinois","Indiana","Massachusetts","Michigan","Minnesota","New Hampshire" ] "outsideUsaPercentage":28 "countriesOutsideUsa":[ "AUSTRALIA","CANADA","DENMARK","GERMANY","IRELAND","JAPAN","SWITZERLAND" ] } } } SolvedRe: Convert Mulsoft dataweave code to SnapLogic koryknickThis is perfect, Thank you! Re: Convert Mulsoft dataweave code to SnapLogic koryknick Hello, wondering if you might have a look at this issue. I appreciate your help. Thank you! Convert Mulsoft dataweave code to SnapLogic Hello, I have the following MuleSoft code im trying to convert into SnapLogic. I have tried everything i can think of and im not getting anywhere. Also, posted below is a sample output from stored procedure and the expected output i need. Thank you for you time and help! MuleSoft dataWeave Code: %dw 2.0 output application/json var payloadGroupByRiskLevel = ((vars.edpResponse.resultSet1 map ((item, index) -> { "state": item.SupplierLocationStateCode default "No_State_Code", "country": item.SupplierLocationCode, "riskLevel": item.RiskLevel })) groupBy ((item, index) -> item.riskLevel)) var overallRisk = avg((vars.edpResponse.resultSet1 map ((item, index) -> item.AggregateRisk) default [])) as String {format: "0.00"} --- { "riskDetails": { "riskScore": { "overAllRisk": overallRisk, "lowRiskCount": sizeOf(payloadGroupByRiskLevel["Low Risk"] default []), "mediumRiskCount": sizeOf(payloadGroupByRiskLevel["Medium Risk"] default []), "highRiskCount": sizeOf(payloadGroupByRiskLevel["High Risk"] default []), "statesByLowRisk": ((payloadGroupByRiskLevel["Low Risk"].state) distinctBy $) orderBy $, "statesByMediumRisk": ((payloadGroupByRiskLevel["Medium Risk"].state) distinctBy $) orderBy $, "statesByHighRisk": ((payloadGroupByRiskLevel["High Risk"].state) distinctBy $) orderBy $, "countriesByLowRisk": ((payloadGroupByRiskLevel["Low Risk"].country) distinctBy $) orderBy $, "countriesByMediumRisk": ((payloadGroupByRiskLevel["Medium Risk"].country) distinctBy $) orderBy $, "countriesByHighRisk": ((payloadGroupByRiskLevel["High Risk"].country) distinctBy $) orderBy $, } } } Output from stored Prodcedure: [ { "SupplierCode":"GVN12345", "SupplierTeamLeadCode":"Top 150", "SupplierLocationCode":"UNITED STATES", "SupplierLocationStateCode":"Minnesota", "SupplierCategoryCode":"Metals", "DBRisk":8, "OwnershipRisk":5.0, "RestrictionsRisk":10.0, "ContractRisk":15.0, "SourceRisk":8.0, "GeopoliticalRisk":10.0, "CapacityRisk":7.5, "ContributingRisk":0.0, "FailedMarketRisk":10.0, "AggregateRisk":73.5, "RiskLevel":"High Risk", "Mitigation_Code":"Implementing a contract", "RankNumber":1, "RowNumber":1, "TotalResults":4 }, { "SupplierCode":"GVN12345", "SupplierTeamLeadCode":"Top 150", "SupplierLocationCode":"UNITED STATES", "SupplierLocationStateCode":"Minnesota", "SupplierCategoryCode":"Metals", "DBRisk":8, "OwnershipRisk":5.0, "RestrictionsRisk":10.0, "ContractRisk":15.0, "SourceRisk":8.0, "GeopoliticalRisk":10.0, "CapacityRisk":7.5, "ContributingRisk":0.0, "FailedMarketRisk":10.0, "AggregateRisk":73.5, "RiskLevel":"High Risk", "Mitigation_Code":"Increased Inventory", "RankNumber":1, "RowNumber":2, "TotalResults":4 }, { "SupplierCode":"GVN56789", "SupplierTeamLeadCode":"WCA", "SupplierLocationCode":"AUSTRALIA", "SupplierLocationStateCode":null, "SupplierCategoryCode":"Metals", "DBRisk":5, "OwnershipRisk":7.5, "RestrictionsRisk":10.0, "ContractRisk":10.0, "SourceRisk":5.0, "GeopoliticalRisk":10.0, "CapacityRisk":7.5, "ContributingRisk":10.0, "FailedMarketRisk":10.0, "AggregateRisk":75.0, "RiskLevel":"High Risk", "Mitigation_Code":"Risk Accepted by Business", "RankNumber":3, "RowNumber":3, "TotalResults":4 }, { "SupplierCode":"GVN11223", "SupplierTeamLeadCode":"CWS", "SupplierLocationCode":"SWEDEN", "SupplierLocationStateCode":null, "SupplierCategoryCode":"Polymers", "DBRisk":8, "OwnershipRisk":10.0, "RestrictionsRisk":10.0, "ContractRisk":10.0, "SourceRisk":8.0, "GeopoliticalRisk":10.0, "CapacityRisk":15.0, "ContributingRisk":10.0, "FailedMarketRisk":10.0, "AggregateRisk":91.0, "RiskLevel":"Low Risk", "Mitigation_Code":null, "RankNumber":4, "RowNumber":4, "TotalResults":4 } ] Expected output: { "riskDetails": { "riskScore": { "overAllRisk": “79.83” "lowRiskCount": 1, "mediumRiskCount": 0, "highRiskCount": 2, "statesByLowRisk": ["No_State_Code"], "statesByMediumRisk": [], "statesByHighRisk": ["Minnesota"], "countriesByLowRisk": ["SWEDEN"], "countriesByMediumRisk": [], "countriesByHighRisk": ["AUSTRALIA","UNITED STATES"] } } } Solved