SDE
SDE

Reputation: 85

Access key value pair dynamically from ArrayList in mule

Here is my payload:

[{User_Feedback=Satisfied with Amelia response, Record_Creation_Time=1505848950000, User_Name=Bora Karisma, Conversation_ID=10, ConverstaionStart_dt=1505848930000, Elapsed_Time=20, Status=Failed, idsid=kbora, Record_Update_Time=1505848950000, Goal_Modified=false, Domain_Name=Testing, Classifier_Name=HotSpot_classifier, Goal_Name=HotSpot, Last_user_Utterance=Help needed to connect hotspot?, Conversation_txt=Hotspot connection failed and amelia is not able to provide solution , BPN_Name=HotSpot_BPN, ConverstaionEnd_dt=1505848950000}]

I want to access the key and value in an expression so that I can form a dynamic sql query for inserting into DB.

From the expression evaluator I am only able to access the key's value by :

#[payload[0].ConverstaionEnd_dt]

but I don't want to mention the name of the field. Is it possible to access the keys and their values inside for loop in the expression component of mule, so that I can traverse the array and then choose only field that has some value and make a dynamic SQL query.

Help is highly appreciated.

Thanks Dhanjeet

Upvotes: 1

Views: 487

Answers (1)

aled
aled

Reputation: 25812

You could try #[payload[0]['ConverstaionEnd_dt']], or use a variable #[payload[0][flowVars.fieldName]]

Upvotes: 0

Related Questions