Jaganath Baskaran 2 Posted December 20, 2021 Share Posted December 20, 2021 Hi Team , Product : Tibco Cloud integration - FLOGO We have a requriement to filter specific element value from a name/value pair array . But seems to be not possible with the array functions or filter conditions . We have tried multiple ways and not able to achieve it . Could you please help and provide your inputs here . Description : we have an array with name/value pair as input . { "sf_return_rows": [ { "attr_name": "Email", "value": "cj1-drv-dev-1421@mailinator.com" }, { "attr_name": "FirstName", "value": "Fernando" }, { "attr_name": "Id", "value": "0030r00000iacWyAAI" }, { "attr_name": "LP_CountryCode__c", "value": "LPIE" }, { "attr_name": "LP_MainContact__c", "value": false }, { "attr_name": "LastName", "value": "Test" } ] } We need to map the value of specific elements to the , string element in the output schema . Index will change at anytime . So we cant use the index number here to filter out . We supposed to filter out based on the attr_name . example : first_name ---> (this needs to be value of the attr_name:FirstName) - Note : this is a primitive string element last_name --->(this needs to be value of the attr_name:LastName)- Note : this is a primitive string element Link to comment Share on other sites More sharing options...
Andy-dont-use Pritchard Posted February 4, 2022 Share Posted February 4, 2022 Sorry for this being rather late but worth adding an answer. The only option i can see is to do this in multiple steps. Using a Mapper activity. Add a mapper, set the input to the same format as the array that you want to extract the data from. Map the array using foreach: array.forEach($activity[ParseJSON].jsonObject.sf_return_rows, "sf_return_rows", $loop.attr_name=="FirstName")Where $activity[ParseJSON].jsonObject.sf_return_rows is the source of the array ... This would give you the ability to know that the FirstName is available from the Mapper resultset as the 0 (zero) index value. HTH Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now