The TIBCO Platform is a real-time, composable data platform that will bring together an evolving set of your TIBCO solutions - and it's available now!
A chart showing the TIBCO Platform vision
Jump to content
Forums
Ask questions and gain insight from discussions

how to filter specific element value from a name/value pair array - Tibco flogo


Jaganath Baskaran 2

Recommended Posts

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

  • 1 month later...

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...