cancel
Showing results for 
Search instead for 
Did you mean: 

Issue while extracting the data from Nested Collection

Niteesh_ReddyBo
Level 5

Hi,

From the last couple of days, I started seeing a weird issue wherein I was unable to extract the data from a nested collection. My source collection has multiple nested collection within it. Below is an example:

Sale Data (Collection)=> Product (Text), Quantity (Number), Cost (Number), Customer (Collection)
=> Customer (Collection) => Customer ID (Txt), Customer Name (Text), Customer Contact (Collection),
=> Customer Contact (Collection) =>  Customer Address (Text), Customer Country (Text), Customer Email (Text), Customer Mobile (Text)

From this I want to extract the 'Customer Mobile'. I'm giving 'Sale Data.Customer.Customer Contact.Customer Mobile' in a calculation stage. Although this is working for some of the rows initially, It's giving error that 'Customer Mobile' field is not available in the collection.

For troubleshooting this, I used a separate calculation stage to split each nested collection (For example, 'Calc1' to extract 'Customer' collection, 'Calc2' to extract 'Customer Contact' collection from 'Customer' collection) and then tried to get the required value from there. But, this is also giving the same error. At this stage, I observed that the collection 'Customer Contact' which I extracted using 'Calc2' is becoming empty.

This is the first time I'm facing this error. Had anyone faced this error? If yes, how did you resolved it? Also, can you please suggest any alternative approaches? Basically, I'm trying to retrieve the data from a JSON format which got through an API Service.

Thanks in Advance,



------------------------------
Niteesh Reddy Bollu
Lead Assistant Manager
------------------------------

4 REPLIES 4

Hi @Niteesh_ReddyBo

How are you gathering the data for this? are the nested table fields predefined or are they created when you get the data? Its likely a case that if the mobile number may not always be a field that is present in the data extraction. I would if you cant predefine the fields then one way around this is to use the action Utility - Collection - Field exists. This will tell you if the field is there and if so you can then try getting the mobile number and if not then skip that step.



------------------------------
Michael ONeil
Technical Lead developer
NTTData
Europe/London
------------------------------

Hi @Michael ONeil. I'm getting this data from an API Service and yes you are right, the API Service itself is missing to add keys in the JSON if they don't have any values. This is not happening in every case. Because of this, when I'm using 'JSON to collection' action, it's showing the nested collections as blank.

Is there a way we can address this?



------------------------------
Niteesh Reddy Bollu Senior Software Engineer
Lead Assistant Manager
exl service.com (India) Pvt. Ltd.
Gurgaon
9741235369
------------------------------

Hi @Niteesh_ReddyBo

I think you can do this if you use the Utility - Collection - Field exists action to determine if the field you need is in the current collection. Or possibly use a choice action to check for the collections you need and map them to a new set of defined collections.



------------------------------
Michael ONeil
Technical Lead developer
NTTData
Europe/London
------------------------------

Hi @Michael ONeil...

Right now I'm using the same approach. However, I'm looking for smaller approach as with the current approach (the one you also suggested) is complex because of too many possible fields and data sets. Anyways, thanks for your valuable suggestions.



------------------------------
Niteesh Reddy Bollu Senior Software Engineer
Lead Assistant Manager
exl service.com (India) Pvt. Ltd.
Gurgaon
9741235369
------------------------------